aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_extensions.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-03-20 04:32:15 +0000
committerlloyd <[email protected]>2015-03-20 04:32:15 +0000
commitb01ce65e09e50ec624bdbf62bf2c1433f0d6f637 (patch)
tree8aa46632eb381b44de64d106b62f8efad49c173d /src/lib/tls/tls_extensions.h
parent181e75b66d5fbffdce04d37014c260b4fab5dec8 (diff)
Add ALPN (RFC 7301) and remove NPN
Diffstat (limited to 'src/lib/tls/tls_extensions.h')
-rw-r--r--src/lib/tls/tls_extensions.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/lib/tls/tls_extensions.h b/src/lib/tls/tls_extensions.h
index 393cada12..83e819509 100644
--- a/src/lib/tls/tls_extensions.h
+++ b/src/lib/tls/tls_extensions.h
@@ -35,11 +35,10 @@ enum Handshake_Extension_Type {
TLSEXT_SIGNATURE_ALGORITHMS = 13,
TLSEXT_USE_SRTP = 14,
TLSEXT_HEARTBEAT_SUPPORT = 15,
+ TLSEXT_ALPN = 16,
TLSEXT_SESSION_TICKET = 35,
- TLSEXT_NEXT_PROTOCOL = 13172,
-
TLSEXT_SAFE_RENEGOTIATION = 65281,
};
@@ -181,41 +180,37 @@ class Maximum_Fragment_Length : public Extension
};
/**
-* Next Protocol Negotiation
-* http://technotes.googlecode.com/git/nextprotoneg.html
-*
-* This implementation requires the semantics defined in the Google
-* spec (implemented in Chromium); the internet draft leaves the format
-* unspecified.
+* ALPN (RFC 7301)
*/
-class Next_Protocol_Notification : public Extension
+class Application_Layer_Protocol_Notification : public Extension
{
public:
- static Handshake_Extension_Type static_type()
- { return TLSEXT_NEXT_PROTOCOL; }
+ static Handshake_Extension_Type static_type() { return TLSEXT_ALPN; }
Handshake_Extension_Type type() const { return static_type(); }
- const std::vector<std::string>& protocols() const
- { return m_protocols; }
+ const std::vector<std::string>& protocols() const { return m_protocols; }
+
+ const std::string& single_protocol() const;
/**
- * Empty extension, used by client
+ * Single protocol, used by server
*/
- Next_Protocol_Notification() {}
+ Application_Layer_Protocol_Notification(const std::string& protocol) :
+ m_protocols(1, protocol) {}
/**
- * List of protocols, used by server
+ * List of protocols, used by client
*/
- Next_Protocol_Notification(const std::vector<std::string>& protocols) :
+ Application_Layer_Protocol_Notification(const std::vector<std::string>& protocols) :
m_protocols(protocols) {}
- Next_Protocol_Notification(TLS_Data_Reader& reader,
- u16bit extension_size);
+ Application_Layer_Protocol_Notification(TLS_Data_Reader& reader,
+ u16bit extension_size);
std::vector<byte> serialize() const;
- bool empty() const { return false; }
+ bool empty() const { return m_protocols.empty(); }
private:
std::vector<std::string> m_protocols;
};