b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen /* linked list of all events, newest first */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen /* Call callbacks with EVENT_CALLBACK_TYPE_FREE for this event. */
53ea4ad7b37e6c78a834151cdc30374316da4e34Timo Sirainen/* Fields that are exported & imported: */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen /* This is the event's name while it's being sent. It'll be removed
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen after the event is sent. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen /* Event is being sent */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen /* Event with call_free=TRUE is being freed */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Returns TRUE if the event should continue to the next handler. Unless
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen stopped, the final handler logs the event if it matches the log filter. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainentypedef bool event_callback_t(struct event *event,
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Called when category is registered or unregistered. The parent category
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen is always already registered. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainentypedef void event_category_callback_t(struct event_category *category);
ddd5a0932db39f7336123f5089fdd77f6a38bce6Timo Sirainenvoid event_send(struct event *event, struct failure_context *ctx,
68f5234e8c0a79b72546e1b1013aae4b86f394a4Timo Sirainenvoid event_vsend(struct event *event, struct failure_context *ctx,
68f5234e8c0a79b72546e1b1013aae4b86f394a4Timo Sirainen const char *fmt, va_list args) ATTR_FORMAT(3, 0);
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Find event category by name. This only finds registered categories. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainenstruct event_category *event_category_find_registered(const char *name);
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Return all registered categories. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainenevent_get_registered_categories(unsigned int *count_r);
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Register callback to be called whenever events are sent. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainenvoid event_register_callback(event_callback_t *callback);
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainenvoid event_unregister_callback(event_callback_t *callback);
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen/* Register callback to be called whenever categories are registered or
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainen unregistered. */
b8a1347a9ea2cecf0d16f24748c2600fea8c7158Timo Sirainenvoid event_category_register_callback(event_category_callback_t *callback);