39class Channel_Impl :
public std::enable_shared_from_this<Channel_Impl> {
62 virtual size_t from_peer(std::span<const uint8_t> data) = 0;
68 virtual void to_peer(std::span<const uint8_t> data) = 0;
143 std::string_view context,
144 size_t length)
const = 0;
151 virtual void renegotiate(
bool force_full_renegotiation =
false) = 0;
213#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
225 struct Downgrade_Information {
227 std::optional<Client_Hello_13> client_hello;
230 std::vector<uint8_t> peer_transcript;
234 std::optional<Session_with_Handle> tls12_session;
237 std::vector<std::string> next_protocols;
238 size_t io_buffer_size;
239 std::optional<Epoch0_SequenceNumbers> epoch0_sequence_numbers;
241 std::shared_ptr<Callbacks> callbacks;
242 std::shared_ptr<Session_Manager> session_manager;
243 std::shared_ptr<Credentials_Manager> creds;
244 std::shared_ptr<RandomNumberGenerator> rng;
245 std::shared_ptr<const Policy> policy;
248 bool received_tls_13_error_alert;
252 std::unique_ptr<Downgrade_Information> m_downgrade_info;
254 void preserve_peer_transcript(std::span<const uint8_t> input) {
256 m_downgrade_info->peer_transcript.insert(m_downgrade_info->peer_transcript.end(), input.begin(), input.end());
259 void preserve_client_hello(Client_Hello_13 client_hello) {
261 m_downgrade_info->client_hello.emplace(std::move(client_hello));
267 void set_io_buffer_size(
size_t io_buf_sz) {
269 m_downgrade_info->io_buffer_size = io_buf_sz;
280 void request_downgrade() {
282 m_downgrade_info->will_downgrade =
true;
285 void request_downgrade_for_resumption(Session_with_Handle session) {
286 BOTAN_STATE_CHECK(m_downgrade_info && !m_downgrade_info->client_hello.has_value() &&
287 m_downgrade_info->peer_transcript.empty() && !m_downgrade_info->tls12_session.has_value());
289 m_downgrade_info->tls12_session = std::move(session);
297 std::unique_ptr<Downgrade_Information> extract_downgrade_info() {
return std::exchange(m_downgrade_info, {}); }
307#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
308 return m_downgrade_info && m_downgrade_info->will_downgrade;
315#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
316 return m_downgrade_info !=
nullptr;
323 size_t m_useless_records = 0;