Libtrap: Internal development docs
1.16.1
|
Enumerations | |
enum | trap_data_format_t { TRAP_FMT_UNKNOWN = 0, TRAP_FMT_RAW = 1, TRAP_FMT_UNIREC = 2, TRAP_FMT_JSON = 3 } |
enum | trap_in_ifc_state_t { FMT_WAITING = 0, FMT_OK = 1, FMT_MISMATCH = 2, FMT_CHANGED = 3 } |
Functions | |
void | trap_ctx_vset_data_fmt (trap_ctx_t *ctx, uint32_t out_ifc_idx, uint8_t data_type, va_list ap) |
void | trap_ctx_set_data_fmt (trap_ctx_t *ctx, uint32_t out_ifc_idx, uint8_t data_type,...) |
int | trap_ctx_vset_required_fmt (trap_ctx_t *ctx, uint32_t in_ifc_idx, uint8_t data_type, va_list ap) |
int | trap_ctx_set_required_fmt (trap_ctx_t *ctx, uint32_t in_ifc_idx, uint8_t data_type,...) |
int | trap_ctx_get_data_fmt (trap_ctx_t *ctx, uint8_t ifc_dir, uint32_t ifc_idx, uint8_t *data_type, const char **spec) |
void | trap_set_data_fmt (uint32_t out_ifc_idx, uint8_t data_type,...) |
int | trap_set_required_fmt (uint32_t in_ifc_idx, uint8_t data_type,...) |
int | trap_get_data_fmt (uint8_t ifc_dir, uint32_t in_ifc_idx, uint8_t *data_type, const char **spec) |
int | trap_ctx_get_in_ifc_state (trap_ctx_t *ctx, uint32_t ifc_idx) |
int | trap_get_in_ifc_state (uint32_t ifc_idx) |
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 () |
enum trap_data_format_t |
enum trap_in_ifc_state_t |
Possible states of an IFC during data format negotiation.
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.
[in] | sender_ifc_data_fmt | sender_ifc template (char *) |
[in] | receiver_ifc_data_fmt | receiver_ifc template (char *) |
int trap_ctx_get_data_fmt | ( | trap_ctx_t * | ctx, |
uint8_t | ifc_dir, | ||
uint32_t | ifc_idx, | ||
uint8_t * | data_type, | ||
const char ** | spec | ||
) |
Get message format and template that is set on IFC.
On output IFC it should return the values that were set. On input IFC it should return format and template that was received. This function is thread safe.
[in] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | ifc_dir | trap_ifc_type direction of interface |
[in] | ifc_idx | Index of IFC. |
[out] | data_type | Format of messages defined by trap_data_format_t. |
[out] | spec | Specifier of data format specifies the template (char *) is expected. |
int trap_ctx_get_in_ifc_state | ( | trap_ctx_t * | ctx, |
uint32_t | ifc_idx | ||
) |
Returns current state of an input interface on specified index.
This function is thread safe.
[in] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | ifc_idx | Index of the input interface |
void trap_ctx_set_data_fmt | ( | trap_ctx_t * | ctx, |
uint32_t | out_ifc_idx, | ||
uint8_t | data_type, | ||
... | |||
) |
Set format of messages on output IFC.
This function is thread safe.
[in,out] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | out_ifc_idx | Index of output IFC. |
[in] | data_type | Format of messages defined by trap_data_format_t. |
[in] | ... | If data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template (char *) is expected. |
int trap_ctx_set_required_fmt | ( | trap_ctx_t * | ctx, |
uint32_t | in_ifc_idx, | ||
uint8_t | data_type, | ||
... | |||
) |
Set format of messages expected on input IFC.
This function is thread safe.
[in] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | in_ifc_idx | Index of input IFC. |
[in] | data_type | Format of messages defined by trap_data_format_t. |
[in] | ... | If data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template (char *) is expected. |
void trap_ctx_vset_data_fmt | ( | trap_ctx_t * | ctx, |
uint32_t | out_ifc_idx, | ||
uint8_t | data_type, | ||
va_list | ap | ||
) |
Set format of messages on output IFC.
This function is thread safe.
[in,out] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | out_ifc_idx | Index of output IFC. |
[in] | data_type | Format of messages defined by trap_data_format_t. |
[in] | ap | If data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template (char *) is expected. |
int trap_ctx_vset_required_fmt | ( | trap_ctx_t * | ctx, |
uint32_t | in_ifc_idx, | ||
uint8_t | data_type, | ||
va_list | ap | ||
) |
Set format of messages expected on input IFC.
This function is thread safe.
[in] | ctx | Pointer to the private libtrap context data (trap_ctx_init()). |
[in] | in_ifc_idx | Index of input IFC. |
[in] | data_type | Format of messages defined by trap_data_format_t. |
[in] | ap | If data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template (char *) is expected. |
int trap_get_data_fmt | ( | uint8_t | ifc_dir, |
uint32_t | ifc_idx, | ||
uint8_t * | data_type, | ||
const char ** | spec | ||
) |
Get message format and template that is set on IFC.
On output IFC it should return the values that were set. On input IFC it should return format and template that was received.
[in] | ifc_dir | trap_ifc_type direction of interface |
[in] | ifc_idx | index of IFC |
[out] | data_type | format of messages defined by trap_data_format_t |
[out] | spec | Template specifier - UniRec specifier in case of TRAP_FMT_UNIREC data_type, otherwise, it can be any string. |
void* trap_get_global_ctx | ( | ) |
int trap_get_in_ifc_state | ( | uint32_t | ifc_idx | ) |
Returns current state of an input interface on specified index.
[in] | ifc_idx | Index of the input interface |
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
[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. |
void trap_set_data_fmt | ( | uint32_t | out_ifc_idx, |
uint8_t | data_type, | ||
... | |||
) |
Set format of messages on output IFC.
[in] | out_ifc_idx | index of output IFC |
[in] | data_type | format of messages defined by trap_data_format_t |
[in] | ... | if data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template is expected |
int trap_set_required_fmt | ( | uint32_t | in_ifc_idx, |
uint8_t | data_type, | ||
... | |||
) |
Set format of messages expected on input IFC.
[in] | in_ifc_idx | index of input IFC |
[in] | data_type | format of messages defined by trap_data_format_t |
[in] | ... | if data_type is TRAP_FMT_UNIREC or TRAP_FMT_JSON, additional parameter that specifies template is expected |