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

#include <tls_extensions.h>

Inheritance diagram for Botan::TLS::SRTP_Protection_Profiles:
Botan::TLS::Extension

List of all members.

Public Member Functions

bool empty () const
const std::vector< u16bit > & profiles () const
std::vector< byteserialize () const
 SRTP_Protection_Profiles (const std::vector< u16bit > &pp)
 SRTP_Protection_Profiles (u16bit pp)
 SRTP_Protection_Profiles (TLS_Data_Reader &reader, u16bit extension_size)
Handshake_Extension_Type type () const

Static Public Member Functions

static Handshake_Extension_Type static_type ()

Detailed Description

Used to indicate SRTP algorithms for DTLS (RFC 5764)

Definition at line 359 of file tls_extensions.h.


Constructor & Destructor Documentation

Definition at line 373 of file tls_extensions.h.

: m_pp(pp) {}

Definition at line 375 of file tls_extensions.h.

: m_pp(1, pp) {}

Definition at line 547 of file tls_extensions.cpp.

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

   {
   m_pp = reader.get_range<u16bit>(2, 0, 65535);

   const std::vector<byte> mki = reader.get_range<byte>(1, 0, 255);

   if(m_pp.size() * 2 + mki.size() + 3 != extension_size)
      throw Decoding_Error("Bad encoding for SRTP protection extension");

   if(!mki.empty())
      throw Decoding_Error("Unhandled non-empty MKI for SRTP protection extension");
   }

Member Function Documentation

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

Implements Botan::TLS::Extension.

Definition at line 371 of file tls_extensions.h.

{ return m_pp.empty(); }
const std::vector<u16bit>& Botan::TLS::SRTP_Protection_Profiles::profiles ( ) const [inline]

Definition at line 367 of file tls_extensions.h.

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

Implements Botan::TLS::Extension.

Definition at line 561 of file tls_extensions.cpp.

References Botan::get_byte().

   {
   std::vector<byte> buf;

   const u16bit pp_len = m_pp.size() * 2;
   buf.push_back(get_byte(0, pp_len));
   buf.push_back(get_byte(1, pp_len));

   for(u16bit pp : m_pp)
      {
      buf.push_back(get_byte(0, pp));
      buf.push_back(get_byte(1, pp));
      }

   buf.push_back(0); // srtp_mki, always empty here

   return buf;
   }

Definition at line 362 of file tls_extensions.h.

References Botan::TLS::TLSEXT_USE_SRTP.

Referenced by type().

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

Implements Botan::TLS::Extension.

Definition at line 365 of file tls_extensions.h.

References static_type().

{ return static_type(); }

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