From cc253da3e8d632ea0f8268516788de77b7a60d9b Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Sun, 17 Feb 2019 13:07:04 -0800 Subject: 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 --- cpputil/tls_parser.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cpputil') 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(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(v); +} + inline bool IsDtls(uint16_t version) { return (version & 0x8000) == 0x8000; } inline uint16_t NormalizeTlsVersion(uint16_t version) { -- cgit v1.2.1