diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-06-05 23:39:52 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-06-05 23:39:52 +0000 |
commit | eec120ac35f33ddf2b90df426deaa4f48088b71d (patch) | |
tree | 39e95460b2f91d49890ed92bb5cd6dbb11f5eaf3 /usr.sbin/relayd/relayd.h | |
parent | 24d25743651001129029931c6fcb908bc43867fd (diff) |
4 handed diff with eric:
Stop pushing event handling in the imsg framework.
Instead, provide a small glue layer on top of both imsg and libevent.
This finally clearly separates event handling and imsg construction.
Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add
stub in relayctl.
This will make bgpd (and thus henning) happy. Next up are smtpd and ospfd.
ok eric@
Diffstat (limited to 'usr.sbin/relayd/relayd.h')
-rw-r--r-- | usr.sbin/relayd/relayd.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 5e2ee27b327..8de34988acd 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.124 2009/06/05 00:04:01 pyr Exp $ */ +/* $OpenBSD: relayd.h,v 1.125 2009/06/05 23:39:51 pyr Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -635,11 +635,19 @@ enum blockmodes { BM_NONBLOCK }; +struct imsgev { + struct imsgbuf ibuf; + void (*handler)(int, short, void *); + struct event ev; + void *data; + short events; +}; + struct ctl_conn { TAILQ_ENTRY(ctl_conn) entry; u_int8_t flags; #define CTL_CONN_NOTIFY 0x01 - struct imsgbuf ibuf; + struct imsgev iev; }; TAILQ_HEAD(ctl_connlist, ctl_conn); @@ -701,7 +709,7 @@ enum imsg_type { /* control.c */ int control_init(void); -int control_listen(struct relayd *, struct imsgbuf *, struct imsgbuf *); +int control_listen(struct relayd *, struct imsgev *, struct imsgev *); void control_accept(int, short, void *); void control_dispatch_imsg(int, short, void *); void control_imsg_forward(struct imsg *); @@ -830,8 +838,8 @@ int protonode_load(enum direction, struct protocol *, struct protonode *, const char *); int map6to4(struct sockaddr_storage *); int map4to6(struct sockaddr_storage *, struct sockaddr_storage *); -void imsg_event_add(struct imsgbuf *); -int imsg_compose_event(struct imsgbuf *, u_int16_t, u_int32_t, +void imsg_event_add(struct imsgev *); +int imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, pid_t, int, void *, u_int16_t); /* carp.c */ @@ -848,8 +856,8 @@ void pn_unref(u_int16_t); void pn_ref(u_int16_t); /* snmp.c */ -void snmp_init(struct relayd *, struct imsgbuf *); -int snmp_sendsock(struct imsgbuf *); +void snmp_init(struct relayd *, struct imsgev *); +int snmp_sendsock(struct imsgev *); void snmp_hosttrap(struct table *, struct host *); /* shuffle.c */ |