__extension__ \
({\
int ret = trap_ctx_recv(ctx, ifc_num, &data, &data_size);\
if (ret == TRAP_E_FORMAT_CHANGED) {\
const char *spec = NULL;\
uint8_t data_fmt;\
if (trap_ctx_get_data_fmt(ctx, TRAPIFC_INPUT, ifc_num, &data_fmt, &spec) != TRAP_E_OK) {\
fprintf(stderr, "Data format was not loaded.\n");\
} else {\
if (tmplt == NULL) {\
fprintf(stderr, "Template could not be edited.\n");\
} else {\
if (spec_cpy == NULL) {\
fprintf(stderr, "Memory allocation problem.\n");\
} else {\
trap_ctx_set_data_fmt(ctx, tmplt->ifc_out, TRAP_FMT_UNIREC, spec_cpy);\
}\
}\
}\
}\
}\
ret;\
})
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.
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)...
Receive data from interface with given context Receive data with specified template from libtrap interface with specified context. If the receiving template is subset of sending template, it will define new fields and expand receiving template.