aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_handshake_reader.h
blob: 13c270d871f2fc06f8c6e2a7f22ec57174cf0ed1 (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
59
/*
* 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/loadstor.h>
#include <vector>
#include <deque>
#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:
      std::deque<byte> m_queue;
   };

}

}

#endif