proxygen
Types.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <fizz/protocol/Types.h>
10 
11 namespace fizz {
12 
14  switch (cipher) {
18  return HashFunction::Sha256;
20  return HashFunction::Sha384;
21  }
22  throw std::runtime_error("unknown cipher suite");
23 }
24 
25 size_t getHashSize(HashFunction hash) {
26  switch (hash) {
28  return 32;
30  return 48;
31  }
32  throw std::runtime_error("unknown hash function");
33 }
34 
36  switch (hash) {
38  return "Sha256";
40  return "Sha384";
41  }
42  return "Invalid HashFunction";
43 }
44 
46  switch (pskType) {
48  return "NotSupported";
50  return "NotAttempted";
51  case PskType::Rejected:
52  return "Rejected";
53  case PskType::External:
54  return "External";
56  return "Resumption";
57  }
58  return "Invalid PskType";
59 }
60 
62  switch (kexType) {
64  return "None";
66  return "OneRtt";
68  return "HelloRetryRequest";
69  }
70  return "Invalid kex type";
71 }
72 
74  switch (earlyDataType) {
76  return "NotAttempted";
78  return "Attempted";
80  return "Rejected";
82  return "Accepted";
83  }
84  return "Invalid EarlyDataType";
85 }
86 } // namespace fizz
folly::StringPiece toString(StateEnum state)
Definition: State.cpp:16
EarlyDataType
Definition: Types.h:33
size_t getHashSize(HashFunction hash)
Definition: Types.cpp:25
CipherSuite
Definition: Types.h:153
CipherSuite cipher
HashFunction getHashFunction(CipherSuite cipher)
Definition: Types.cpp:13
HashFunction
Definition: Types.h:16
Definition: Actions.h:16
PskType
Definition: Types.h:18
KeyExchangeType
Definition: Types.h:31