Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::server::QuicConnectionManager Class Reference

Manages QUIC connections. More...

#include <QuicConnectionManager.hpp>

Collaboration diagram for orbit::server::QuicConnectionManager:

Public Member Functions

 QuicConnectionManager (network::UdpSocket &socket, SSL_CTX *ssl_ctx)
 Constructs a QuicConnectionManager.
 
 ~QuicConnectionManager ()
 
void on_packet_received (const uint8_t *data, size_t datalen, const sockaddr_in &remote_addr)
 Processes an incoming UDP packet for QUIC.
 
void send_packet (const uint8_t *data, size_t datalen, const sockaddr *remote_addr, socklen_t remote_addrlen)
 Sends a QUIC packet to a remote address.
 
void handle_timers ()
 Event-loop thread: runs due timers and forgets finished connections.
 
int next_timeout_ms () const
 Milliseconds until a connection's next timer, or -1 if none.
 
size_t connection_count () const
 
void set_http_context (const Http3Context &ctx)
 
const Http3Context & http_context () const
 

Private Member Functions

void sync_connection (const std::shared_ptr< QuicConnection > &conn)
 
size_t unique_connections () const
 

Private Attributes

network::UdpSocket & socket_
 
SSL_CTX * ssl_ctx_ {nullptr}
 
Http3Context http_context_
 
std::unordered_map< ngtcp2_cid, std::shared_ptr< QuicConnection >, QuicConnectionIdHash, QuicConnectionIdEqual > connections_
 

Detailed Description

Manages QUIC connections.

Constructor & Destructor Documentation

◆ QuicConnectionManager()

orbit::server::QuicConnectionManager::QuicConnectionManager ( network::UdpSocket &  socket,
SSL_CTX *  ssl_ctx 
)

Constructs a QuicConnectionManager.

Parameters
socketThe UDP socket for QUIC.
ssl_ctxThe SSL context for QUIC.

◆ ~QuicConnectionManager()

orbit::server::QuicConnectionManager::~QuicConnectionManager ( )

Member Function Documentation

◆ connection_count()

size_t orbit::server::QuicConnectionManager::connection_count ( ) const
inline

◆ handle_timers()

void orbit::server::QuicConnectionManager::handle_timers ( )

Event-loop thread: runs due timers and forgets finished connections.

◆ http_context()

const Http3Context & orbit::server::QuicConnectionManager::http_context ( ) const
inline

◆ next_timeout_ms()

int orbit::server::QuicConnectionManager::next_timeout_ms ( ) const

Milliseconds until a connection's next timer, or -1 if none.

◆ on_packet_received()

void orbit::server::QuicConnectionManager::on_packet_received ( const uint8_t *  data,
size_t  datalen,
const sockaddr_in &  remote_addr 
)

Processes an incoming UDP packet for QUIC.

Parameters
dataThe packet data.
datalenThe length of the data.
remote_addrThe remote address of the sender.

◆ send_packet()

void orbit::server::QuicConnectionManager::send_packet ( const uint8_t *  data,
size_t  datalen,
const sockaddr *  remote_addr,
socklen_t  remote_addrlen 
)

Sends a QUIC packet to a remote address.

Parameters
dataThe packet data.
datalenThe length of the data.
remote_addrThe remote address.
remote_addrlenThe length of the remote address struct.

◆ set_http_context()

void orbit::server::QuicConnectionManager::set_http_context ( const Http3Context &  ctx)
inline

◆ sync_connection()

void orbit::server::QuicConnectionManager::sync_connection ( const std::shared_ptr< QuicConnection > &  conn)
private

◆ unique_connections()

size_t orbit::server::QuicConnectionManager::unique_connections ( ) const
private

Member Data Documentation

◆ connections_

std::unordered_map<ngtcp2_cid, std::shared_ptr<QuicConnection>, QuicConnectionIdHash, QuicConnectionIdEqual> orbit::server::QuicConnectionManager::connections_
private

◆ http_context_

Http3Context orbit::server::QuicConnectionManager::http_context_
private

◆ socket_

network::UdpSocket& orbit::server::QuicConnectionManager::socket_
private

◆ ssl_ctx_

SSL_CTX* orbit::server::QuicConnectionManager::ssl_ctx_ {nullptr}
private

The documentation for this class was generated from the following file: