98 uint8_t *data,
size_t sz,
99 const struct timespec *ts);
300 const char *field_name,
325 const char *field_name,
338 const char **field_name);
350 const char *field_name,
371 const char *field_name,
402 const char *field_name,
403 size_t *n_field_values);
416 size_t *n_field_values);
431 const char *field_name,
457 const char *name,
unsigned *value);
465 const char *name,
unsigned *value);
477 unsigned value,
const char **name);
485 unsigned value,
const char **name);
nmsg_res nmsg_message_add_allocation(nmsg_message_t msg, void *ptr)
Add an allocated object to a message object.
nmsg_message_t nmsg_message_init(nmsg_msgmod_t mod)
Initialize a new, empty message object of a particular type.
nmsg_res nmsg_message_get_field_idx(nmsg_message_t msg, const char *field_name, unsigned *idx)
Get the field index of a named field.
uint32_t nmsg_message_get_operator(nmsg_message_t msg)
Get the operator of a message object.
nmsg_res nmsg_message_get_field_type(nmsg_message_t msg, const char *field_name, nmsg_msgmod_field_type *type)
Get the type of a field.
void nmsg_message_set_time(nmsg_message_t msg, const struct timespec *ts)
Set the timestamp of a message object.
nmsg_res nmsg_message_get_field_name(nmsg_message_t msg, unsigned field_idx, const char **field_name)
Get the name of a field specified by index.
void * nmsg_message_get_payload(nmsg_message_t msg)
WARNING: experts only.
void nmsg_message_set_group(nmsg_message_t msg, uint32_t group)
Set the group of a message object.
nmsg_res nmsg_message_get_field_flags_by_idx(nmsg_message_t msg, unsigned field_idx, unsigned *flags)
Get the flags associated with a field.
nmsg_res nmsg_message_get_field(nmsg_message_t msg, const char *field_name, unsigned val_idx, void **data, size_t *len)
Get the value of a field.
nmsg_message_t nmsg_message_from_raw_payload(unsigned vid, unsigned msgtype, uint8_t *data, size_t sz, const struct timespec *ts)
Initialize a new message object from an opaque payload blob.
size_t nmsg_message_get_payload_size(nmsg_message_t msg)
WARNING: experts only.
int32_t nmsg_message_get_msgtype(nmsg_message_t msg)
Return the message type of a message object.
nmsg_res nmsg_message_enum_value_to_name(nmsg_message_t msg, const char *field_name, unsigned value, const char **name)
Convert a numeric enum value to a symbolic name.
nmsg_res nmsg_message_get_field_by_idx(nmsg_message_t msg, unsigned field_idx, unsigned val_idx, void **data, size_t *len)
Get the value of a field.
nmsg_msgmod_t nmsg_message_get_msgmod(nmsg_message_t msg)
Return the message module object associated with a message object.
int32_t nmsg_message_get_vid(nmsg_message_t msg)
Return the vendor ID of a message object.
nmsg_res nmsg_message_enum_value_to_name_by_idx(nmsg_message_t msg, unsigned field_idx, unsigned value, const char **name)
Convert a numeric enum value to a symbolic name.
nmsg_res nmsg_message_to_json(nmsg_message_t msg, char **json)
Convert a message object to JSON format.
nmsg_res nmsg_message_get_num_field_values(nmsg_message_t msg, const char *field_name, size_t *n_field_values)
Get the total number of field values that a message field contains.
nmsg_res nmsg_message_from_json(const char *json, nmsg_message_t *msg)
Convert a JSON format line to an NMSG payload.
void nmsg_message_compact_payload(nmsg_message_t msg)
WARNING: experts only.
nmsg_res nmsg_message_set_field_by_idx(nmsg_message_t msg, unsigned field_idx, unsigned val_idx, const uint8_t *data, size_t len)
Set a field to the specified value.
nmsg_res nmsg_message_enum_name_to_value(nmsg_message_t msg, const char *field_name, const char *name, unsigned *value)
Convert an enum name to a numeric value.
void nmsg_message_update(nmsg_message_t msg)
WARNING: experts only.
nmsg_res nmsg_message_set_field(nmsg_message_t msg, const char *field_name, unsigned val_idx, const uint8_t *data, size_t len)
Set a field to the specified value.
nmsg_res nmsg_message_get_field_flags(nmsg_message_t msg, const char *field_name, unsigned *flags)
Get the flags associated with a field.
nmsg_res nmsg_message_enum_name_to_value_by_idx(nmsg_message_t msg, unsigned field_idx, const char *name, unsigned *value)
Convert an enum name to a numeric value.
uint32_t nmsg_message_get_group(nmsg_message_t msg)
Get the group of a message object.
void nmsg_message_free_allocations(nmsg_message_t msg)
Free all allocated objects associated with a message object.
nmsg_res nmsg_message_to_pres(nmsg_message_t msg, char **pres, const char *endline)
Convert a message object to presentation format.
uint32_t nmsg_message_get_source(nmsg_message_t msg)
Get the source ID of a message object.
void nmsg_message_get_time(nmsg_message_t msg, struct timespec *ts)
Get the timestamp of a message object.
void nmsg_message_set_operator(nmsg_message_t msg, uint32_t operator_)
Set the operator of a message object.
nmsg_res nmsg_message_get_num_fields(nmsg_message_t msg, size_t *n_fields)
Get the total number of possible fields that a message can contain.
void nmsg_message_set_source(nmsg_message_t msg, uint32_t source)
Set the source ID of a message object.
nmsg_res nmsg_message_get_num_field_values_by_idx(nmsg_message_t msg, unsigned field_idx, size_t *n_field_values)
Get the total number of field values that a message field contains.
nmsg_res nmsg_message_get_field_type_by_idx(nmsg_message_t msg, unsigned field_idx, nmsg_msgmod_field_type *type)
Get the type of a field.
void nmsg_message_destroy(nmsg_message_t *msg)
Destroy a message object and deallocate any resources associated with it.
nmsg_msgmod_field_type
Enum mapping protocol buffer schema types to nmsg-specific types for "transparent" modules.