Botan 1.10.17
Botan::Alert Class Reference

#include <tls_alerts.h>

Public Member Functions

 Alert (const MemoryRegion< byte > &buf)
bool is_fatal () const
Alert_Type type () const

Detailed Description

SSL/TLS Alert Message

Definition at line 18 of file tls_alerts.h.

Constructor & Destructor Documentation

◆ Alert()

Botan::Alert::Alert ( const MemoryRegion< byte > & buf)
inline

Deserialize an Alert message

Parameters
bufthe serialized alert

Definition at line 35 of file tls_alerts.h.

36 {
37 if(buf.size() != 2)
38 throw Decoding_Error("Alert: Bad size for alert message");
39
40 if(buf[0] == 1) fatal = false;
41 else if(buf[0] == 2) fatal = true;
42 else
43 throw Decoding_Error("Alert: Bad type code for alert level");
44
45 type_code = static_cast<Alert_Type>(buf[1]);
46 }
Alert_Type
Definition tls_magic.h:62
Decoding_Error(const std::string &name)
Definition exceptn.h:140

References Botan::Decoding_Error::Decoding_Error(), and Botan::MemoryRegion< T >::size().

Member Function Documentation

◆ is_fatal()

bool Botan::Alert::is_fatal ( ) const
inline
Returns
if this alert is a fatal one or not

Definition at line 24 of file tls_alerts.h.

24{ return fatal; }

◆ type()

Alert_Type Botan::Alert::type ( ) const
inline
Returns
type of alert

Definition at line 29 of file tls_alerts.h.

29{ return type_code; }

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