ENet control server that routes incoming control packets to stream sessions.
More...
|
| int | bind (net::af_e address_family, std::uint16_t port) |
| | Bind the underlying socket or graphics resource to its target.
|
| |
| void | call (std::uint16_t type, session_t *session, const std::string_view &payload, bool reinjected) |
| | Call the handler for a given control stream message.
|
| |
|
void | flush () |
| | Flush pending packets to the stream socket.
|
| |
| session_t * | get_session (const net::peer_t peer, uint32_t connect_data) |
| | Return the session value from the backend.
|
| |
| void | iterate (std::chrono::milliseconds timeout) |
| | Visit each active control server session.
|
| |
| void | map (uint16_t type, std::function< void(session_t *, const std::string_view &)> cb) |
| | Register or visit handlers stored in the map.
|
| |
| int | send (const std::string_view &payload, net::peer_t peer) |
| | Send the serialized response over the active socket.
|
| |
|
|
ENetAddress | _addr |
| | Local ENet address used by the control channel.
|
| |
|
net::host_t | _host |
| | ENet host object that owns the control socket.
|
| |
|
std::unordered_map< std::uint16_t, std::function< void(session_t *, const std::string_view &)> > | _map_type_cb |
| | Control-message handlers keyed by packet type.
|
| |
|
sync_util::sync_t< std::map< net::peer_t, session_t * > > | _peer_to_session |
| | Peer to session.
|
| |
|
sync_util::sync_t< std::vector< session_t * > > | _sessions |
| | Active sessions registered with the control server.
|
| |
ENet control server that routes incoming control packets to stream sessions.
◆ bind()
| int stream::control_server_t::bind |
( |
net::af_e | address_family, |
|
|
std::uint16_t | port ) |
|
inline |
Bind the underlying socket or graphics resource to its target.
- Parameters
-
| address_family | Address family. |
| port | TCP or UDP port number. |
- Returns
- Network operation status.
◆ call()
| void stream::control_server_t::call |
( |
std::uint16_t | type, |
|
|
session_t * | session, |
|
|
const std::string_view & | payload, |
|
|
bool | reinjected ) |
Call the handler for a given control stream message.
- Parameters
-
| type | The message type. |
| session | The session the message was received on. |
| payload | The payload of the message. |
| reinjected | true if this message is being reprocessed after decryption. |
◆ get_session()
Return the session value from the backend.
- Parameters
-
| peer | Remote endpoint associated with the socket. |
| connect_data | Connect data. |
- Returns
- Existing session for the peer/connect-data pair, or nullptr when none matches.
◆ iterate()
| void stream::control_server_t::iterate |
( |
std::chrono::milliseconds | timeout | ) |
|
Visit each active control server session.
- Parameters
-
| timeout | Maximum time to wait for the operation. |
◆ map()
| void stream::control_server_t::map |
( |
uint16_t | type, |
|
|
std::function< void(session_t *, const std::string_view &)> | cb ) |
|
inline |
Register or visit handlers stored in the map.
- Parameters
-
| type | Protocol, message, or resource type selector. |
| cb | Callback invoked for each matching message or session. |
◆ send()
| int stream::control_server_t::send |
( |
const std::string_view & | payload, |
|
|
net::peer_t | peer ) |
|
inline |
Send the serialized response over the active socket.
- Parameters
-
| payload | Optional payload body to include in the response. |
| peer | Remote endpoint associated with the socket. |
- Returns
- Network operation status.
The documentation for this class was generated from the following file: