dap_stream.h dap_stream.c
Stream server.
dap_stream_t
dap_stream_callback
typedef void (*dap_stream_callback)( dap_stream_t *,void*);
dap_stream_init
int dap_stream_init(bool a_dump_packet_headers);
Init stream module.
dap_stream_deinit
void dap_stream_deinit();
Deinit stream module.
dap_stream_add_proc_http
void dap_stream_add_proc_http(dap_http_t * sh, const char * url);
Adds HTTP processor callbacks.
dap_stream_add_proc_udp
void dap_stream_add_proc_udp(dap_udp_server_t * sh);
Adds UDP processor callbacks.
dap_stream_get_dump_packet_headers
bool dap_stream_get_dump_packet_headers();
Returns the boolean value that determines whether debug information is written to the log.
dap_stream_new_es_client
dap_stream_t* dap_stream_new_es_client(dap_events_socket_t * a_es);
Create a new dap_stream_t
object.
dap_stream_delete
void dap_stream_delete(dap_stream_t * a_stream);
Delete the dap_stream_t object.
dap_stream_data_proc_read
size_t dap_stream_data_proc_read(dap_stream_t * a_stream);
Reading data packets from the e-socket of the stream a_stream
.
dap_stream_set_ready_to_write
void dap_stream_set_ready_to_write(dap_stream_t * a_stream,bool a_is_ready);
Set the readiness state for data writing.
dap_stream_ch.h dap_stream_ch.c
dap_stream_ch_t
dap_stream_ch_callback_t
dap_stream_ch_init
int dap_stream_ch_init();
Init stream channel module.
dap_stream_ch_deinit
void dap_stream_ch_deinit();
Destroy stream channel submodule.
dap_stream_ch_new
dap_stream_ch_t* dap_stream_ch_new( dap_stream_t * dap_stream,uint8_t id);
Creates new stream channel instance.
dap_stream_ch_set_ready_to_read_unsafe
void dap_stream_ch_set_ready_to_read_unsafe(dap_stream_ch_t * ch,bool is_ready);
Sets whether the channel is ready/unready for data reading.
dap_stream_ch_set_ready_to_write_unsafe
void dap_stream_ch_set_ready_to_write_unsafe(dap_stream_ch_t * ch,bool is_ready);
Sets whether the channel is ready/unready for data writing.
dap_stream_ch_delete
void dap_stream_ch_delete(dap_stream_ch_t *a_ch);
Delete channel instance.
dap_stream_ch_pkt.h dap_stream_ch_pkt.c
dap_stream_ch_pkt_t
dap_stream_ch_pkt_hdr_t
dap_stream_ch_pkt_write_unsafe
size_t dap_stream_ch_pkt_write_unsafe(struct dap_stream_ch * a_ch, uint8_t a_type, const void * a_data, size_t a_data_size);
Forms a packet of the logical (virtual) channel a_ch
from the data a_data
, writes it, by calling the dap_stream_pkt_write_unsafe
function, into the packet of the a_ch->stream
stream (with subsequent sending over the network via the e-socket of the stream).
dap_stream_ch_pkt_write_f_unsafe
size_t dap_stream_ch_pkt_write_f_unsafe(struct dap_stream_ch * a_ch, uint8_t a_type, const char * a_str,...);
The same, however, as the data sent over the channel - the format string. We work with data directly, so this should be done in the context of the appropriate thread (_unsafe
-function).
dap_stream_ch_pkt_write_mt
size_t dap_stream_ch_pkt_write_mt(dap_stream_worker_t * a_worker, dap_stream_ch_t *a_ch, uint8_t a_type, const void * a_data, size_t a_data_size);
Generates a message for the stream worker a_worker
from the data a_data
of the channel with id a_ch_uuid
, sends the message to the I/O queue of the stream worker for channels a_worker->queue_ch_io
.
dap_stream_ch_pkt_write_f_mt
size_t dap_stream_ch_pkt_write_f_mt(dap_stream_worker_t * a_worker, dap_stream_ch_t *a_ch, uint8_t a_type, const char * a_str,...);
The same, but as the sent data - a format string.
dap_stream_ch_pkt_write_inter
size_t dap_stream_ch_pkt_write_inter(dap_events_socket_t * a_queue , dap_stream_ch_uuid_t a_ch_uuid, uint8_t a_type, const void * a_data, size_t a_data_size);
Forms a message from the data a_data
of the channel with id a_ch_uuid
, sends the message to the interthread queue a_queue
.
dap_stream_ch_pkt_write_f_inter
size_t dap_stream_ch_pkt_write_f_inter(dap_events_socket_t * a_queue , dap_stream_ch_uuid_t a_ch_uuid, uint8_t a_type, const char * a_format,...);
The same, but as the sent data - a format string.
dap_stream_ch_proc.h dap_stream_ch_proc.c
stream_ch_proc_t
.new_callback
dap_stream_ch_callback_t new_callback
Called on a new connection.
.delete_callback
dap_stream_ch_callback_t delete_callback
Called when a connection is terminated on this channel or on the entire stream.
.packet_in_callback
dap_stream_ch_callback_t packet_in_callback
Called whenever there is an incoming channel packet ready for processing and the channel's read flag is turned on.
.packet_out_callback
dap_stream_ch_callback_t packet_out_callback
Called whenever the channel's write flag is enabled and the opportunity arises.
dap_stream_ch_proc_add
void dap_stream_ch_proc_add(uint8_t id, dap_stream_ch_callback_t new_callback, dap_stream_ch_callback_t delete_callback, dap_stream_ch_callback_t packet_in_callback, dap_stream_ch_callback_t packet_out_callback);
Adds logical channel connection processing callbacks to a special s_proc[id]
structure.
stream_ch_proc_find
stream_ch_proc_t* stream_ch_proc_find(uint8_t id);
Returns a pointer to the s_proc[id]
structure (a set of callback handlers for a channel connection) at the given id
.
dap_stream_ctl.h dap_stream_ctl.c
dap_stream_ctl_init
int dap_stream_ctl_init();
Initialize stream control module.
dap_stream_ctl_deinit
void dap_stream_ctl_deinit();
Deinitialize stream control module.
dap_stream_ctl_add_proc
void dap_stream_ctl_add_proc(struct dap_http * sh, const char * url);
Add stream control url processor to http server.
dap_stream_pkt.h dap_stream_pkt.c
stream_pkt_hdr_t
dap_stream_pkt_t
stream_srv_pkt_t
dap_stream_pkt_detect
dap_stream_pkt_t * dap_stream_pkt_detect(void * a_data, size_t data_size);
Specifies the start of a packet in the data stream *a_data
of size data_size
. Returns a pointer to the beginning of the packet if it was successfully found, or NULL.
dap_stream_pkt_read_unsafe
size_t dap_stream_pkt_read_unsafe(dap_stream_t * a_stream, dap_stream_pkt_t * a_pkt, void * a_buf_out, size_t a_buf_out_size);
Decrypts the packet data using the a_stream->session->key
algorithm, puts the decrypted data in the a_buf_out
buffer of size a_buf_out_size
if it fits there. Returns the size of the output - on success, 0 on error.
dap_stream_pkt_write_unsafe
size_t dap_stream_pkt_write_unsafe(dap_stream_t * a_stream, const void * data, size_t a_data_size);
Generates a dap_stream_pkt_t
packet, encrypts its data with the a_stream->session->key
algorithm, calls the dap_events_socket_write_unsafe
function, which writes the packet to the esocket output buffer and sets the esocket flag DAP_SOCK_READY_TO_WRITE
.
dap_stream_pkt_write_mt
size_t dap_stream_pkt_write_mt (dap_worker_t * a_w, dap_events_socket_t *a_es, dap_enc_key_t *a_key, const void * data, size_t a_data_size);
Generates a dap_stream_pkt_t
packet, encrypts its data using the a_stream->session->key
algorithm, creates a dap_worker_msg_io_t
message, writing the packet to the data
field of the message, sends the message to the queue_es_io
queue of the a_w
worker.
dap_stream_session.h dap_stream_session.c
dap_stream_session_t
stream_session_connection_type_t
dap_stream_session_callback_t
dap_stream_session_init
void dap_stream_session_init();
Initialization of the stream session module.
dap_stream_session_deinit
void dap_stream_session_deinit();
Deinitialization of the stream session module.
dap_stream_session_pure_new
dap_stream_session_t * dap_stream_session_pure_new();
Create a new, clean session.
dap_stream_session_new
dap_stream_session_t * dap_stream_session_new(unsigned int media_id, bool open_preview);
Create a new session with the given media_id
dap_stream_session_id_mt
dap_stream_session_t * dap_stream_session_id_mt(unsigned int id);
Get a session by its id. Thread-safe.
dap_stream_session_id_unsafe
dap_stream_session_t *dap_stream_session_id_unsafe( unsigned int id );
Get a session by its id. Thread-not-safe.
dap_stream_session_lock
void dap_stream_session_lock();
Close access to the next section of code to other threads.
dap_stream_session_unlock
void dap_stream_session_unlock();
Unblock for other threads access to a section of code that was closed before this function was called.
dap_stream_session_open
int dap_stream_session_open(dap_stream_session_t * a_session);
Changes the session state to "opened". Returns the previous state.
dap_stream_session_close_mt
int dap_stream_session_close_mt(unsigned int id);
Closes the session, removes structures associated with it from memory.