|
const char * | trap_get_type_and_name_from_string (const char *source, const char **name, const char **type, int *length_name, int *length_type) |
|
int | trap_ctx_cmp_data_fmt (const char *sender_ifc_data_fmt, const char *receiver_ifc_data_fmt) |
|
void * | trap_get_global_ctx () |
|
int | trap_get_in_ifc_state (uint32_t ifc_idx) |
|
int | trap_parse_params (int *argc, char **argv, trap_ifc_spec_t *ifc_spec) |
|
char * | trap_get_param_by_delimiter (const char *source, char **dest, const char delimiter) |
| Splitter of params string. Cut the first param, copy it into dest and returns pointer to the start of following parameter. More...
|
|
int | trap_check_buffer_content (void *buffer, uint32_t buffer_size) |
| Check content of buffer, iterate over message headers. More...
|
|
This module declares basic public constants, structures and functions of libtrap.
◆ TRAP_IFC_MESSAGEQ_SIZE
#define TRAP_IFC_MESSAGEQ_SIZE 100000 |
size of message queue used for buffering
Definition at line 206 of file trap.h.
◆ trap_ifc_spec_t
Structure with specification of interface types and their parameters. This can be filled by command-line parameters using trap_parse_params function.
◆ trap_ifcctl_request
Enumerator |
---|
TRAPCTL_AUTOFLUSH_TIMEOUT | Set timeout of automatic buffer flushing for interface, expects uint64_t argument with number of microseconds. It can be set to TRAP_NO_AUTO_FLUSH to disable autoflush.
|
TRAPCTL_BUFFERSWITCH | Enable/disable buffering - could be dangerous on input interface!!! expects char argument with value 1 (default value after libtrap initialization - enabled) or 0 (for disabling buffering on interface).
|
TRAPCTL_SETTIMEOUT | Set interface timeout (int32_t): in microseconds for non-blocking mode; timeout can be also: TRAP_WAIT, TRAP_HALFWAIT, or TRAP_NO_WAIT.
|
Definition at line 198 of file trap.h.
◆ trap_check_buffer_content()
int trap_check_buffer_content |
( |
void * |
buffer, |
|
|
uint32_t |
buffer_size |
|
) |
| |
Check content of buffer, iterate over message headers.
- Parameters
-
[in] | buffer | start of buffer |
[in] | buffer_size | size of buffer |
- Returns
- 0 on success, number of errors otherwise
◆ trap_ctx_cmp_data_fmt()
int trap_ctx_cmp_data_fmt |
( |
const char * |
sender_ifc_data_fmt, |
|
|
const char * |
receiver_ifc_data_fmt |
|
) |
| |
Compares sender_ifc template and receiver_ifc template and returns whether receivers template is subset of the senders template.
- Parameters
-
[in] | sender_ifc_data_fmt | sender_ifc template (char *) |
[in] | receiver_ifc_data_fmt | receiver_ifc template (char *) |
- Returns
- TRAP_E_OK on success (receivers template is subset of the senders template), TRAP_E_FIELDS_MISMATCH (receivers template has field which is not in senders template).
◆ trap_get_global_ctx()
void* trap_get_global_ctx |
( |
| ) |
|
Returns global context.
- Returns
- pointer to global context.
◆ trap_get_in_ifc_state()
int trap_get_in_ifc_state |
( |
uint32_t |
ifc_idx | ) |
|
Returns current state of an input interface on specified index.
- Parameters
-
[in] | ifc_idx | Index of the input interface |
- Returns
- See trap_ctx_get_in_ifc_state().
◆ trap_get_param_by_delimiter()
char* trap_get_param_by_delimiter |
( |
const char * |
source, |
|
|
char ** |
dest, |
|
|
const char |
delimiter |
|
) |
| |
Splitter of params string. Cut the first param, copy it into dest and returns pointer to the start of following parameter.
- Parameters
-
[in] | source | source string, typically params |
[out] | dest | destination string, target of first paramater copying |
[in] | delimiter | separator of values in params |
- Returns
- Pointer to the start of following parameter (char after delimiter).
- Note
- If NULL, no other parameter is present or error during allocation occured.
◆ trap_get_type_and_name_from_string()
const char* trap_get_type_and_name_from_string |
( |
const char * |
source, |
|
|
const char ** |
name, |
|
|
const char ** |
type, |
|
|
int * |
length_name, |
|
|
int * |
length_type |
|
) |
| |
Parse Fields name and types from string.
Function parses the source string and sets the given pointers (pointers to source string). Than it sets length of name and type
- Parameters
-
[in] | source | Source string to parse. |
[in] | name | ouput parameter, where will be set the pointer to name of a field (pointer to source string). |
[in] | type | ouput parameter, where will be set the pointer to type of a field (pointer to source string). |
[in] | length_name | ouput parameter, where will be set the length of a name. |
[in] | length_type | ouput parameter, where will be set the length of a type. |
- Returns
- pointer to source string, moved to next field
◆ trap_parse_params()
int trap_parse_params |
( |
int * |
argc, |
|
|
char ** |
argv, |
|
|
trap_ifc_spec_t * |
ifc_spec |
|
) |
| |
Parse command-line arguments. Extract arguments needed by TRAP to set up interfaces (-i params), verbosity level (-v/-vv/-vvv) and return the rest (argc and argv are modified, i.e. processed parameter is removed). Extracted information is stored into ifc_spec. These variables should be passed to trap_init. Data in ifc_spec must be freed by trap_free_ifc_spec. If help is requested (-h/–help) TRAP_E_HELP is returned (argc and argv are modified also).
- Parameters
-
[in,out] | argc | Pointer to number of command-line arguments. |
[in,out] | argv | Command-line arguments. |
[out] | ifc_spec | Structure with specification of interface types and their parameters. |
- Returns
- Error code (0 on success)
◆ trap_default_socket_path_format
char* trap_default_socket_path_format |
Text string with default path format to sockets (UNIX IFC and service IFC). Assigned in ifc_tcpip.h
◆ trap_git_version
const char trap_git_version[] |
Text string with Git revision of libtrap.
◆ trap_version
const char trap_version[] |
Text string with libtrap version.