Libtrap: Internal development docs  1.16.1
Typedefs
Collaboration diagram for IFC API:

Typedefs

typedef int(* ifc_recv_func_t) (void *p, void *d, uint32_t *s, int t)
 
typedef int(* ifc_send_func_t) (void *p, const void *d, uint16_t s, int t)
 
typedef void(* ifc_flush_func_t) (void *p)
 
typedef void(* ifc_disconn_clients_func_t) (void *p)
 
typedef void(* ifc_terminate_func_t) (void *p)
 
typedef void(* ifc_destroy_func_t) (void *p)
 
typedef void(* ifc_create_dump_func_t) (void *p, uint32_t i, const char *d)
 
typedef int32_t(* ifc_get_client_count_func_t) (void *p)
 
typedef int8_t(* ifc_get_client_stats_json_func_t) (void *p, json_t *client_stats_arr)
 
typedef char *(* ifc_get_id_func_t) (void *priv)
 
typedef uint8_t(* ifc_is_conn_func_t) (void *priv)
 

Detailed Description

The set of function that must be implemented for communication interface.

Typedef Documentation

◆ ifc_create_dump_func_t

typedef void(* ifc_create_dump_func_t) (void *p, uint32_t i, const char *d)

Create dump of interface for debug purposes.

Parameters
[in]ppointer to IFC's private memory allocated by constructor
[in]iindex of interface (index into the IFC array in the context trap_ctx_priv_s)
[in]ddirectory path to generate output

Definition at line 137 of file trap_ifc.h.

◆ ifc_destroy_func_t

typedef void(* ifc_destroy_func_t) (void *p)

Destructor, called to free allocated memory.

Parameters
[in,out]ppointer to IFC's private memory allocated by constructor

Definition at line 127 of file trap_ifc.h.

◆ ifc_disconn_clients_func_t

typedef void(* ifc_disconn_clients_func_t) (void *p)

Disconnect all connected clients to output IFC.

Parameters
[in]ppointer to IFC's private memory allocated by constructor

Definition at line 113 of file trap_ifc.h.

◆ ifc_flush_func_t

typedef void(* ifc_flush_func_t) (void *p)

Force flush on interface

Parameters
[in]ppointer to IFC's private memory allocated by constructor

Definition at line 106 of file trap_ifc.h.

◆ ifc_get_client_count_func_t

typedef int32_t(* ifc_get_client_count_func_t) (void *p)

Get number of connected clients.

Parameters
[in]ppointer to IFC's private memory allocated by constructor
Returns
number of clients that are connected to this IFC

Definition at line 145 of file trap_ifc.h.

◆ ifc_get_client_stats_json_func_t

typedef int8_t(* ifc_get_client_stats_json_func_t) (void *p, json_t *client_stats_arr)

Get json array with client statistics

Parameters
[in]ppointer to IFC's private memory allocated by constructor
[out]client_stats_arrpointer to JSON array to be filled with client statistics
Returns
1 (TRUE) on success, otherwise 0 (FALSE)

Definition at line 154 of file trap_ifc.h.

◆ ifc_get_id_func_t

typedef char*(* ifc_get_id_func_t) (void *priv)

Get identifier of the interface

Parameters
[in]privpointer to IFC's private memory allocated by constructor
Returns
pointer to char (private memory of the ifc - do not free!). TCP and UNIXSOCKET ifces return port and name of socket, file ifc returns name of the file, GENERATOR and BLACKHOLE ifces return NULL.

Definition at line 164 of file trap_ifc.h.

◆ ifc_is_conn_func_t

typedef uint8_t(* ifc_is_conn_func_t) (void *priv)

Check whether the input interface is connected

Parameters
[in]privpointer to IFC's private memory allocated by constructor
Returns
1 (TRUE) if connected, otherwise 0 (FALSE)

Definition at line 172 of file trap_ifc.h.

◆ ifc_recv_func_t

typedef int(* ifc_recv_func_t) (void *p, void *d, uint32_t *s, int t)

Receive one message via this IFC.

This function is called from trap_read_from_buffer() when there is a need to get new data.

Parameters
[in]ppointer to IFC's private memory allocated by constructor
[out]dpointer to memory where this IFC can write received message
[out]ssize (in bytes) of received message (must be set by this IFC)
[in]ttimeout, see TRAP Timeout
Returns
TRAP_E_OK on success

Definition at line 85 of file trap_ifc.h.

◆ ifc_send_func_t

typedef int(* ifc_send_func_t) (void *p, const void *d, uint16_t s, int t)

Send one message via this IFC.

This function is called from trap_store_into_buffer() when there is a need to send new data.

Parameters
[in]ppointer to IFC's private memory allocated by constructor
[in]dpointer to message that will be sent
[in]ssize (in bytes) of message that will be sent
[in]ttimeout, see TRAP Timeout
Returns
TRAP_E_OK on success

Definition at line 99 of file trap_ifc.h.

◆ ifc_terminate_func_t

typedef void(* ifc_terminate_func_t) (void *p)

Terminate IFC - stop sending/receiving.

Parameters
[in]ppointer to IFC's private memory allocated by constructor

Definition at line 120 of file trap_ifc.h.