|
INLINE_IMPL int | ip_is4 (const ip_addr_t *addr) |
|
INLINE_IMPL int | ip_is6 (const ip_addr_t *addr) |
|
INLINE_IMPL uint32_t | ip_get_v4_as_int (ip_addr_t *addr) |
|
INLINE_IMPL char * | ip_get_v4_as_bytes (const ip_addr_t *addr) |
|
INLINE_IMPL ip_addr_t | ip_from_int (uint32_t i) |
|
INLINE_IMPL ip_addr_t | ip_from_4_bytes_be (char b[4]) |
|
INLINE_IMPL ip_addr_t | ip_from_4_bytes_le (char b[4]) |
|
INLINE_IMPL ip_addr_t | ip_from_16_bytes_be (char b[16]) |
|
INLINE_IMPL ip_addr_t | ip_from_16_bytes_le (char b[16]) |
|
INLINE_IMPL int | ip_cmp (const ip_addr_t *addr1, const ip_addr_t *addr2) |
|
INLINE_IMPL int | ip_from_str (const char *str, ip_addr_t *addr) |
|
INLINE_IMPL void | ip_to_str (const ip_addr_t *addr, char *str) |
|
INLINE_IMPL mac_addr_t | mac_from_bytes (uint8_t *array) |
|
INLINE_IMPL int | mac_from_str (const char *str, mac_addr_t *addr) |
|
INLINE_IMPL int | mac_cmp (const mac_addr_t *addr1, const mac_addr_t *addr2) |
|
INLINE_IMPL void | mac_to_str (const mac_addr_t *addr, char *str) |
|
INLINE_IMPL void | mac_to_bytes (const mac_addr_t *addr, uint8_t *array) |
|
int | ur_init (ur_static_field_specs_t field_specs_static) |
| Initialize UniRec structures Initialize UniRec structures. Function is called during defining first own field. More...
|
|
char * | ur_template_string_delimiter (const ur_template_t *tmplt, int delimiter) |
| Get UniRec specifier of the tmplt template with delimiter between fields. More...
|
|
int | ur_get_empty_id () |
| Return first empty id for new UniRec field Return first empty id for new UniRec field. If there is no space in the UniRec structures, it will increase space in the existing structures. More...
|
|
int | ur_get_field_type_from_str (const char *type) |
|
const char * | ur_get_type_and_name_from_string (const char *source, char **name, char **type, int *length_name, int *length_type) |
|
char * | ur_ifc_data_fmt_to_field_names (const char *ifc_data_fmt) |
| Parses field names from data format Function parses field names from data format and returns pointer to new allocated string. Example: "type1 name1,type2 name2" => "name1,name2" New string has to be freed by user. More...
|
|
ur_template_t * | ur_expand_template (const char *ifc_data_fmt, ur_template_t *tmplt) |
| Expand UniRec template Expand existing UniRec template by a string containing types and names of its fields separated by commas. Example ifc_data_fmt: "uint32 FOO,uint8 BAR,float FOO2" Order of fields is not important (templates with the same set of fields are equivalent). In case of success the given template will be destroyed and new template will be returned. More...
|
|
int | ur_define_set_of_fields (const char *ifc_data_fmt) |
| Define set of new UniRec fields Define new UniRec fields at run-time. It adds new fields into existing structures. If the field already exists and type is equal nothing will happen. If the type is not equal an error will be returned. Example ifc_data_fmt: "uint32 FOO,uint8 BAR,float FOO2". More...
|
|
ur_template_t * | ur_define_fields_and_update_template (const char *ifc_data_fmt, ur_template_t *tmplt) |
| Defined new fields and expand an UniRec template Define new fields (function ur_define_set_of_fields) and create new UniRec template (function ur_create_template_from_ifc_spec). The string describing fields contain types and names of fields separated by commas. Example ifc_data_fmt: "uint32 FOO,uint8 BAR,float FOO2" Order of fields is not important (templates with the same set of fields are equivalent). In case of success the given template will be destroyed and new template will be returned. More...
|
|
ur_template_t * | ur_create_template_from_ifc_spec (const char *ifc_data_fmt) |
| Create UniRec template from data format string. Creates new UniRec template (function ur_create_template_from_ifc_spec). The string describing fields contain types and names of fields separated by commas. Example ifc_data_fmt: "uint32 FOO,uint8 BAR,float FOO2" Order of fields is not important (templates with the same set of fields are equivalent).. More...
|
|
int | ur_define_field (const char *name, ur_field_type_t type) |
| Define new UniRec field Define new UniRec field at run-time. It adds new field into existing structures. If the field already exists (name and type are equal) it only returns its ID. More...
|
|
int | ur_undefine_field_by_id (ur_field_id_t field_id) |
| Undefine UniRec field by its id Undefine UniRec field created at run-time. It erases given field from UniRec structures and the field ID can be used for another field. By undefining field, all templates which were using the undefined field, has to be recreated. More...
|
|
int | ur_undefine_field (const char *name) |
| Undefine UniRec field by its name Undefine UniRec field created at run-time. It erases given field from UniRec structures and the field ID can be used for another field. By undefining field, all templates which were using the undefined field, has to be recreated. More...
|
|
void | ur_finalize () |
| Deallocate UniRec structures Deallocate UniRec structures at the end of a program. This function SHOULD be called after all UniRec functions and macros invocations, typically during a cleanup phase before the program's end. This function has to be called if some fields are defined during run-time, otherwise this function is needless. More...
|
|
int | ur_get_id_by_name (const char *name) |
| Get ID of a field by its name Get ID of a field by its name. More...
|
|
int | compare_fields (const void *field1, const void *field2) |
| Compare fields Compare two fields. This function is for sorting the fields in the right order. First by sizes (larger first) and then by names. More...
|
|
ur_template_t * | ur_ctx_create_input_template (trap_ctx_t *ctx, int ifc, const char *fields, char **errstr) |
| Create UniRec template and set it to input interface on specified context Creates UniRec template, same like ur_create_input_template, but context is specified. More...
|
|
ur_template_t * | ur_ctx_create_output_template (trap_ctx_t *ctx, int ifc, const char *fields, char **errstr) |
| Create UniRec template and set it to output interface on specified context Creates UniRec template, same like ur_create_output_template, but context is specified. More...
|
|
int | ur_ctx_set_output_template (trap_ctx_t *ctx, int ifc, ur_template_t *tmplt) |
| Set UniRec template to ouput interface on specified context. More...
|
|
int | ur_ctx_set_input_template (trap_ctx_t *ctx, int ifc, ur_template_t *tmplt) |
| Set UniRec template to input interface on specified context. More...
|
|
ur_template_t * | ur_ctx_create_bidirectional_template (trap_ctx_t *ctx, int ifc_in, int ifc_out, const char *fields, char **errstr) |
| Create UniRec template and set it to input and output interface on specified context Creates UniRec template, same like ur_create_bidirectional_template, but context is specified. More...
|
|
ur_template_t * | ur_create_template (const char *fields, char **errstr) |
| Create UniRec template Create new UniRec template specified by a string containing names of its fields separated by commas. Example spec-string: "SRC_IP,DST_IP,SRC_PORT,DST_PORT,PROTOCOL,PACKETS" Order of fields is not important (templates with the same set of fields are equivalent). Template created by this function should be destroyed by ur_free_template. More...
|
|
void | ur_free_template (ur_template_t *tmplt) |
| Destroy UniRec template Free all memory allocated for a template created previously by ur_create_template. More...
|
|
int | ur_template_compare (const ur_template_t *tmpltA, const ur_template_t *tmpltB) |
| Compares fields of two UniRec templates Function compares only sets of UniRec fields (direction is not compared). More...
|
|
void | ur_print_template (ur_template_t *tmplt) |
| Print UniRec template Print static_size, first_dynamic and table of offsets to stdout (for debugging). If template does not contain any dynamic fields, print '-' instead. param[in] tmplt pointer to the template. More...
|
|
void | ur_var_change_size (const ur_template_t *tmplt, void *rec, int field_id, int new_val_len) |
|
int | ur_set_var (const ur_template_t *tmplt, void *rec, int field_id, const void *val_ptr, int val_len) |
| Set content of variable-length UniRec field Copy given data into variable-length UniRec field, set its offset and length in a record and move data which are behind this field. For better performance use function ur_clear_varlen, before setting all variable fields in record. More...
|
|
int | ur_array_resize (const ur_template_t *tmplt, void *rec, int field_id, int len) |
| Change length of a array field. More...
|
|
char * | ur_array_append_get_ptr (const ur_template_t *tmplt, void *rec, int field_id) |
| Allocate new element at the end of array and return its pointer. More...
|
|
void | ur_clear_varlen (const ur_template_t *tmplt, void *rec) |
| Clear variable-length part of a record. For better performance of setting content to variable-length fields, use this function before setting of all the variable-length fields. This function will clear all the variable-length fields, so they don't have to be moved in memory during setting of them. More...
|
|
uint16_t | ur_rec_varlen_size (const ur_template_t *tmplt, const void *rec) |
| Get size of variable sized part of UniRec record Get total size of all variable-length fields in an UniRec record. More...
|
|
void * | ur_create_record (const ur_template_t *tmplt, uint16_t max_var_size) |
|
void | ur_free_record (void *record) |
|
char * | ur_get_var_as_str (const ur_template_t *tmplt, const void *rec, ur_field_id_t field_id) |
| Get variable-length UniRec field as a C string Copy data of a variable-length field from UniRec record and append '\0' character. The function allocates new memory space for the string, it must be freed using free()! More...
|
|
void * | ur_clone_record (const ur_template_t *tmplt, const void *src) |
| Create new UniRec and copy the source UniRec into it. Function creates new UniRec record and fills it with the data given by parameter. More...
|
|
void | ur_copy_fields (const ur_template_t *dst_tmplt, void *dst, const ur_template_t *src_tmplt, const void *src) |
| Copy data from one UniRec record to another. Copies all fields present in both templates from src to dst. The function compares src_tmplt and dst_tmplt and for each field present in both templates it sets the value of field in dst to a corresponding value in src. "dst" must point to a memory of enough size. More...
|
|
ur_iter_t | ur_iter_fields (const ur_template_t *tmplt, ur_iter_t id) |
| Iterate over fields of a template in order of a record This function can be used to iterate over all fields of a given template. It returns ID of the next field present in the template after a given ID. If ID is set to UR_ITER_BEGIN, it returns the first fields. If no more fields are present, UR_ITER_END is returned. Example usage: ur_field_id_t id = UR_ITER_BEGIN while ((id = ur_iter_fields(&tmplt, id)) != UR_ITER_END) { ... } The order of fields is given by the order in which they are defined. More...
|
|
ur_iter_t | ur_iter_fields_record_order (const ur_template_t *tmplt, int index) |
| Iterate over fields of a template This function can be used to iterate over all fields of a given template. It returns n-th ID of a record specified by index. If the return value is UR_ITER_END. The index is higher than count of fields in the template. Example usage: int i = 0; while ((id = ur_iter_fields(&tmplt, i++)) != UR_ITER_END) { ... } The order of fields is given by the order in the record. More...
|
|
int | ur_set_array_from_string (const ur_template_t *tmpl, void *data, ur_field_id_t f_id, const char *v) |
| Set value of a UniRec array field. More...
|
|
int | ur_set_from_string (const ur_template_t *tmpl, void *data, ur_field_id_t f_id, const char *v) |
| Set value of a UniRec field. More...
|
|
uint8_t | ur_time_from_string (ur_time_t *ur, const char *str) |
|
char * | ur_cpy_string (const char *str) |
| Duplicates given string. Helper function which returns pointer to duplicated string. New string has to be freed by user. More...
|
|
const char * | ur_values_get_name_start_end (uint32_t start, uint32_t end, int32_t value) |
| Returns name of specified value (Helper function) Helper function for ur_values_get_name. This function returns name of specified value and field, which is defined in values file. Function needs start and end index of a field. More...
|
|
const char * | ur_values_get_description_start_end (uint32_t start, uint32_t end, int32_t value) |
| Returns description of specified value (Helper function) Helper function for ur_values_get_description. This function returns description of specified value and field, which is defined in values file. Function needs start and end index of a field. More...
|
|
ur_links_t * | ur_create_links (const char *mask) |
| Create and initialize links structure. Create new links structure and initialize it from link mask in string format passed by parameter. String link mask is stored in uint64_t, thne link count and link_indexes arrray is determined from it. Structure created by this function should be destroyed by ur_free_links. More...
|
|
void | ur_free_links (ur_links_t *links) |
| Destroy links structure. Free all memory allocated for a links structure created previously by ur_create_links. More...
|
|
INLINE_IMPL int | ur_get_link_index (ur_links_t *links, uint64_t link_bit_field) |
| Get index of link (0 - (n-1)) Function gets search link_indexes array for value corresponding to passed LINK_BIT_FIELD, which should contains only one "1" value. If more ones are filled in LINK_BIT_FIELD, first from right is taken. Returns index to link_indexes array (from interval 0 - (link_count-1)) or negative value if correspondig value was not found. More...
|
|
INLINE_IMPL uint64_t | ur_get_link_bit_field_position (ur_links_t *links, unsigned int index) |
| Get position in link_bit_field of link. Get position in link_bit_field of link specified by index of link (from interval 0 - (link_count-1)). This function is inversion to get_link_index. Returns zero if invalid index is passed. More...
|
|
INLINE_IMPL uint64_t | ur_get_link_mask (ur_links_t *links) |
| Get link mask. More...
|
|
INLINE_IMPL unsigned int | ur_get_link_count (ur_links_t *links) |
| Get link count. More...
|
|