9#ifndef BOTAN_TLS_CHANNEL_IO_BASE_H_
10#define BOTAN_TLS_CHANNEL_IO_BASE_H_
12#include <botan/internal/tls_flight_13.h>
13#include <botan/internal/tls_record_13.h>
41 std::shared_ptr<const Policy>
policy,
46 m_policy(std::move(
policy)), m_callbacks(std::move(
callbacks)), m_side(side) {}
63 void copy_data(std::span<const uint8_t> data);
78 void send(std::vector<Flight::Message> flight);
81 void send(std::span<const uint8_t> payload);
84 void send(
const Alert& alert,
bool handle_compat_mode);
120 void set_record_size_limits(uint16_t out, uint16_t in);
124 std::optional<ReceiveEvent> next_pending_handshake_message(std::optional<Transcript_Hash_State>& transcript_hash,
125 bool handshake_complete);
128 void send_dummy_change_cipher_spec();
134 virtual void send_flight(std::vector<Flight::Message> flight) = 0;
144 std::shared_ptr<const Cipher_State>
cipher_state()
const;
154 bool needs_traffic_based_key_update()
const;
157 bool m_first_message_delivered =
false;
164 bool m_closed_for_reading =
false;
170 bool m_dummy_ccs_emitted =
false;
176 bool m_key_update_reciprocation_pending =
false;
182 bool m_key_update_requested =
false;
184 uint64_t m_last_peer_key_update_ms = 0;
186 std::weak_ptr<Cipher_State> m_cipher_state;
187 std::shared_ptr<const Policy> m_policy;
188 std::shared_ptr<Callbacks> m_callbacks;
void copy_data(std::span< const uint8_t > data)
std::shared_ptr< const Cipher_State > cipher_state() const
virtual void process(const Handshake_Record &record)=0
virtual const Handshake_Layer & handshake_layer() const =0
const Callbacks & callbacks() const
virtual const Record_Layer & record_layer() const =0
void send(std::vector< Flight::Message > flight)
Sends a flight of handshake messages to the peer.
std::variant< BytesNeeded, Handshake_Message_13, Post_Handshake_Message_13, ChangeCipherSpec_Record, Alert_Record, ApplicationData_Record > ReceiveEvent
Channel_IO(const Channel_IO &)=delete
Channel_IO & operator=(Channel_IO &&)=delete
void handle_key_update(const Key_Update &key_update)
const Policy & policy() const
void notify_closed_for_reading()
virtual void send_data(Record_Type record_type, std::span< const uint8_t > payload, Cipher_State *cipher_state)=0
ReceiveEvent next_pending_event(std::optional< Transcript_Hash_State > &transcript_hash, bool handshake_complete)
Channel_IO(Connection_Side side, std::shared_ptr< const Policy > policy, std::shared_ptr< Callbacks > callbacks)
Channel_IO(Channel_IO &&)=delete
virtual void send_flight(std::vector< Flight::Message > flight)=0
virtual ~Channel_IO()=default
void update_traffic_keys(bool request_peer_update)
static std::shared_ptr< Channel_IO > create(Connection_Side side, TLS_Flavor flavor, std::shared_ptr< const Policy > policy, std::shared_ptr< Callbacks > callbacks)
virtual Record_Layer & record_layer()=0
Channel_IO & operator=(const Channel_IO &)=delete
virtual Handshake_Layer & handshake_layer()=0
void set_cipher_state(std::weak_ptr< Cipher_State > cipher_state)
std::variant< Client_Hello_13, Client_Hello_12_Shim, Server_Hello_13, Server_Hello_12_Shim, Hello_Retry_Request, Encrypted_Extensions, Certificate_13, Certificate_Request_13, Certificate_Verify_13, Finished_13 > Handshake_Message_13
std::variant< New_Session_Ticket_13, Key_Update > Post_Handshake_Message_13