GCC Code Coverage Report
Directory: ../src/ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/src/node_crypto_clienthello-inl.h Lines: 20 20 100.0 %
Date: 2016-07-26 Branches: 5 12 41.7 %

Line Exec Source
1
#ifndef SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
2
#define SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "util.h"
7
#include "util-inl.h"
8
9
namespace node {
10
11
inline void ClientHelloParser::Reset() {
12
619
  frame_len_ = 0;
13
619
  body_offset_ = 0;
14
619
  extension_offset_ = 0;
15
20
  session_size_ = 0;
16
20
  session_id_ = nullptr;
17
619
  tls_ticket_size_ = -1;
18
20
  tls_ticket_ = nullptr;
19
20
  servername_size_ = 0;
20
20
  servername_ = nullptr;
21
}
22
23
inline void ClientHelloParser::Start(ClientHelloParser::OnHelloCb onhello_cb,
24
                                     ClientHelloParser::OnEndCb onend_cb,
25
                                     void* onend_arg) {
26
20
  if (!IsEnded())
27
    return;
28
20
  Reset();
29
30
  CHECK_NE(onhello_cb, nullptr);
31
32
20
  state_ = kWaiting;
33
20
  onhello_cb_ = onhello_cb;
34
20
  onend_cb_ = onend_cb;
35
20
  cb_arg_ = onend_arg;
36
}
37
38
inline void ClientHelloParser::End() {
39
16
  if (state_ == kEnded)
40
    return;
41
16
  state_ = kEnded;
42
16
  if (onend_cb_ != nullptr) {
43
16
    onend_cb_(cb_arg_);
44
16
    onend_cb_ = nullptr;
45
  }
46
}
47
48
inline bool ClientHelloParser::IsEnded() const {
49
  return state_ == kEnded;
50
}
51
52
inline bool ClientHelloParser::IsPaused() const {
53
  return state_ == kPaused;
54
}
55
56
}  // namespace node
57
58
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
59
60
#endif  // SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_