3 #include "comm-common.h"
5 void comm_request_notify(void *commst, void *nst, comm_notify_fn *fn)
7 struct commcommon *st=commst;
8 struct comm_notify_entry *n;
10 n=safe_malloc(sizeof(*n),"comm_request_notify");
13 LIST_INSERT_HEAD(&st->notify, n, entry);
16 void comm_release_notify(void *commst, void *nst, comm_notify_fn *fn)
18 struct commcommon *st=commst;
19 struct comm_notify_entry *n, *t;
22 LIST_FOREACH_SAFE(n, &st->notify, entry, t) {
23 if (n->state==nst && n->fn==fn) {
24 LIST_REMOVE(n, entry);
30 bool_t comm_notify(struct comm_notify_list *notify,
31 struct buffer_if *buf, const struct comm_addr *ca)
33 struct comm_notify_entry *n;
35 LIST_FOREACH(n, notify, entry) {
36 if (n->fn(n->state, buf, ca)) {
43 void comm_apply(struct commcommon *cc, void *st)
48 cc->cl.interface=&cc->ops;
50 cc->ops.request_notify=comm_request_notify;
51 cc->ops.release_notify=comm_release_notify;
52 LIST_INIT(&cc->notify);