Botan
1.11.15
|
00001 /* 00002 * TLS Heartbeats 00003 * (C) 2012,2015 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_TLS_HEARTBEATS_H__ 00009 #define BOTAN_TLS_HEARTBEATS_H__ 00010 00011 #include <botan/secmem.h> 00012 00013 namespace Botan { 00014 00015 namespace TLS { 00016 00017 /** 00018 * TLS Heartbeat message 00019 */ 00020 class Heartbeat_Message 00021 { 00022 public: 00023 enum Type { REQUEST = 1, RESPONSE = 2 }; 00024 00025 std::vector<byte> contents() const; 00026 00027 const std::vector<byte>& payload() const { return m_payload; } 00028 00029 bool is_request() const { return m_type == REQUEST; } 00030 00031 Heartbeat_Message(const std::vector<byte>& buf); 00032 00033 Heartbeat_Message(Type type, const byte payload[], size_t payload_len, 00034 const std::vector<byte>& padding); 00035 private: 00036 Type m_type; 00037 std::vector<byte> m_payload, m_padding; 00038 }; 00039 00040 } 00041 00042 } 00043 00044 #endif