aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_server_impl.h
blob: 4c4d6f0f88b44f9e4612bdfa38f684f3d49e42d8 (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
60
61
62
63
64
65
66
67
68
69
70
71
/*
* TLS Server
* (C) 2004-2011 Jack Lloyd
*     2016 Matthias Gierlings
*     2021 Elektrobit Automotive GmbH
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_TLS_SERVER_IMPL_H_
#define BOTAN_TLS_SERVER_IMPL_H_

#include <botan/tls_magic.h>
#include <vector>
#include <memory>
#include <string>

namespace Botan {

namespace TLS {

class Handshake_State;
class Handshake_IO;
class Channel_Impl;

/**
* Interface of pimpl for Server
*/
class Server_Impl
   {
   public:
      virtual ~Server_Impl() = default;

      explicit Server_Impl(Channel_Impl& impl) : m_impl{impl} {}

      Channel_Impl& channel() { return m_impl; }

      /**
      * Return the protocol notification set by the client (using the
      * ALPN extension) for this connection, if any. This value is not
      * tied to the session and a later renegotiation of the same
      * session can choose a new protocol.
      */
      virtual std::string next_protocol() const = 0;

      /**
      * Return the protocol notification set by the client (using the
      * ALPN extension) for this connection, if any. This value is not
      * tied to the session and a later renegotiation of the same
      * session can choose a new protocol.
      */
      virtual std::string application_protocol() const = 0;

      virtual void initiate_handshake(Handshake_State& state,
                                      bool force_full_renegotiation) = 0;

      virtual void process_handshake_msg(const Handshake_State* active_state,
                                         Handshake_State& pending_state,
                                         Handshake_Type type,
                                         const std::vector<uint8_t>& contents,
                                         bool epoch0_restart) = 0;

      virtual std::unique_ptr<Handshake_State> new_handshake_state(std::unique_ptr<Handshake_IO> io) = 0;

   private:
      Channel_Impl& m_impl;
   };
}
}

#endif