12#ifndef OPENVPN_SSL_PROTOSTACK_H
13#define OPENVPN_SSL_PROTOSTACK_H
67template <
typename PACKET,
typename PARENT>
91 const Time::Duration &tls_timeout_arg,
94 bool psid_cookie_mode)
97 ssl_(ssl_factory.ssl()),
191 PACKET pkt = m.
packet.clone();
245 parent().invalidate_callback();
314 return *
static_cast<PARENT *
>(
this);
327 PACKET pkt = m.
packet.clone();
376 if (size ==
static_cast<ssize_t
>(buf->size()))
389 throw unknown_status_from_ssl_layer();
406 PACKET pkt = m.
packet.clone();
428 if (
parent().decapsulate(recv))
445 if (!m.
packet.contains_tls_ciphertext())
505 throw unknown_status_from_ssl_layer();
bool is_tls_alert() const
Some errors may justify letting the underlying SSL library send out TLS alerts.
size_t prepare(const unsigned int context, Buffer &buf) const
unsigned char * raw_alloc()
bool net_recv(PACKET &&pkt)
OPENVPN_SIMPLE_EXCEPTION(unknown_status_from_ssl_layer)
Error::Type invalidation_reason_
ProtoStackBase(SSLFactoryAPI &ssl_factory, TimePtr now_arg, const Time::Duration &tls_timeout_arg, const Frame::Ptr &frame, const SessionStats::Ptr &stats_arg, bool psid_cookie_mode)
std::deque< PACKET > raw_write_queue
uint32_t get_tls_warnings() const
void raw_send(PACKET &&pkt)
bool up_stack(PACKET &recv)
Error::Type invalidation_reason() const
std::deque< BufferPtr > app_write_queue
const AuthCert::Ptr & auth_cert() const
void app_send(BufferPtr &&buf)
static constexpr size_t ovpn_sending_window
ReliableSendTemplate< PACKET > ReliableSend
void export_key_material(OpenVPNStaticKey &key, const std::string &label) const
const Time::Duration tls_timeout
Time next_retransmit() const
OPENVPN_SIMPLE_EXCEPTION(proto_stack_invalidated)
void send_pending_ssl_ciphertext_packets_nothrow() noexcept
A version of send_pending_ssl_ciphertext_packets() that guarantees no exceptions.
ReliableRecvTemplate< PACKET > ReliableRecv
void invalidate(const Error::Type reason)
int up_stack_reentry_level
static constexpr size_t ovpn_receiving_window
void error(const Error::Type reason)
std::string ssl_handshake_details() const
void send_pending_ssl_ciphertext_packets()
If there are any pending SSL ciphertext packets, encapsulate and send them out.
static Ptr Create(ArgsT &&...args)
Creates a new instance of RcEnable with the given arguments.
static constexpr size_t maximum_acks_ack_v1
Message & next_sequenced()
void reset_retransmit(const Time &now, const Time::Duration &tls_timeout)
bool ready_retransmit(const Time &now) const
Message & ref_by_id(const id_t id)
Message & send(const Time &now, const Time::Duration &tls_timeout)
Time::Duration until_retransmit(const Time &now)
virtual void start_handshake()=0
virtual void write_ciphertext(const BufferPtr &buf)=0
virtual const AuthCert::Ptr & auth_cert() const =0
virtual bool read_ciphertext_ready() const =0
virtual bool read_cleartext_ready() const =0
virtual std::string ssl_handshake_details() const =0
virtual bool export_keying_material(const std::string &label, unsigned char *dest, size_t size)=0
virtual BufferPtr read_ciphertext()=0
virtual ssize_t write_cleartext_unbuffered(const void *data, const size_t size)=0
virtual ssize_t read_cleartext(void *data, const size_t capacity)=0
uint32_t get_tls_warnings() const
virtual void error(const size_t type, const std::string *text=nullptr)
static TimeType infinite()
Support deferred server-side state creation when client connects.