aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_handshake_reader.h
blob: 618e1878a2c52dea2a340b305f42aa408e30cfd5 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* TLS Handshake Reader
* (C) 2012 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#ifndef BOTAN_TLS_HANDSHAKE_READER_H__
#define BOTAN_TLS_HANDSHAKE_READER_H__

#include <botan/tls_magic.h>
#include <botan/secqueue.h>
#include <botan/loadstor.h>
#include <utility>

namespace Botan {

namespace TLS {

/**
* Handshake Reader Interface
*/
class Handshake_Reader
   {
   public:
      virtual void add_input(const byte record[], size_t record_size) = 0;

      virtual bool empty() const = 0;

      virtual bool have_full_record() const = 0;

      virtual std::pair<Handshake_Type, std::vector<byte> > get_next_record() = 0;

      virtual ~Handshake_Reader() {}
   };

/**
* Reader of TLS handshake messages
*/
class Stream_Handshake_Reader : public Handshake_Reader
   {
   public:
      void add_input(const byte record[], size_t record_size);

      bool empty() const;

      bool have_full_record() const;

      std::pair<Handshake_Type, std::vector<byte> > get_next_record();
   private:
      SecureQueue m_queue;
   };

}

}

#endif