|
enum | KeyType { KeyType::RSA,
KeyType::P256,
KeyType::P384,
KeyType::P521
} |
|
enum | Direction : uint8_t { Direction::UPSTREAM,
Direction::DOWNSTREAM
} |
|
enum | VerificationContext { VerificationContext::Client,
VerificationContext::Server,
VerificationContext::Client,
VerificationContext::Server
} |
|
enum | CertificateVerifyContext { CertificateVerifyContext::Server,
CertificateVerifyContext::Client,
CertificateVerifyContext::Authenticator
} |
|
enum | VerificationContext { VerificationContext::Client,
VerificationContext::Server,
VerificationContext::Client,
VerificationContext::Server
} |
|
enum | Event {
Event::ClientHello,
Event::ServerHello,
Event::EndOfEarlyData,
Event::HelloRetryRequest,
Event::EncryptedExtensions,
Event::CertificateRequest,
Event::Certificate,
Event::CompressedCertificate,
Event::CertificateVerify,
Event::Finished,
Event::NewSessionTicket,
Event::KeyUpdate,
Event::Alert,
Event::Accept,
Event::Connect,
Event::AppData,
Event::EarlyAppWrite,
Event::AppWrite,
Event::AppClose,
Event::WriteNewSessionTicket,
Event::NUM_EVENTS
} |
|
enum | EarlySecrets { EarlySecrets::ExternalPskBinder,
EarlySecrets::ResumptionPskBinder,
EarlySecrets::ClientEarlyTraffic,
EarlySecrets::EarlyExporter
} |
|
enum | HandshakeSecrets { HandshakeSecrets::ClientHandshakeTraffic,
HandshakeSecrets::ServerHandshakeTraffic
} |
|
enum | MasterSecrets { MasterSecrets::ExporterMaster,
MasterSecrets::ResumptionMaster
} |
|
enum | AppTrafficSecrets { AppTrafficSecrets::ClientAppTraffic,
AppTrafficSecrets::ServerAppTraffic
} |
|
enum | HashFunction { HashFunction::Sha256,
HashFunction::Sha384
} |
|
enum | PskType {
PskType::NotSupported,
PskType::NotAttempted,
PskType::Rejected,
PskType::External,
PskType::Resumption
} |
|
enum | EncryptionLevel { EncryptionLevel::Plaintext,
EncryptionLevel::Handshake,
EncryptionLevel::EarlyData,
EncryptionLevel::AppTraffic
} |
|
enum | KeyExchangeType { KeyExchangeType::None,
KeyExchangeType::OneRtt,
KeyExchangeType::HelloRetryRequest
} |
|
enum | EarlyDataType { EarlyDataType::NotAttempted,
EarlyDataType::Attempted,
EarlyDataType::Rejected,
EarlyDataType::Accepted
} |
|
enum | ServerNameType : uint8_t { ServerNameType::host_name = 0
} |
|
enum | ProtocolVersion : uint16_t {
ProtocolVersion::tls_1_0 = 0x0301,
ProtocolVersion::tls_1_1 = 0x0302,
ProtocolVersion::tls_1_2 = 0x0303,
ProtocolVersion::tls_1_3 = 0x0304,
ProtocolVersion::tls_1_3_20 = 0x7f14,
ProtocolVersion::tls_1_3_20_fb = 0xfb14,
ProtocolVersion::tls_1_3_21 = 0x7f15,
ProtocolVersion::tls_1_3_21_fb = 0xfb15,
ProtocolVersion::tls_1_3_22 = 0x7f16,
ProtocolVersion::tls_1_3_22_fb = 0xfb16,
ProtocolVersion::tls_1_3_23 = 0x7f17,
ProtocolVersion::tls_1_3_23_fb = 0xfb17,
ProtocolVersion::tls_1_3_26 = 0x7f1a,
ProtocolVersion::tls_1_3_26_fb = 0xfb1a,
ProtocolVersion::tls_1_3_28 = 0x7f1c
} |
|
enum | ContentType : uint8_t { ContentType::alert = 21,
ContentType::handshake = 22,
ContentType::application_data = 23,
ContentType::change_cipher_spec = 20
} |
|
enum | HandshakeType : uint8_t {
HandshakeType::client_hello = 1,
HandshakeType::server_hello = 2,
HandshakeType::new_session_ticket = 4,
HandshakeType::end_of_early_data = 5,
HandshakeType::hello_retry_request = 6,
HandshakeType::encrypted_extensions = 8,
HandshakeType::certificate = 11,
HandshakeType::certificate_request = 13,
HandshakeType::certificate_verify = 15,
HandshakeType::finished = 20,
HandshakeType::key_update = 24,
HandshakeType::compressed_certificate = 240,
HandshakeType::message_hash = 254
} |
|
enum | ExtensionType : uint16_t {
ExtensionType::server_name = 0,
ExtensionType::supported_groups = 10,
ExtensionType::signature_algorithms = 13,
ExtensionType::application_layer_protocol_negotiation = 16,
ExtensionType::token_binding = 24,
ExtensionType::quic_transport_parameters = 26,
ExtensionType::key_share_old = 40,
ExtensionType::pre_shared_key = 41,
ExtensionType::early_data = 42,
ExtensionType::supported_versions = 43,
ExtensionType::cookie = 44,
ExtensionType::psk_key_exchange_modes = 45,
ExtensionType::certificate_authorities = 47,
ExtensionType::post_handshake_auth = 49,
ExtensionType::signature_algorithms_cert = 50,
ExtensionType::key_share = 51,
ExtensionType::compress_certificate = 0xff02
} |
|
enum | AlertDescription : uint8_t {
AlertDescription::close_notify = 0,
AlertDescription::end_of_early_data = 1,
AlertDescription::unexpected_message = 10,
AlertDescription::bad_record_mac = 20,
AlertDescription::record_overflow = 22,
AlertDescription::handshake_failure = 40,
AlertDescription::bad_certificate = 42,
AlertDescription::unsupported_certificate = 43,
AlertDescription::certificate_revoked = 44,
AlertDescription::certificate_expired = 45,
AlertDescription::certificate_unknown = 46,
AlertDescription::illegal_parameter = 47,
AlertDescription::unknown_ca = 48,
AlertDescription::access_denied = 49,
AlertDescription::decode_error = 50,
AlertDescription::decrypt_error = 51,
AlertDescription::protocol_version = 70,
AlertDescription::insufficient_security = 71,
AlertDescription::internal_error = 80,
AlertDescription::inappropriate_fallback = 86,
AlertDescription::user_canceled = 90,
AlertDescription::missing_extension = 109,
AlertDescription::unsupported_extension = 110,
AlertDescription::certificate_unobtainable = 111,
AlertDescription::unrecognized_name = 112,
AlertDescription::bad_certificate_status_response = 113,
AlertDescription::bad_certificate_hash_value = 114,
AlertDescription::unknown_psk_identity = 115,
AlertDescription::certificate_required = 116
} |
|
enum | CipherSuite : uint16_t { CipherSuite::TLS_AES_128_GCM_SHA256 = 0x1301,
CipherSuite::TLS_AES_256_GCM_SHA384 = 0x1302,
CipherSuite::TLS_CHACHA20_POLY1305_SHA256 = 0x1303,
CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL = 0xFF01
} |
|
enum | PskKeyExchangeMode : uint8_t { PskKeyExchangeMode::psk_ke = 0,
PskKeyExchangeMode::psk_dhe_ke = 1
} |
|
enum | CertificateCompressionAlgorithm : uint16_t { CertificateCompressionAlgorithm::zlib = 1
} |
|
enum | SignatureScheme : uint16_t {
SignatureScheme::ecdsa_secp256r1_sha256 = 0x0403,
SignatureScheme::ecdsa_secp384r1_sha384 = 0x0503,
SignatureScheme::ecdsa_secp521r1_sha512 = 0x0603,
SignatureScheme::rsa_pss_sha256 = 0x0804,
SignatureScheme::rsa_pss_sha384 = 0x0805,
SignatureScheme::rsa_pss_sha512 = 0x0806,
SignatureScheme::ed25519 = 0x0807,
SignatureScheme::ed448 = 0x0808
} |
|
enum | KeyUpdateRequest : uint8_t { KeyUpdateRequest::update_not_requested = 0,
KeyUpdateRequest::update_requested = 1
} |
|
enum | NamedGroup : uint16_t { NamedGroup::secp256r1 = 23,
NamedGroup::secp384r1 = 24,
NamedGroup::secp521r1 = 25,
NamedGroup::x25519 = 29
} |
|
|
folly::StringPiece | toString (StateEnum state) |
|
folly::StringPiece | toString (ClientAuthType auth) |
|
folly::StringPiece | toString (client::StateEnum) |
|
folly::StringPiece | toString (client::ClientAuthType) |
|
void | trimBytes (IOBuf &buf, folly::MutableByteRange trimmed) |
|
void | XOR (ByteRange first, MutableByteRange second) |
|
template<typename Func > |
void | transformBuffer (const folly::IOBuf &in, folly::IOBuf &out, Func func) |
|
template<size_t BlockSize, typename Func > |
folly::io::RWPrivateCursor | transformBufferBlocks (const folly::IOBuf &in, folly::IOBuf &out, Func func) |
|
template<> |
folly::Optional< TokenBindingParameters > | getExtension (const std::vector< Extension > &extensions) |
|
template<> |
Extension | encodeExtension (const TokenBindingParameters ¶ms) |
|
template<> |
Buf | encode (TokenBindingMessage &&message) |
|
template<> |
TokenBindingMessage | decode (folly::io::Cursor &cursor) |
|
template<> |
folly::Optional< extensions::TokenBindingParameters > | getExtension (const std::vector< Extension > &extensions) |
|
template<> |
extensions::TokenBindingMessage | decode (folly::io::Cursor &cursor) |
|
template<> |
std::vector< SignatureScheme > | CertUtils::getSigSchemes< KeyType::P256 > () |
|
template<> |
std::vector< SignatureScheme > | CertUtils::getSigSchemes< KeyType::P384 > () |
|
template<> |
std::vector< SignatureScheme > | CertUtils::getSigSchemes< KeyType::P521 > () |
|
template<> |
std::vector< SignatureScheme > | CertUtils::getSigSchemes< KeyType::RSA > () |
|
folly::StringPiece | toString (Event event) |
|
HashFunction | getHashFunction (CipherSuite cipher) |
|
size_t | getHashSize (HashFunction hash) |
|
folly::StringPiece | toString (HashFunction hash) |
|
folly::StringPiece | toString (PskType pskType) |
|
folly::StringPiece | toString (KeyExchangeType kexType) |
|
folly::StringPiece | toString (EarlyDataType earlyDataType) |
|
std::vector< Extension >::const_iterator | findExtension (const std::vector< Extension > &extensions, ExtensionType type) |
|
template<class T > |
folly::Optional< T > | getExtension (const std::vector< Extension > &extensions) |
|
template<> |
SignatureAlgorithms | getExtension (folly::io::Cursor &cs) |
|
template<> |
SupportedGroups | getExtension (folly::io::Cursor &cs) |
|
template<> |
folly::Optional< ClientKeyShare > | getExtension (const std::vector< Extension > &extensions) |
|
template<> |
ServerKeyShare | getExtension (folly::io::Cursor &cs) |
|
template<> |
HelloRetryRequestKeyShare | getExtension (folly::io::Cursor &cs) |
|
template<> |
ClientPresharedKey | getExtension (folly::io::Cursor &cs) |
|
template<> |
ServerPresharedKey | getExtension (folly::io::Cursor &cs) |
|
template<> |
ClientEarlyData | getExtension (folly::io::Cursor &) |
|
template<> |
ServerEarlyData | getExtension (folly::io::Cursor &) |
|
template<> |
TicketEarlyData | getExtension (folly::io::Cursor &cs) |
|
template<> |
Cookie | getExtension (folly::io::Cursor &cs) |
|
template<> |
SupportedVersions | getExtension (folly::io::Cursor &cs) |
|
template<> |
ServerSupportedVersions | getExtension (folly::io::Cursor &cs) |
|
template<> |
PskKeyExchangeModes | getExtension (folly::io::Cursor &cs) |
|
template<> |
ProtocolNameList | getExtension (folly::io::Cursor &cs) |
|
template<> |
ServerNameList | getExtension (folly::io::Cursor &cs) |
|
template<> |
CertificateAuthorities | getExtension (folly::io::Cursor &cs) |
|
template<> |
CertificateCompressionAlgorithms | getExtension (folly::io::Cursor &cs) |
|
template<> |
Extension | encodeExtension (const SignatureAlgorithms &sig) |
|
template<> |
Extension | encodeExtension (const SupportedGroups &groups) |
|
template<> |
Extension | encodeExtension (const ClientKeyShare &share) |
|
template<> |
Extension | encodeExtension (const ServerKeyShare &share) |
|
template<> |
Extension | encodeExtension (const HelloRetryRequestKeyShare &share) |
|
template<> |
Extension | encodeExtension (const ClientPresharedKey &share) |
|
template<> |
Extension | encodeExtension (const ServerPresharedKey &share) |
|
template<> |
Extension | encodeExtension (const ClientEarlyData &) |
|
template<> |
Extension | encodeExtension (const ServerEarlyData &) |
|
template<> |
Extension | encodeExtension (const TicketEarlyData &early) |
|
template<> |
Extension | encodeExtension (const Cookie &cookie) |
|
template<> |
Extension | encodeExtension (const SupportedVersions &versions) |
|
template<> |
Extension | encodeExtension (const ServerSupportedVersions &versions) |
|
template<> |
Extension | encodeExtension (const PskKeyExchangeModes &modes) |
|
template<> |
Extension | encodeExtension (const ProtocolNameList &names) |
|
template<> |
Extension | encodeExtension (const ServerNameList &names) |
|
template<> |
Extension | encodeExtension (const CertificateAuthorities &authorities) |
|
template<> |
Extension | encodeExtension (const CertificateCompressionAlgorithms &cca) |
|
size_t | getBinderLength (const ClientHello &chlo) |
|
template<class T > |
T | getExtension (folly::io::Cursor &cursor) |
|
template<class T > |
Extension | encodeExtension (const T &t) |
|
template<typename T > |
static Param | parse (Buf handshakeMsg, Buf original) |
|
template<> |
Param | parse< ServerHello > (Buf handshakeMsg, Buf original) |
|
template<typename T > |
void | setWriteDefaults (T *obj) |
|
template<> |
Buf | encode< ServerHello > (ServerHello &&shlo) |
|
template<> |
Buf | encode< HelloRetryRequest > (HelloRetryRequest &&shlo) |
|
template<> |
Buf | encode< EndOfEarlyData > (EndOfEarlyData &&) |
|
template<> |
Buf | encode< EncryptedExtensions > (EncryptedExtensions &&extensions) |
|
template<> |
Buf | encode< CertificateRequest > (CertificateRequest &&cr) |
|
template<> |
Buf | encode< const CertificateMsg & > (const CertificateMsg &cert) |
|
template<> |
Buf | encode< CertificateMsg & > (CertificateMsg &cert) |
|
template<> |
Buf | encode< CertificateMsg > (CertificateMsg &&cert) |
|
template<> |
Buf | encode< CompressedCertificate & > (CompressedCertificate &cc) |
|
template<> |
Buf | encode< CompressedCertificate > (CompressedCertificate &&cc) |
|
template<> |
Buf | encode< CertificateVerify > (CertificateVerify &&certVerify) |
|
template<> |
Buf | encode< Alert > (Alert &&alert) |
|
template<> |
Buf | encode< const ClientHello & > (const ClientHello &chlo) |
|
template<> |
Buf | encode< ClientHello & > (ClientHello &chlo) |
|
template<> |
Buf | encode< ClientHello > (ClientHello &&chlo) |
|
template<> |
Buf | encode< Finished > (Finished &&fin) |
|
template<> |
Buf | encode< NewSessionTicket > (NewSessionTicket &&nst) |
|
Buf | encodeHkdfLabel (HkdfLabel &&label, const std::string &hkdfLabelPrefix) |
|
template<> |
Buf | encode< KeyUpdate > (KeyUpdate &&keyUpdate) |
|
template<> |
Buf | encode< message_hash > (message_hash &&hash) |
|
template<class T > |
Buf | encodeHandshake (T &&handshakeMsg) |
|
template<> |
ClientHello | decode (folly::io::Cursor &cursor) |
|
template<> |
ServerHello | decode (folly::io::Cursor &cursor) |
|
template<> |
EndOfEarlyData | decode (folly::io::Cursor &) |
|
template<> |
EncryptedExtensions | decode (folly::io::Cursor &cursor) |
|
template<> |
CertificateRequest | decode (folly::io::Cursor &cursor) |
|
template<> |
CertificateMsg | decode (folly::io::Cursor &cursor) |
|
template<> |
CompressedCertificate | decode (folly::io::Cursor &cursor) |
|
template<> |
CertificateVerify | decode (folly::io::Cursor &cursor) |
|
template<> |
NewSessionTicket | decode< NewSessionTicket > (folly::io::Cursor &cursor) |
|
template<> |
Alert | decode (folly::io::Cursor &cursor) |
|
template<> |
Finished | decode< Finished > (std::unique_ptr< folly::IOBuf > &&buf) |
|
template<> |
KeyUpdate | decode< KeyUpdate > (folly::io::Cursor &cursor) |
|
template<class T > |
T | decode (std::unique_ptr< folly::IOBuf > &&buf) |
|
template<typename T > |
std::string | enumToHex (T enumValue) |
|
ProtocolVersion | getRealDraftVersion (ProtocolVersion version) |
|
std::string | toString (ProtocolVersion version) |
|
std::string | toString (ExtensionType extType) |
|
std::string | toString (AlertDescription alertDesc) |
|
std::string | toString (CipherSuite cipher) |
|
std::string | toString (PskKeyExchangeMode pskKeMode) |
|
std::string | toString (SignatureScheme sigScheme) |
|
std::string | toString (NamedGroup group) |
|
std::string | toString (CertificateCompressionAlgorithm algo) |
|
template<class T > |
Buf | encode (T &&t) |
|
template<class T > |
T | decode (folly::io::Cursor &cursor) |
|
folly::StringPiece | toString (ReplayCacheResult result) |
|
folly::StringPiece | toString (server::ReplayCacheResult) |
|
folly::StringPiece | toString (server::StateEnum state) |
|
std::string | toString (fizz::server::CertificateStorage storage) |
|
static int | passwordCallback (char *password, int size, int, void *data) |
|
template<> |
CipherSuite | parse (folly::StringPiece s) |
|
template<> |
NamedGroup | parse (folly::StringPiece s) |
|
template<class T > |
T | parse (folly::StringPiece s) |
|
Definition at line 16 of file Types.cpp.
References tls_1_3, tls_1_3_20, tls_1_3_20_fb, tls_1_3_21, tls_1_3_21_fb, tls_1_3_22, tls_1_3_22_fb, tls_1_3_23, tls_1_3_23_fb, tls_1_3_26, tls_1_3_26_fb, tls_1_3_28, and toString().
Referenced by fizz::sm::generateTicket(), fizz::sm::getCertificateRequest(), fizz::sm::getHelloRetryRequest(), fizz::sm::getServerHello(), fizz::sm::negotiateGroup(), fizz::EncryptedReadRecordLayer::setProtocolVersion(), and fizz::WriteRecordLayer::setProtocolVersion().
18 case ProtocolVersion::tls_1_3:
19 return ProtocolVersion::tls_1_3;
20 case ProtocolVersion::tls_1_3_20:
21 case ProtocolVersion::tls_1_3_20_fb:
22 return ProtocolVersion::tls_1_3_20;
23 case ProtocolVersion::tls_1_3_21:
24 case ProtocolVersion::tls_1_3_21_fb:
25 return ProtocolVersion::tls_1_3_21;
26 case ProtocolVersion::tls_1_3_22:
27 case ProtocolVersion::tls_1_3_22_fb:
28 return ProtocolVersion::tls_1_3_22;
29 case ProtocolVersion::tls_1_3_23:
30 case ProtocolVersion::tls_1_3_23_fb:
31 return ProtocolVersion::tls_1_3_23;
32 case ProtocolVersion::tls_1_3_26:
33 case ProtocolVersion::tls_1_3_26_fb:
34 return ProtocolVersion::tls_1_3_26;
35 case ProtocolVersion::tls_1_3_28:
36 return ProtocolVersion::tls_1_3_28;
38 throw std::runtime_error(folly::to<std::string>(
std::string toString(CertificateCompressionAlgorithm algo)
Definition at line 12 of file Events.cpp.
References Accept, Alert, AppClose, AppData, AppWrite, Certificate, CertificateRequest, CertificateVerify, ClientHello, CompressedCertificate, Connect, EarlyAppWrite, EncryptedExtensions, EndOfEarlyData, Finished, HelloRetryRequest, KeyUpdate, NewSessionTicket, NUM_EVENTS, ServerHello, and WriteNewSessionTicket.
14 case Event::ClientHello:
16 case Event::ServerHello:
18 case Event::EndOfEarlyData:
19 return "EndOfEarlyData";
20 case Event::HelloRetryRequest:
21 return "HelloRetryRequest";
22 case Event::EncryptedExtensions:
23 return "EncryptedExtensions";
24 case Event::CertificateRequest:
25 return "CertificateRequest";
26 case Event::Certificate:
28 case Event::CompressedCertificate:
29 return "CompressedCertificate";
30 case Event::CertificateVerify:
31 return "CertificateVerify";
34 case Event::NewSessionTicket:
35 return "NewSessionTicket";
36 case Event::KeyUpdate:
46 case Event::EarlyAppWrite:
47 return "EarlyAppWrite";
52 case Event::WriteNewSessionTicket:
53 return "WriteNewSessionTicket";
54 case Event::NUM_EVENTS:
55 return "Invalid event NUM_EVENTS";
57 return "Unknown event";
Definition at line 79 of file Types.cpp.
References application_layer_protocol_negotiation, certificate_authorities, compress_certificate, cookie, early_data, enumToHex(), key_share, key_share_old, post_handshake_auth, pre_shared_key, psk_key_exchange_modes, quic_transport_parameters, server_name, signature_algorithms, signature_algorithms_cert, supported_groups, supported_versions, and token_binding.
81 case ExtensionType::server_name:
83 case ExtensionType::supported_groups:
84 return "supported_groups";
85 case ExtensionType::signature_algorithms:
86 return "signature_algorithms";
87 case ExtensionType::application_layer_protocol_negotiation:
88 return "application_layer_protocol_negotiation";
89 case ExtensionType::token_binding:
90 return "token_binding";
91 case ExtensionType::quic_transport_parameters:
92 return "quic_transport_parameters";
93 case ExtensionType::key_share_old:
94 return "key_share_old";
95 case ExtensionType::pre_shared_key:
96 return "pre_shared_key";
97 case ExtensionType::early_data:
99 case ExtensionType::supported_versions:
100 return "supported_version";
103 case ExtensionType::psk_key_exchange_modes:
104 return "psk_key_exchange_modes";
105 case ExtensionType::certificate_authorities:
106 return "certificate_authorities";
107 case ExtensionType::post_handshake_auth:
108 return "post_handshake_auth";
109 case ExtensionType::signature_algorithms_cert:
110 return "signature_algorithms_cert";
111 case ExtensionType::key_share:
113 case ExtensionType::compress_certificate:
114 return "compress_certificate";
std::string enumToHex(T enumValue)
Definition at line 119 of file Types.cpp.
References access_denied, bad_certificate, bad_certificate_hash_value, bad_certificate_status_response, bad_record_mac, certificate_expired, certificate_required, certificate_revoked, certificate_unknown, certificate_unobtainable, close_notify, decode_error, decrypt_error, end_of_early_data, enumToHex(), handshake_failure, illegal_parameter, inappropriate_fallback, insufficient_security, internal_error, missing_extension, protocol_version, record_overflow, unexpected_message, unknown_ca, unknown_psk_identity, unrecognized_name, unsupported_certificate, unsupported_extension, and user_canceled.
121 case AlertDescription::close_notify:
122 return "close_notify";
123 case AlertDescription::end_of_early_data:
124 return "end_of_early_data";
125 case AlertDescription::unexpected_message:
126 return "unexpected_message";
127 case AlertDescription::bad_record_mac:
128 return "bad_record_mac";
129 case AlertDescription::record_overflow:
130 return "record_overflow";
131 case AlertDescription::handshake_failure:
132 return "handshake_failure";
133 case AlertDescription::bad_certificate:
134 return "bad_certificate";
135 case AlertDescription::unsupported_certificate:
136 return "unsupported_certificate";
137 case AlertDescription::certificate_revoked:
138 return "certificate_revoked";
139 case AlertDescription::certificate_expired:
140 return "certificate_expired";
141 case AlertDescription::certificate_unknown:
142 return "certificate_unknown";
143 case AlertDescription::illegal_parameter:
144 return "illegal_parameter";
145 case AlertDescription::unknown_ca:
147 case AlertDescription::access_denied:
148 return "access_denied";
149 case AlertDescription::decode_error:
150 return "decode_error";
151 case AlertDescription::decrypt_error:
152 return "decrypt_error";
153 case AlertDescription::protocol_version:
154 return "protocol_version";
155 case AlertDescription::insufficient_security:
156 return "insufficient_security";
157 case AlertDescription::internal_error:
158 return "internal_error";
159 case AlertDescription::inappropriate_fallback:
160 return "inappropriate_fallback";
161 case AlertDescription::user_canceled:
162 return "user_canceled";
163 case AlertDescription::missing_extension:
164 return "missing_extension";
165 case AlertDescription::unsupported_extension:
166 return "unsupported_extension";
167 case AlertDescription::certificate_unobtainable:
168 return "certificate_unobtainable";
169 case AlertDescription::unrecognized_name:
170 return "unrecognized_name";
171 case AlertDescription::bad_certificate_status_response:
172 return "bad_certificate_status_response";
173 case AlertDescription::bad_certificate_hash_value:
174 return "bad_certificate_hash_value";
175 case AlertDescription::unknown_psk_identity:
176 return "unknown_psk_identity";
177 case AlertDescription::certificate_required:
178 return "certificate_required";
std::string enumToHex(T enumValue)
template<size_t BlockSize, typename Func >
Useful when we need to run a function that performs operations in chunks and transforms data from in -> out, regardless of whether in or out is chained. We assume out size >= in size.
func is expected to take data from some input buffer, do some operation on it and then place the result of the operation into an output buffer. It only should write to output in blocks of size BlockSize. Data from the input buffer must be internally buffered by func if it can not write a full block to output.
Definition at line 75 of file IOBufUtil.h.
References folly::io::detail::CursorBase< Derived, BufType >::isAtEnd(), min, gmock_output_test::output, folly::io::detail::CursorBase< Derived, BufType >::peekBytes(), folly::io::detail::Writable< Derived >::push(), folly::Range< Iter >::size(), folly::io::detail::CursorBase< Derived, BufType >::skip(), and folly::io::RWCursor< access >::writableData().
76 size_t internallyBuffered = 0;
81 std::array<uint8_t, BlockSize> blockBuffer = {};
84 while (!input.isAtEnd()) {
85 auto inputRange = input.peekBytes();
86 auto inputLen = inputRange.size();
87 auto outputLen =
output.peekBytes().size();
88 if (inputLen + internallyBuffered < BlockSize) {
93 auto numWritten = func(blockBuffer.data(), inputRange.data(), inputLen);
94 DCHECK_EQ(numWritten, 0) <<
"expected buffering. wrote " << numWritten;
96 internallyBuffered += inputLen;
98 }
else if (outputLen < BlockSize) {
102 auto numWritten = func(
106 BlockSize - internallyBuffered);
107 DCHECK_EQ(numWritten, BlockSize)
108 <<
"did not write full block bs=" << BlockSize
109 <<
" wrote=" << numWritten;
112 output.push(blockBuffer.data(), BlockSize);
115 input.skip(BlockSize - internallyBuffered);
116 internallyBuffered = 0;
120 auto numSharedBytes =
std::min(outputLen, inputLen + internallyBuffered);
123 auto numBlockBytes = numSharedBytes - (numSharedBytes % BlockSize);
126 auto maxToTake = (numBlockBytes - internallyBuffered) + (BlockSize - 1);
127 auto numToTake =
std::min(inputLen, maxToTake);
129 func(
output.writableData(), inputRange.data(), numToTake);
131 DCHECK_EQ(numWritten, numBlockBytes);
134 input.skip(numToTake);
137 internallyBuffered = (internallyBuffered + numToTake) % BlockSize;