src: rename file from *-* to *_*
[transsip-mirror.git] / src / call_notifier.c
blob260d5c45be76b34489209055bd19a217e89fa739
1 /*
2 * transsip - the telephony toolkit
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
7 */
9 #include "notifier.h"
10 #include "locking.h"
11 #include "call_notifier.h"
13 static struct event_head call_notifier;
15 void init_call_notifier(void)
17 call_notifier.head = NULL;
18 mutexlock_init(&call_notifier.lock);
21 int register_call_notifier(struct event_block *block)
23 int ret;
25 mutexlock_lock(&call_notifier.lock);
26 ret = register_event_hook(&call_notifier.head, block);
27 mutexlock_unlock(&call_notifier.lock);
29 return ret;
32 int register_call_notifier_once(struct event_block *block)
34 int ret;
36 mutexlock_lock(&call_notifier.lock);
37 ret = register_event_hook_once(&call_notifier.head, block);
38 mutexlock_unlock(&call_notifier.lock);
40 return ret;
43 int unregister_call_notifier(struct event_block *block)
45 int ret;
47 mutexlock_lock(&call_notifier.lock);
48 ret = unregister_event_hook(&call_notifier.head, block);
49 mutexlock_unlock(&call_notifier.lock);
51 return ret;
54 int call_notifier_exec(unsigned long event, const void *arg)
56 int ret;
58 mutexlock_lock(&call_notifier.lock);
59 ret = call_event_hooks(&call_notifier.head, event, arg, NULL);
60 mutexlock_unlock(&call_notifier.lock);
62 return ret;