summaryrefslogtreecommitdiff
path: root/cpputil
diff options
context:
space:
mode:
authorMartin Thomson <martin.thomson@gmail.com>2019-02-17 13:07:04 -0800
committerMartin Thomson <martin.thomson@gmail.com>2019-02-17 13:07:04 -0800
commitcc253da3e8d632ea0f8268516788de77b7a60d9b (patch)
treef42fef6ffd550c4f9945a873d80346778dd83a89 /cpputil
parent9ea3d8f3aa6a1f9b0c76dd1304146b0a0dafdc26 (diff)
downloadnss-hg-cc253da3e8d632ea0f8268516788de77b7a60d9b.tar.gz
Bug 1471126 - Record layer separation, r=ekr
Summary: Add functions for QUIC that provide the raw content of records to callback functions. Reviewers: ekr Reviewed By: ekr Bug #: 1471126 Differential Revision: https://phabricator.services.mozilla.com/D1874
Diffstat (limited to 'cpputil')
-rw-r--r--cpputil/tls_parser.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/cpputil/tls_parser.h b/cpputil/tls_parser.h
index cd9e28fc3..881c5268e 100644
--- a/cpputil/tls_parser.h
+++ b/cpputil/tls_parser.h
@@ -80,6 +80,32 @@ inline std::ostream& operator<<(std::ostream& os, SSLProtocolVariant v) {
return os << ((v == ssl_variant_stream) ? "TLS" : "DTLS");
}
+inline std::ostream& operator<<(std::ostream& os, SSLContentType v) {
+ switch (v) {
+ case ssl_ct_change_cipher_spec:
+ return os << "CCS";
+ case ssl_ct_alert:
+ return os << "alert";
+ case ssl_ct_handshake:
+ return os << "handshake";
+ case ssl_ct_application_data:
+ return os << "application data";
+ case ssl_ct_ack:
+ return os << "ack";
+ }
+ return os << "UNKNOWN content type " << static_cast<int>(v);
+}
+
+inline std::ostream& operator<<(std::ostream& os, SSLSecretDirection v) {
+ switch (v) {
+ case ssl_secret_read:
+ return os << "read";
+ case ssl_secret_write:
+ return os << "write";
+ }
+ return os << "UNKNOWN secret direction " << static_cast<int>(v);
+}
+
inline bool IsDtls(uint16_t version) { return (version & 0x8000) == 0x8000; }
inline uint16_t NormalizeTlsVersion(uint16_t version) {