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

#include <tls_extensions.h>

Inheritance diagram for Botan::TLS::Heartbeat_Support_Indicator:
Botan::TLS::Extension

List of all members.

Public Member Functions

bool empty () const
 Heartbeat_Support_Indicator (bool peer_allowed_to_send)
 Heartbeat_Support_Indicator (TLS_Data_Reader &reader, u16bit extension_size)
bool peer_allowed_to_send () const
std::vector< byteserialize () const
Handshake_Extension_Type type () const

Static Public Member Functions

static Handshake_Extension_Type static_type ()

Detailed Description

Heartbeat Extension (RFC 6520)

Definition at line 333 of file tls_extensions.h.


Constructor & Destructor Documentation

Definition at line 347 of file tls_extensions.h.

                                                             :
         m_peer_allowed_to_send(peer_allowed_to_send) {}

Definition at line 73 of file tls_heartbeats.cpp.

References Botan::TLS::TLS_Data_Reader::get_byte(), Botan::TLS::Alert::ILLEGAL_PARAMETER, and Botan::ASN1::to_string().

   {
   if(extension_size != 1)
      throw Decoding_Error("Strange size for heartbeat extension");

   const byte code = reader.get_byte();

   if(code != 1 && code != 2)
      throw TLS_Exception(Alert::ILLEGAL_PARAMETER,
                          "Unknown heartbeat code " + std::to_string(code));

   m_peer_allowed_to_send = (code == 1);
   }

Member Function Documentation

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

Implements Botan::TLS::Extension.

Definition at line 345 of file tls_extensions.h.

{ return false; }

Definition at line 341 of file tls_extensions.h.

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

Implements Botan::TLS::Extension.

Definition at line 66 of file tls_heartbeats.cpp.

   {
   std::vector<byte> heartbeat(1);
   heartbeat[0] = (m_peer_allowed_to_send ? 1 : 2);
   return heartbeat;
   }

Definition at line 336 of file tls_extensions.h.

References Botan::TLS::TLSEXT_HEARTBEAT_SUPPORT.

Referenced by type().

Returns:
code number of the extension

Implements Botan::TLS::Extension.

Definition at line 339 of file tls_extensions.h.

References static_type().

{ return static_type(); }

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