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_core");
15 LIST_INSERT_HEAD(&st->notify, n, entry);
18 void comm_release_notify(void *commst, void *nst, comm_notify_fn *fn)
20 struct commcommon *st=commst;
21 struct comm_notify_entry *n, *t;
24 LIST_FOREACH_SAFE(n, &st->notify, entry, t) {
25 if (n->state==nst && n->fn==fn) {
26 LIST_REMOVE(n, entry);
32 bool_t comm_notify(struct comm_notify_list *notify,
33 struct buffer_if *buf, const struct comm_addr *ca)
35 struct comm_notify_entry *n;
37 LIST_FOREACH(n, notify, entry) {
38 if (n->fn(n->state, buf, ca)) {
45 void comm_apply(struct commcommon *cc)
49 cc->cl.interface=&cc->ops;
51 cc->ops.request_notify=comm_request_notify;
52 cc->ops.release_notify=comm_release_notify;
53 LIST_INIT(&cc->notify);