Botan  1.11.15
Public Member Functions | Static Public Member Functions
Botan::TLS::Next_Protocol_Notification Class Reference

#include <tls_extensions.h>

Inheritance diagram for Botan::TLS::Next_Protocol_Notification:
Botan::TLS::Extension

List of all members.

Public Member Functions

bool empty () const
 Next_Protocol_Notification ()
 Next_Protocol_Notification (const std::vector< std::string > &protocols)
 Next_Protocol_Notification (TLS_Data_Reader &reader, u16bit extension_size)
const std::vector< std::string > & protocols () const
std::vector< byteserialize () const
Handshake_Extension_Type type () const

Static Public Member Functions

static Handshake_Extension_Type static_type ()

Detailed Description

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.

Definition at line 191 of file tls_extensions.h.


Constructor & Destructor Documentation

Empty extension, used by client

Definition at line 205 of file tls_extensions.h.

{}
Botan::TLS::Next_Protocol_Notification::Next_Protocol_Notification ( const std::vector< std::string > &  protocols) [inline]

List of protocols, used by server

Definition at line 210 of file tls_extensions.h.

                                                                        :
         m_protocols(protocols) {}

Definition at line 261 of file tls_extensions.cpp.

References Botan::TLS::TLS_Data_Reader::get_string().

   {
   if(extension_size == 0)
      return; // empty extension

   size_t bytes_remaining = extension_size;

   while(bytes_remaining)
      {
      const std::string p = reader.get_string(1, 0, 255);

      if(bytes_remaining < p.size() + 1)
         throw Decoding_Error("Bad encoding for next protocol extension");

      bytes_remaining -= (p.size() + 1);

      m_protocols.push_back(p);
      }
   }

Member Function Documentation

bool Botan::TLS::Next_Protocol_Notification::empty ( ) const [inline, virtual]
Returns:
if we should encode this extension or not

Implements Botan::TLS::Extension.

Definition at line 218 of file tls_extensions.h.

{ return false; }
const std::vector<std::string>& Botan::TLS::Next_Protocol_Notification::protocols ( ) const [inline]

Definition at line 199 of file tls_extensions.h.

         { return m_protocols; }
std::vector< byte > Botan::TLS::Next_Protocol_Notification::serialize ( ) const [virtual]
Returns:
serialized binary for the extension

Implements Botan::TLS::Extension.

Definition at line 282 of file tls_extensions.cpp.

References Botan::TLS::append_tls_length_value().

   {
   std::vector<byte> buf;

   for(size_t i = 0; i != m_protocols.size(); ++i)
      {
      const std::string p = m_protocols[i];

      if(p != "")
         append_tls_length_value(buf,
                                 reinterpret_cast<const byte*>(p.data()),
                                 p.size(),
                                 1);
      }

   return buf;
   }

Definition at line 194 of file tls_extensions.h.

References Botan::TLS::TLSEXT_NEXT_PROTOCOL.

Referenced by type().

         { return TLSEXT_NEXT_PROTOCOL; }
Returns:
code number of the extension

Implements Botan::TLS::Extension.

Definition at line 197 of file tls_extensions.h.

References static_type().

{ return static_type(); }

The documentation for this class was generated from the following files: