7 struct comm_notify_entry {
10 LIST_ENTRY(comm_notify_entry) entry;
12 LIST_HEAD(comm_notify_list, comm_notify_entry) notify;
14 struct commcommon { /* must be first so that void* is comm_common* */
18 struct comm_notify_list notify;
19 struct buffer_if *rbuf;
22 void comm_request_notify(void *commst, void *nst, comm_notify_fn *fn);
23 void comm_release_notify(void *commst, void *nst, comm_notify_fn *fn);
25 bool_t comm_notify(struct comm_notify_list *notify, struct buffer_if *buf,
26 const struct comm_addr *ca);
27 /* Either: returns True, with message delivered and buffer freed.
28 * Or: False, if no-one wanted it - buffer still allocd'd.
29 * Ie, like comm_notify_fn. */
31 void comm_apply(struct commcommon *cc);
33 #define COMM_APPLY(st,cc,prefix,desc,loc) \
34 (st)=safe_malloc(sizeof(*(st)), desc "_apply"); \
36 (cc)->cl.description=desc; \
37 (cc)->ops.sendmsg=prefix##sendmsg; \
38 (cc)->ops.addr_to_string=prefix##addr_to_string; \
40 /* Expects in scope: prefix##sendmsg, prefix##addr_to_string. */
42 #define COMM_APPLY_STANDARD(st,cc,desc,args) \
43 item_t *item=list_elem(args,0); \
44 if (!item || item->type!=t_dict) { \
45 cfgfatal((cc)->loc,desc,"first argument must be a dictionary\n"); \
47 dict_t *d=item->data.dict; \
48 (cc)->rbuf=find_cl_if(d,"buffer",CL_BUFFER,True,desc,(cc)->loc)
50 #endif /*COMM_COMMON_H*/