trmsg_foreach_instances_messages()
#
Iterates over all instance messages in the given list
, invoking the specified callback function for each message. The callback receives a cloned instance of each message.
Prototype
int trmsg_foreach_instances_messages(
json_t *list,
int (*callback)(
json_t *list, // Not yours!
const char *key,
json_t *instances, // It's yours, Must be owned
void *user_data1,
void *user_data2
),
void *user_data1,
void *user_data2,
json_t *jn_filter // owned
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The list containing messages to iterate over. |
|
|
Function pointer to the callback that will be invoked for each message instance. |
|
|
User-defined data passed to the callback function. |
|
|
Additional user-defined data passed to the callback function. |
|
|
Filter criteria to select specific messages. The caller owns this parameter. |
Return Value
Returns 0 on success, a negative value if the iteration was interrupted by the callback, or an error code on failure.
Notes
The callback function should return a negative value to break the iteration. The instances
parameter passed to the callback is owned by the caller and must be managed accordingly.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples