Libtrap: Internal development docs
1.16.1
|
Data Structures | |
struct | tls_receiver_private_s |
Typedefs | |
typedef struct tls_receiver_private_s | tls_receiver_private_t |
Functions | |
static int | receive_part (void *priv, void **data, uint32_t *size, struct timeval *tm) |
int | tls_receiver_recv (void *priv, void *data, uint32_t *size, int timeout) |
Receive data from interface. More... | |
void | tls_receiver_terminate (void *priv) |
Set interface state as terminated. More... | |
void | tls_receiver_destroy (void *priv) |
Destructor of TLS receiver (input ifc) More... | |
static void | tls_receiver_create_dump (void *priv, uint32_t idx, const char *path) |
char * | tls_recv_ifc_get_id (void *priv) |
uint8_t | tls_recv_ifc_is_conn (void *priv) |
int | create_tls_receiver_ifc (trap_ctx_priv_t *ctx, char *params, trap_input_ifc_t *ifc, uint32_t idx) |
Constructor of input TCP/IP IFC module. This function is called by TRAP library to initialize one input interface. More... | |
static int | wait_for_connection (int sock, struct timeval *tv) |
static void | client_socket_disconnect (void *priv) |
static int | client_socket_connect (tls_receiver_private_t *c, struct timeval *tv) |
client_socket is used as a receiver More... | |
typedef struct tls_receiver_private_s tls_receiver_private_t |
|
static |
|
static |
int create_tls_receiver_ifc | ( | trap_ctx_priv_t * | ctx, |
char * | params, | ||
trap_input_ifc_t * | ifc, | ||
uint32_t | idx | ||
) |
Constructor of input TCP/IP IFC module. This function is called by TRAP library to initialize one input interface.
[in,out] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | params | Configuration string containing space separated values of these parameters (in this exact order): dest_addr dest_port, where dest_addr is destination address of output TCP/IP IFC module and dest_port is the port where sender is listening. |
[in,out] | ifc | IFC interface used for calling TCP/IP module. |
[in] | idx | Index of IFC that is created. |
|
static |
|
static |
void tls_receiver_destroy | ( | void * | priv | ) |
int tls_receiver_recv | ( | void * | priv, |
void * | data, | ||
uint32_t * | size, | ||
int | timeout | ||
) |
Receive data from interface.
It is expected that data is always the same pointer because it is buffer given by trap.c.
This function contains finite state machine that controls receiving messages (header and payload), handles timeouts and sleep (to offload CPU during waiting for connection). The transition graph is:
[in,out] | priv | private configuration structure |
[out] | data | where received data are stored |
[out] | size | size of received data |
[in] | timeout | timeout in usec, can be TRAP_WAIT, TRAP_HALFWAIT, or TRAP_NO_WAIT |
messageframe contains header that is read (even partially) in HEAD_WAIT
void tls_receiver_terminate | ( | void * | priv | ) |