2 * transsip - the telephony toolkit
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>
5 * Subject to the GPL, version 2.
10 #include "call_notifier.h"
12 static struct event_head call_notifier
;
14 void init_call_notifier(void)
16 call_notifier
.head
= NULL
;
17 mutexlock_init(&call_notifier
.lock
);
20 int register_call_notifier(struct event_block
*block
)
24 mutexlock_lock(&call_notifier
.lock
);
25 ret
= register_event_hook(&call_notifier
.head
, block
);
26 mutexlock_unlock(&call_notifier
.lock
);
31 int register_call_notifier_once(struct event_block
*block
)
35 mutexlock_lock(&call_notifier
.lock
);
36 ret
= register_event_hook_once(&call_notifier
.head
, block
);
37 mutexlock_unlock(&call_notifier
.lock
);
42 int unregister_call_notifier(struct event_block
*block
)
46 mutexlock_lock(&call_notifier
.lock
);
47 ret
= unregister_event_hook(&call_notifier
.head
, block
);
48 mutexlock_unlock(&call_notifier
.lock
);
53 int call_notifier_exec(unsigned long event
, const void *arg
)
57 mutexlock_lock(&call_notifier
.lock
);
58 ret
= call_event_hooks(&call_notifier
.head
, event
, arg
, NULL
);
59 mutexlock_unlock(&call_notifier
.lock
);