#include <async_reception.h>
Collaboration diagram for freesecs::async_reception_t:
Public Types | |
enum | state_t { IDLE = 0, WTG_FOR_DATA, RECEIVED } |
data reception state define | |
Public Member Functions | |
async_reception_t (int fd, const char *name) | |
ctor | |
virtual | ~async_reception_t () |
void | start_recv (void *buf, size_t count) |
Starts receiving data Having been specified the buffer location and number of bytes to read, async reader instance proceeds to WTG_FOR_DATA state until all the data comes as requested and then proceeds to RECEIVED state. When all data has been read, data_recvd_signal is triggered. When data is partially read, data_partially_recvd_signal is triggered. When reception error occurs (socket cnx has been closed or nothing else is to be read), recv_error_signal is triggered. | |
void | stop_recv () |
Stops recieving data. | |
state_t | get_state () |
Returns status of data recieving. | |
size_t | get_bytes_read () |
Returns number of bytes received since last start_recv call. | |
Public Attributes | |
signal_one_arg_t< size_t > | data_partially_recvd_signal |
Signal for reception/read activity. | |
signal_one_arg_t< size_t > | data_recvd_signal |
Signal for data received as per start_recv request. | |
signal_one_arg_t< int > | recv_error_signal |
Signal for data reception/read error The reasons could be: tcp disconnect, EOF. The argiment of the signal is error code as per errno spec. | |
Classes | |
union | event_data_t |
Async SM event type declaration. |
Definition at line 43 of file async_reception.h.
freesecs::async_reception_t::async_reception_t | ( | int | fd, | |
const char * | name | |||
) |
ctor
fd | File descriptor to read from | |
name | async reception instance name, used for logging |
Definition at line 45 of file async_reception.cpp.
References async_reception_t().
Referenced by async_reception_t().
Here is the call graph for this function:
Here is the caller graph for this function:
void freesecs::async_reception_t::start_recv | ( | void * | buf, | |
size_t | count | |||
) |
Starts receiving data Having been specified the buffer location and number of bytes to read, async reader instance proceeds to WTG_FOR_DATA state until all the data comes as requested and then proceeds to RECEIVED state. When all data has been read, data_recvd_signal is triggered. When data is partially read, data_partially_recvd_signal is triggered. When reception error occurs (socket cnx has been closed or nothing else is to be read), recv_error_signal is triggered.
buf | Buffer to store data into | |
count | Number of bytes to read |
Definition at line 110 of file async_reception.cpp.
Referenced by freesecs::ms_timer_t::start().
Here is the caller graph for this function:
size_t freesecs::async_reception_t::get_bytes_read | ( | ) |
Returns number of bytes received since last start_recv call.
Definition at line 134 of file async_reception.cpp.
signal_one_arg_t<size_t> freesecs::async_reception_t::data_partially_recvd_signal |
Signal for reception/read activity.
Definition at line 99 of file async_reception.h.
signal_one_arg_t<size_t> freesecs::async_reception_t::data_recvd_signal |
Signal for data received as per start_recv request.
Definition at line 104 of file async_reception.h.
Referenced by freesecs::ms_timer_t::ms_timer_t().