diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-04 20:31:38 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-04 20:31:38 +0000 |
commit | 7a9cd2077212ecfa7fb84d9a02832dd294a495b4 (patch) | |
tree | bbc1641056c814e29f7c9cf22b613bbd488ecb7c /usr.sbin/relayd | |
parent | f8fe7f90a8871c57af9c617e615437811c8443b0 (diff) |
- move message types enum back to relayd.h
- use u_int16_t instead of enum imsg_type in imsg function prototypes
requested by reyk@, ok pyr@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r-- | usr.sbin/relayd/imsg.c | 8 | ||||
-rw-r--r-- | usr.sbin/relayd/imsg.h | 13 | ||||
-rw-r--r-- | usr.sbin/relayd/imsg_types.h | 75 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.h | 58 |
4 files changed, 65 insertions, 89 deletions
diff --git a/usr.sbin/relayd/imsg.c b/usr.sbin/relayd/imsg.c index 9e1a8792799..6109732c938 100644 --- a/usr.sbin/relayd/imsg.c +++ b/usr.sbin/relayd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.18 2009/06/04 18:34:33 eric Exp $ */ +/* $OpenBSD: imsg.c,v 1.19 2009/06/04 20:31:37 eric Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -130,7 +130,7 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) } int -imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid, +imsg_compose(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, pid_t pid, int fd, void *data, u_int16_t datalen) { struct buf *wbuf; @@ -151,7 +151,7 @@ imsg_compose(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid, } int -imsg_composev(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid, +imsg_composev(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, pid_t pid, int fd, const struct iovec *iov, int iovcnt) { struct buf *wbuf; @@ -178,7 +178,7 @@ imsg_composev(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid, /* ARGSUSED */ struct buf * -imsg_create(struct imsgbuf *ibuf, enum imsg_type type, u_int32_t peerid, +imsg_create(struct imsgbuf *ibuf, u_int16_t type, u_int32_t peerid, pid_t pid, u_int16_t datalen) { struct buf *wbuf; diff --git a/usr.sbin/relayd/imsg.h b/usr.sbin/relayd/imsg.h index b2a7c25424e..c3772fc107d 100644 --- a/usr.sbin/relayd/imsg.h +++ b/usr.sbin/relayd/imsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.h,v 1.1 2009/06/04 07:16:38 eric Exp $ */ +/* $OpenBSD: imsg.h,v 1.2 2009/06/04 20:31:37 eric Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -19,11 +19,8 @@ */ #include <sys/tree.h> - #include <event.h> -#include "imsg_types.h" - #define READ_BUF_SIZE 65535 #define IMSG_HEADER_SIZE sizeof(struct imsg_hdr) #define MAX_IMSGSIZE 8192 @@ -97,11 +94,11 @@ int msgbuf_write(struct msgbuf *); void imsg_init(struct imsgbuf *, int, void (*)(int, short, void *)); ssize_t imsg_read(struct imsgbuf *); ssize_t imsg_get(struct imsgbuf *, struct imsg *); -int imsg_compose(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t, +int imsg_compose(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, int, void *, u_int16_t); -int imsg_composev(struct imsgbuf *, enum imsg_type, u_int32_t, - pid_t, int, const struct iovec *, int); -struct buf *imsg_create(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t, +int imsg_composev(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, + int, const struct iovec *, int); +struct buf *imsg_create(struct imsgbuf *, u_int16_t, u_int32_t, pid_t, u_int16_t); int imsg_add(struct buf *, void *, u_int16_t); int imsg_close(struct imsgbuf *, struct buf *); diff --git a/usr.sbin/relayd/imsg_types.h b/usr.sbin/relayd/imsg_types.h deleted file mode 100644 index ced2cf0f954..00000000000 --- a/usr.sbin/relayd/imsg_types.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $OpenBSD: imsg_types.h,v 1.1 2009/06/04 07:16:38 eric Exp $ */ - -/* - * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> - * Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org> - * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -enum imsg_type { - IMSG_NONE, - IMSG_CTL_OK, /* answer to relayctl requests */ - IMSG_CTL_FAIL, - IMSG_CTL_END, - IMSG_CTL_RDR, - IMSG_CTL_TABLE, - IMSG_CTL_HOST, - IMSG_CTL_RELAY, - IMSG_CTL_SESSION, - IMSG_CTL_TABLE_CHANGED, - IMSG_CTL_PULL_RULESET, - IMSG_CTL_PUSH_RULESET, - IMSG_CTL_SHOW_SUM, /* relayctl requests */ - IMSG_CTL_RDR_ENABLE, - IMSG_CTL_RDR_DISABLE, - IMSG_CTL_TABLE_ENABLE, - IMSG_CTL_TABLE_DISABLE, - IMSG_CTL_HOST_ENABLE, - IMSG_CTL_HOST_DISABLE, - IMSG_CTL_SHUTDOWN, - IMSG_CTL_RELOAD, - IMSG_CTL_POLL, - IMSG_CTL_NOTIFY, - IMSG_CTL_RDR_STATS, - IMSG_CTL_RELAY_STATS, - IMSG_RDR_ENABLE, /* notifies from pfe to hce */ - IMSG_RDR_DISABLE, - IMSG_TABLE_ENABLE, - IMSG_TABLE_DISABLE, - IMSG_HOST_ENABLE, - IMSG_HOST_DISABLE, - IMSG_HOST_STATUS, /* notifies from hce to pfe */ - IMSG_SYNC, - IMSG_NATLOOK, - IMSG_DEMOTE, - IMSG_STATISTICS, - IMSG_RECONF, /* reconfiguration notifies */ - IMSG_RECONF_TABLE, - IMSG_RECONF_SENDBUF, - IMSG_RECONF_HOST, - IMSG_RECONF_RDR, - IMSG_RECONF_VIRT, - IMSG_RECONF_PROTO, - IMSG_RECONF_REQUEST_TREE, - IMSG_RECONF_RESPONSE_TREE, - IMSG_RECONF_PNODE_KEY, - IMSG_RECONF_PNODE_VAL, - IMSG_RECONF_RELAY, - IMSG_RECONF_END, - IMSG_SCRIPT, - IMSG_SNMPSOCK, - IMSG_BINDANY -}; diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 2d3d0025cf3..adefd929a21 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.121 2009/06/04 14:12:16 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.122 2009/06/04 20:31:37 eric Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -22,7 +22,6 @@ #include "imsg.h" - #define CONF_FILE "/etc/relayd.conf" #define RELAYD_SOCKET "/var/run/relayd.sock" #define PF_SOCKET "/dev/pf" @@ -645,6 +644,61 @@ struct ctl_conn { }; TAILQ_HEAD(ctl_connlist, ctl_conn); +enum imsg_type { + IMSG_NONE, + IMSG_CTL_OK, /* answer to relayctl requests */ + IMSG_CTL_FAIL, + IMSG_CTL_END, + IMSG_CTL_RDR, + IMSG_CTL_TABLE, + IMSG_CTL_HOST, + IMSG_CTL_RELAY, + IMSG_CTL_SESSION, + IMSG_CTL_TABLE_CHANGED, + IMSG_CTL_PULL_RULESET, + IMSG_CTL_PUSH_RULESET, + IMSG_CTL_SHOW_SUM, /* relayctl requests */ + IMSG_CTL_RDR_ENABLE, + IMSG_CTL_RDR_DISABLE, + IMSG_CTL_TABLE_ENABLE, + IMSG_CTL_TABLE_DISABLE, + IMSG_CTL_HOST_ENABLE, + IMSG_CTL_HOST_DISABLE, + IMSG_CTL_SHUTDOWN, + IMSG_CTL_RELOAD, + IMSG_CTL_POLL, + IMSG_CTL_NOTIFY, + IMSG_CTL_RDR_STATS, + IMSG_CTL_RELAY_STATS, + IMSG_RDR_ENABLE, /* notifies from pfe to hce */ + IMSG_RDR_DISABLE, + IMSG_TABLE_ENABLE, + IMSG_TABLE_DISABLE, + IMSG_HOST_ENABLE, + IMSG_HOST_DISABLE, + IMSG_HOST_STATUS, /* notifies from hce to pfe */ + IMSG_SYNC, + IMSG_NATLOOK, + IMSG_DEMOTE, + IMSG_STATISTICS, + IMSG_RECONF, /* reconfiguration notifies */ + IMSG_RECONF_TABLE, + IMSG_RECONF_SENDBUF, + IMSG_RECONF_HOST, + IMSG_RECONF_RDR, + IMSG_RECONF_VIRT, + IMSG_RECONF_PROTO, + IMSG_RECONF_REQUEST_TREE, + IMSG_RECONF_RESPONSE_TREE, + IMSG_RECONF_PNODE_KEY, + IMSG_RECONF_PNODE_VAL, + IMSG_RECONF_RELAY, + IMSG_RECONF_END, + IMSG_SCRIPT, + IMSG_SNMPSOCK, + IMSG_BINDANY +}; + /* control.c */ int control_init(void); int control_listen(struct relayd *, struct imsgbuf *, struct imsgbuf *); |