engine: fix in dial + hangup
[transsip-mirror.git] / src / notifier.h
blob78e6803500d30b24be7f1f9d4443a90dad988ab8
1 #ifndef NOTIFIER_H
2 #define NOTIFIER_H
4 #include <stdint.h>
5 #include <stdio.h>
7 #include "locking.h"
9 #define BLOCK_SUCC_DONE 0
10 #define BLOCK_STOP_CHAIN 1
12 enum event_prio {
13 PRIO_VERYLOW,
14 PRIO_LOW,
15 PRIO_MEDIUM,
16 PRIO_HIGH,
17 PRIO_EXTRA,
20 struct event_block {
21 enum event_prio prio;
22 int (*hook)(const struct event_block *self, unsigned long event,
23 const void *arg);
24 struct event_block *next;
27 struct event_head {
28 struct event_block *head;
29 struct mutexlock lock;
32 static inline void init_event_head(struct event_head *head)
34 head->head = NULL;
35 mutexlock_init(&head->lock);
38 extern int register_event_hook(struct event_block **head,
39 struct event_block *block);
40 extern int register_event_hook_once(struct event_block **head,
41 struct event_block *block);
42 extern int unregister_event_hook(struct event_block **head,
43 struct event_block *block);
44 extern int call_event_hooks(struct event_block **head, unsigned long event,
45 const void *arg, int *called);
47 #endif /* NOTIFIER_H */