Sunshine master
Self-hosted game stream host for Moonlight.
rtsp_stream::socket_t Class Reference

RTSP client socket state and receive buffer parser. More...

Inheritance diagram for rtsp_stream::socket_t:
[legend]
Collaboration diagram for rtsp_stream::socket_t:
[legend]

Public Member Functions

void handle_data (msg_t &&req)
 Dispatch a parsed RTSP request to the socket's command handler.
 
void read ()
 Queue an asynchronous read to begin the next message.
 
void read_plaintext_payload ()
 Queue an asynchronous read of the payload portion of a plaintext message.
 
 socket_t (boost::asio::io_context &io_context, std::function< void(tcp::socket &sock, launch_session_t &, msg_t &&)> &&handle_data_fn)
 Construct an RTSP socket wrapper around an accepted TCP connection.
 

Static Public Member Functions

static void handle_plaintext_payload (std::shared_ptr< socket_t > &socket, const boost::system::error_code &ec, std::size_t bytes)
 Read the plaintext RTSP payload after the header is parsed.
 
static void handle_read_encrypted_header (std::shared_ptr< socket_t > &socket, const boost::system::error_code &ec, std::size_t bytes)
 Read the encrypted RTSP header before receiving the encrypted payload.
 
static void handle_read_encrypted_message (std::shared_ptr< socket_t > &socket, const boost::system::error_code &ec, std::size_t bytes)
 Read and decrypt the encrypted RTSP payload.
 
static void handle_read_plaintext (std::shared_ptr< socket_t > &socket, const boost::system::error_code &ec, std::size_t bytes)
 Read and parse the plaintext RTSP request header.
 

Public Attributes

char * begin = msg_buf.data()
 Start of the unparsed data currently in msg_buf.
 
char * crlf
 Pointer to the next CRLF delimiter while parsing the receive buffer.
 
std::function< void(tcp::socket &sock, launch_session_t &, msg_t &&)> handle_data_fn
 Command dispatcher installed by the RTSP server.
 
std::array< char, 2048 > msg_buf
 Receive buffer for one RTSP request header and payload.
 
std::shared_ptr< launch_session_tsession
 Launch session claimed by this RTSP socket.
 
tcp::socket sock
 TCP socket connected to the RTSP client.
 

Detailed Description

RTSP client socket state and receive buffer parser.

Constructor & Destructor Documentation

◆ socket_t()

rtsp_stream::socket_t::socket_t ( boost::asio::io_context & io_context,
std::function< void(tcp::socket &sock, launch_session_t &, msg_t &&)> && handle_data_fn )
inline

Construct an RTSP socket wrapper around an accepted TCP connection.

Parameters
io_contextIo context.
handle_data_fnHandle data.

Member Function Documentation

◆ handle_data()

void rtsp_stream::socket_t::handle_data ( msg_t && req)
inline

Dispatch a parsed RTSP request to the socket's command handler.

Parameters
reqParsed RTSP request being handled.

◆ handle_plaintext_payload()

static void rtsp_stream::socket_t::handle_plaintext_payload ( std::shared_ptr< socket_t > & socket,
const boost::system::error_code & ec,
std::size_t bytes )
inlinestatic

Read the plaintext RTSP payload after the header is parsed.

Parameters
socketThe socket the message was received on.
ecThe error code of the read operation.
bytesThe number of bytes read.

◆ handle_read_encrypted_header()

static void rtsp_stream::socket_t::handle_read_encrypted_header ( std::shared_ptr< socket_t > & socket,
const boost::system::error_code & ec,
std::size_t bytes )
inlinestatic

Read the encrypted RTSP header before receiving the encrypted payload.

Parameters
socketThe socket the message was received on.
ecThe error code of the read operation.
bytesThe number of bytes read.

◆ handle_read_encrypted_message()

static void rtsp_stream::socket_t::handle_read_encrypted_message ( std::shared_ptr< socket_t > & socket,
const boost::system::error_code & ec,
std::size_t bytes )
inlinestatic

Read and decrypt the encrypted RTSP payload.

Parameters
socketThe socket the message was received on.
ecThe error code of the read operation.
bytesThe number of bytes read.

◆ handle_read_plaintext()

static void rtsp_stream::socket_t::handle_read_plaintext ( std::shared_ptr< socket_t > & socket,
const boost::system::error_code & ec,
std::size_t bytes )
inlinestatic

Read and parse the plaintext RTSP request header.

Parameters
socketThe socket the message was received on.
ecThe error code of the read operation.
bytesThe number of bytes read.

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