aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_heartbeats.h
blob: 4fa49501b5d3dfe6aaf468242826927c24f12af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* TLS Heartbeats
* (C) 2012 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#ifndef BOTAN_TLS_HEARTBEATS_H__
#define BOTAN_TLS_HEARTBEATS_H__

#include <botan/secmem.h>

namespace Botan {

namespace TLS {

class Heartbeat_Message
   {
   public:
      enum Type { REQUEST = 1, RESPONSE = 2 };

      MemoryVector<byte> contents() const;

      const MemoryRegion<byte>& payload() const { return m_payload; }

      bool is_request() const { return m_type == REQUEST; }

      Heartbeat_Message(const MemoryRegion<byte>& buf);

      Heartbeat_Message(Type type, const byte payload[], size_t payload_len);
   private:
      Type m_type;
      MemoryVector<byte> m_payload;
   };

}

}

#endif