25 int main(
int argc,
char **
argv)
79 fprintf(stderr,
"ERROR: Can't define new unirec field 'NEW'");
119 printf(
"%u %u %s %u %s %u\n",
INLINE uint32_t ip_get_v4_as_int(ip_addr_t *addr)
UR_FIELDS(uint32 FOO, uint32 BAR, ipaddr IP, string STR1, string STR2,) int main(int argc
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 field...
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 structur...
ur_set(tmplt, rec, F_FOO, 12345)
#define ur_get(tmplt, data, field_id)
Get value of UniRec field Get value of a fixed-length UniRec field. For variable-length fields...
#define ur_get_ptr(tmplt, data, field_id)
Get pointer to UniRec field Get pointer to fixed or varible length statically defined UniRec field...
*uint16_t * ur_get_ptr_by_id(tmplt2, buffer2, new_id))
#define ur_rec_size(tmplt, rec)
Get size of UniRec record (static and variable length) Get total size of whole UniRec record...
ur_copy_fields(tmplt2, buffer2, tmplt1, buffer)
printf("%u %u %u %s\, ur_get(tmplt, buffer, F_FOO), ip_get_v4_as_int(&(ur_get(tmplt, buffer, F_IP))), ur_get_var_len(tmplt, buffer, F_STR1), ur_get_ptr(tmplt, buffer, F_STR1))
void * ur_create_record(const ur_template_t *tmplt, uint16_t max_var_size)
#define ur_get_var_len(tmplt, rec, field_id)
Get size of a variable sized field in the record. Get size of a variable-length field in the record...
int16_t ur_field_id_t
Type of UniRec field identifiers.
INLINE ip_addr_t ip_from_int(uint32_t i)
memcpy(buffer, rec, ur_rec_size(tmplt, rec))
UniRec template. It contains a table mapping a field to its position in an UniRec record...
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.
ur_set_string(tmplt, rec, F_STR1, "Hello World!")