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.
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
)
25 mutexlock_lock(&call_notifier
.lock
);
26 ret
= register_event_hook(&call_notifier
.head
, block
);
27 mutexlock_unlock(&call_notifier
.lock
);
32 int register_call_notifier_once(struct event_block
*block
)
36 mutexlock_lock(&call_notifier
.lock
);
37 ret
= register_event_hook_once(&call_notifier
.head
, block
);
38 mutexlock_unlock(&call_notifier
.lock
);
43 int unregister_call_notifier(struct event_block
*block
)
47 mutexlock_lock(&call_notifier
.lock
);
48 ret
= unregister_event_hook(&call_notifier
.head
, block
);
49 mutexlock_unlock(&call_notifier
.lock
);
54 int call_notifier_exec(unsigned long event
, const void *arg
)
58 mutexlock_lock(&call_notifier
.lock
);
59 ret
= call_event_hooks(&call_notifier
.head
, event
, arg
, NULL
);
60 mutexlock_unlock(&call_notifier
.lock
);