|
Botan
1.11.15
|
#include <tls_extensions.h>
Public Member Functions | |
| bool | empty () const |
| size_t | fragment_size () const |
| Maximum_Fragment_Length (size_t max_fragment) | |
| Maximum_Fragment_Length (TLS_Data_Reader &reader, u16bit extension_size) | |
| std::vector< byte > | serialize () const |
| Handshake_Extension_Type | type () const |
Static Public Member Functions | |
| static Handshake_Extension_Type | static_type () |
Maximum Fragment Length Negotiation Extension (RFC 4366 sec 3.2)
Definition at line 154 of file tls_extensions.h.
| Botan::TLS::Maximum_Fragment_Length::Maximum_Fragment_Length | ( | size_t | max_fragment | ) | [inline] |
| max_fragment | specifies what maximum fragment size to advertise. Currently must be one of 512, 1024, 2048, or 4096. |
Definition at line 173 of file tls_extensions.h.
:
m_max_fragment(max_fragment) {}
| Botan::TLS::Maximum_Fragment_Length::Maximum_Fragment_Length | ( | TLS_Data_Reader & | reader, |
| u16bit | extension_size | ||
| ) |
Definition at line 237 of file tls_extensions.cpp.
References Botan::TLS::TLS_Data_Reader::get_byte(), and Botan::ASN1::to_string().
{
if(extension_size != 1)
throw Decoding_Error("Bad size for maximum fragment extension");
const byte val = reader.get_byte();
switch(val)
{
case 1:
m_max_fragment = 512;
case 2:
m_max_fragment = 1024;
case 3:
m_max_fragment = 2048;
case 4:
m_max_fragment = 4096;
default:
throw TLS_Exception(Alert::ILLEGAL_PARAMETER,
"Bad value " + std::to_string(val) + " for max fragment len");
}
}
| bool Botan::TLS::Maximum_Fragment_Length::empty | ( | ) | const [inline, virtual] |
Implements Botan::TLS::Extension.
Definition at line 162 of file tls_extensions.h.
{ return false; }
| size_t Botan::TLS::Maximum_Fragment_Length::fragment_size | ( | ) | const [inline] |
Definition at line 164 of file tls_extensions.h.
{ return m_max_fragment; }
| std::vector< byte > Botan::TLS::Maximum_Fragment_Length::serialize | ( | ) | const [virtual] |
Implements Botan::TLS::Extension.
Definition at line 218 of file tls_extensions.cpp.
References Botan::ASN1::to_string().
{
switch(m_max_fragment)
{
case 512:
return std::vector<byte>(1, 1);
case 1024:
return std::vector<byte>(1, 2);
case 2048:
return std::vector<byte>(1, 3);
case 4096:
return std::vector<byte>(1, 4);
default:
throw std::invalid_argument("Bad setting " +
std::to_string(m_max_fragment) +
" for maximum fragment size");
}
}
| static Handshake_Extension_Type Botan::TLS::Maximum_Fragment_Length::static_type | ( | ) | [inline, static] |
Definition at line 157 of file tls_extensions.h.
References Botan::TLS::TLSEXT_MAX_FRAGMENT_LENGTH.
Referenced by type().
{ return TLSEXT_MAX_FRAGMENT_LENGTH; }
| Handshake_Extension_Type Botan::TLS::Maximum_Fragment_Length::type | ( | ) | const [inline, virtual] |
Implements Botan::TLS::Extension.
Definition at line 160 of file tls_extensions.h.
References static_type().
{ return static_type(); }
1.7.6.1