GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_crypto_clienthello-inl.h Lines: 31 31 100.0 %
Date: 2017-06-14 Branches: 4 8 50.0 %

Line Branch Exec Source
1
// Copyright Joyent, Inc. and other Node contributors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
#ifndef SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
23
#define SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "util.h"
28
#include "util-inl.h"
29
30
namespace node {
31
32
20770
inline void ClientHelloParser::Reset() {
33
20770
  frame_len_ = 0;
34
20770
  body_offset_ = 0;
35
20770
  extension_offset_ = 0;
36
20770
  session_size_ = 0;
37
20770
  session_id_ = nullptr;
38
20770
  tls_ticket_size_ = -1;
39
20770
  tls_ticket_ = nullptr;
40
20770
  servername_size_ = 0;
41
20770
  servername_ = nullptr;
42
20770
}
43
44
10032
inline void ClientHelloParser::Start(ClientHelloParser::OnHelloCb onhello_cb,
45
                                     ClientHelloParser::OnEndCb onend_cb,
46
                                     void* onend_arg) {
47
10032
  if (!IsEnded())
48
10032
    return;
49
10032
  Reset();
50
51
10032
  CHECK_NE(onhello_cb, nullptr);
52
53
10032
  state_ = kWaiting;
54
10032
  onhello_cb_ = onhello_cb;
55
10032
  onend_cb_ = onend_cb;
56
10032
  cb_arg_ = onend_arg;
57
}
58
59
22
inline void ClientHelloParser::End() {
60
22
  if (state_ == kEnded)
61
22
    return;
62
22
  state_ = kEnded;
63
22
  if (onend_cb_ != nullptr) {
64
22
    onend_cb_(cb_arg_);
65
22
    onend_cb_ = nullptr;
66
  }
67
}
68
69
27089
inline bool ClientHelloParser::IsEnded() const {
70
27089
  return state_ == kEnded;
71
}
72
73
3
inline bool ClientHelloParser::IsPaused() const {
74
3
  return state_ == kPaused;
75
}
76
77
}  // namespace node
78
79
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
80
81
#endif  // SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_