Go to the documentation of this file.
51 handler->
_next = NULL;
86 handler->
_next = NULL;
137 handler->
_next = NULL;
178 self->_first_handler = NULL;
189 if( self->_first_handler == NULL )
190 self->_first_handler = handler;
195 while(last->
_next != NULL)
198 last->
_next = handler;
210 if( self->_first_handler == NULL )
215 if( query == handler )
217 self->_first_handler = handler->
_next;
218 handler->
_next = NULL;
222 while(query->
_next != NULL)
224 if( query->
_next == handler )
227 handler->
_next = NULL;
241 self->_first_handler = NULL;
255 (handler_desc_set == desc_set) ||
277 switch(handler->_type)
285 handler->_packet_callback(handler->_user_data, packet, timestamp);
302 (handler_field_desc == field_desc) ||
327 handler->_field_callback(handler->_user_data, field, timestamp);
332 if( handler->_descriptor_set == descriptor_set && handler->_field_descriptor == field_descriptor )
334 handler->_extract_callback(field, handler->_user_data);
mip_dispatch_extractor _extract_callback
User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_EXTRACT.
void mip_dispatch_handler_init_packet_handler(mip_dispatch_handler *handler, uint8_t descriptor_set, bool post_callback, mip_dispatch_packet_callback callback, void *user_data)
Initialize the dispatch handler with a packet callback.
@ MIP_DISPATCH_TYPE_FIELD
Field callback. Use handler._field_callback.
void(* mip_dispatch_packet_callback)(void *context, const mip_packet *packet, mip_timestamp timestamp)
Signature for packet-level callbacks.
void * _user_data
User-provided pointer which is passed directly to the callback.
static void mip_dispatcher_call_field_callbacks(mip_dispatcher *self, const mip_field *field, mip_timestamp timestamp)
Called to dispatch packet callback before and after field iteration.
uint8_t _field_descriptor
MIP field descriptor for this callback. If 0x00, the callback is a packet callback.
void mip_dispatch_handler_init_field_handler(mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_field_callback callback, void *user_data)
Initialize the dispatch handler with a field callback.
bool mip_field_next_in_packet(mip_field *field, const mip_packet *packet)
Iterates over all fields in a packet.
void mip_dispatcher_dispatch_packet(mip_dispatcher *self, const mip_packet *packet, mip_timestamp timestamp)
Called to dispatch the callbacks for a given packet.
bool(* mip_dispatch_extractor)(const mip_field *field, void *ptr)
Signature for extraction callbacks.
@ MIP_DISPATCH_ANY_DATA_SET
Wildcard descriptor set which only includes data packets.
mip_dispatch_packet_callback _packet_callback
User function for packets. Valid if type is MIP_DISPATCH_TYPE_PACKET*.
@ MIP_DISPATCH_ANY_DESCRIPTOR
Any descriptor set or field descriptor.
mip_dispatch_field_callback _field_callback
User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_FIELD.
void mip_dispatcher_add_handler(mip_dispatcher *self, mip_dispatch_handler *handler)
Registers a handler in the dispatch system.
void mip_dispatcher_remove_handler(mip_dispatcher *self, mip_dispatch_handler *handler)
Removes a handler from the dispatch system.
uint8_t _descriptor_set
MIP descriptor set for this callback.
bool mip_dispatch_handler_is_enabled(mip_dispatch_handler *handler)
Determines if the handler is currently enabled.
A structure representing a MIP field.
uint8_t mip_field_field_descriptor(const mip_field *field)
Returns the field descriptor.
uint64_t mip_timestamp
Type used for packet timestamps and timeouts.
struct mip_dispatch_handler * _next
Pointer to the next handler in the list.
static void mip_dispatcher_call_packet_callbacks(mip_dispatcher *self, const mip_packet *packet, mip_timestamp timestamp, bool post)
Called to dispatch packet callback before and after field iteration.
static bool mip_dispatch_is_descriptor_set_match(uint8_t desc_set, uint8_t handler_desc_set)
@ MIP_DISPATCH_TYPE_EXTRACT
Extraction callback. Use handler._extract_callback.
void mip_dispatch_handler_set_enabled(mip_dispatch_handler *handler, bool enable)
Enables or disables the handler.
uint8_t mip_field_descriptor_set(const mip_field *field)
Returns the descriptor set of the packet containing this field._.
mip_dispatch_type
Type of dispatch callback.
void mip_dispatch_handler_init_extractor(mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_extractor extractor, void *field_ptr)
Initialize the dispatch handler with an extraction callback.
Handler information for MIP Packet or Field callbacks.
static bool mip_dispatch_is_descriptor_match(uint8_t desc_set, uint8_t field_desc, uint8_t handler_desc_set, uint8_t handler_field_desc)
Determines if the field matches the dispatcher.
bool mip_is_data_descriptor_set(uint8_t descriptor_set)
Determines if the descriptor set represents some kind of data.
uint8_t _enabled
If false, the handler will be ignored. (Using u8 for better struct packing.)
void mip_dispatcher_remove_all_handlers(mip_dispatcher *self)
Removes all handlers from the dispatcher.
uint8_t mip_packet_descriptor_set(const mip_packet *packet)
Returns the MIP descriptor set for this packet.
Structure representing a MIP Packet.
void(* mip_dispatch_field_callback)(void *context, const mip_field *field, mip_timestamp timestamp)
Signature for field-level callbacks.
bool mip_is_shared_data_field_descriptor(uint8_t field_descriptor)
Determines if the field descriptor is from the shared data set.
@ MIP_INVALID_FIELD_DESCRIPTOR
@ MIP_DISPATCH_TYPE_PACKET_PRE
Packet callback, before field callbacks. Use handler._packet_callback.
void mip_dispatcher_init(mip_dispatcher *self)
Initializes the mip_dispatcher object.
uint8_t _type
Type of the callback. (Using u8 for better struct packing.)
Holds the state of the MIP dispatch system.
void mip_field_init_empty(mip_field *field)
Initialize a mip_field struct to an invalid/empty state.
@ MIP_DISPATCH_TYPE_PACKET_POST
Packet callback, after field callbacks. Use handler._packet_callback.