summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated/hoststated.h
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2006-12-16 12:42:15 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2006-12-16 12:42:15 +0000
commit474330739d2effcf5f82056b412155be23b391fb (patch)
tree940e84afeb89de17ab45e525e29ed18e852e43fd /usr.sbin/hoststated/hoststated.h
parent9fa0416a4ea8f7c2ebae2f738ee534787b8d0e48 (diff)
knf, spacing
please note that some editors will replace tabs with multiple spaces if you cut & paste code from other sections. please try to keep the tabs ;).
Diffstat (limited to 'usr.sbin/hoststated/hoststated.h')
-rw-r--r--usr.sbin/hoststated/hoststated.h173
1 files changed, 88 insertions, 85 deletions
diff --git a/usr.sbin/hoststated/hoststated.h b/usr.sbin/hoststated/hoststated.h
index d59a934be48..0191df4100c 100644
--- a/usr.sbin/hoststated/hoststated.h
+++ b/usr.sbin/hoststated/hoststated.h
@@ -32,38 +32,38 @@
/* buffer */
struct buf {
- TAILQ_ENTRY(buf) entry;
- u_char *buf;
- size_t size;
- size_t max;
- size_t wpos;
- size_t rpos;
+ TAILQ_ENTRY(buf) entry;
+ u_char *buf;
+ size_t size;
+ size_t max;
+ size_t wpos;
+ size_t rpos;
};
struct msgbuf {
- TAILQ_HEAD(, buf) bufs;
- u_int32_t queued;
- int fd;
+ TAILQ_HEAD(, buf) bufs;
+ u_int32_t queued;
+ int fd;
};
-#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
-#define MAX_IMSGSIZE 8192
+#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
+#define MAX_IMSGSIZE 8192
-struct buf_read {
- u_char buf[READ_BUF_SIZE];
- u_char *rptr;
- size_t wpos;
+struct buf_read {
+ u_char buf[READ_BUF_SIZE];
+ u_char *rptr;
+ size_t wpos;
};
struct imsgbuf {
- TAILQ_HEAD(, imsg_fd) fds;
- struct buf_read r;
- struct msgbuf w;
- struct event ev;
- void (*handler)(int, short, void *);
- int fd;
- pid_t pid;
- short events;
+ TAILQ_HEAD(, imsg_fd) fds;
+ struct buf_read r;
+ struct msgbuf w;
+ struct event ev;
+ void (*handler)(int, short, void *);
+ int fd;
+ pid_t pid;
+ short events;
};
enum imsg_type {
@@ -95,18 +95,18 @@ enum imsg_type {
};
struct imsg_hdr {
- enum imsg_type type;
- u_int16_t len;
- u_int32_t peerid;
- pid_t pid;
+ enum imsg_type type;
+ u_int16_t len;
+ u_int32_t peerid;
+ pid_t pid;
};
struct imsg {
- struct imsg_hdr hdr;
- void *data;
+ struct imsg_hdr hdr;
+ void *data;
};
-typedef u_int32_t objid_t;
+typedef u_int32_t objid_t;
struct ctl_status {
objid_t id;
@@ -121,14 +121,14 @@ struct address {
};
TAILQ_HEAD(addresslist, address);
-#define F_DISABLE 0x01
-#define F_BACKUP 0x02
-#define F_USED 0x04
-#define F_ACTIVE_RULESET 0x04
-#define F_DOWN 0x08
-#define F_ADD 0x10
-#define F_DEL 0x20
-#define F_CHANGED 0x40
+#define F_DISABLE 0x01
+#define F_BACKUP 0x02
+#define F_USED 0x04
+#define F_ACTIVE_RULESET 0x04
+#define F_DOWN 0x08
+#define F_ADD 0x10
+#define F_DEL 0x20
+#define F_CHANGED 0x40
struct host {
u_int8_t flags;
@@ -137,27 +137,23 @@ struct host {
char *tablename;
char name[MAXHOSTNAMELEN];
int up;
-#define HOST_DOWN -1
-#define HOST_UNKNOWN 0
-#define HOST_UP 1
struct sockaddr_storage ss;
TAILQ_ENTRY(host) entry;
};
TAILQ_HEAD(hostlist, host);
+#define HOST_DOWN -1
+#define HOST_UNKNOWN 0
+#define HOST_UP 1
+
struct table {
objid_t id;
objid_t serviceid;
u_int8_t flags;
int check;
-#define CHECK_NOCHECK 0
-#define CHECK_ICMP 1
-#define CHECK_TCP 2
-#define CHECK_HTTP_CODE 3
-#define CHECK_HTTP_DIGEST 4
int up;
in_port_t port;
- int retcode;
+ int retcode;
int timeout;
char name[TABLE_NAME_SIZE];
char path[MAXPATHLEN];
@@ -167,6 +163,12 @@ struct table {
};
TAILQ_HEAD(tablelist, table);
+#define CHECK_NOCHECK 0
+#define CHECK_ICMP 1
+#define CHECK_TCP 2
+#define CHECK_HTTP_CODE 3
+#define CHECK_HTTP_DIGEST 4
+
struct service {
objid_t id;
u_int8_t flags;
@@ -187,9 +189,7 @@ enum {
} hostated_process;
struct hostated {
- u_int8_t opts;
-#define HOSTATED_OPT_VERBOSE 0x01
-#define HOSTATED_OPT_NOACTION 0x04
+ u_int8_t opts;
struct pfdata *pf;
int interval;
int icmp_sock;
@@ -202,20 +202,23 @@ struct hostated {
struct servicelist services;
};
+#define HOSTATED_OPT_VERBOSE 0x01
+#define HOSTATED_OPT_NOACTION 0x04
+
/* initially control.h */
struct {
- struct event ev;
- int fd;
+ struct event ev;
+ int fd;
} control_state;
enum blockmodes {
- BM_NORMAL,
- BM_NONBLOCK
+ BM_NORMAL,
+ BM_NONBLOCK
};
struct ctl_conn {
- TAILQ_ENTRY(ctl_conn) entry;
- struct imsgbuf ibuf;
+ TAILQ_ENTRY(ctl_conn) entry;
+ struct imsgbuf ibuf;
};
TAILQ_HEAD(ctl_connlist, ctl_conn);
@@ -233,41 +236,41 @@ void session_socket_blockmode(int, enum blockmodes);
extern struct ctl_connlist ctl_conns;
/* parse.y */
-int parse_config(struct hostated *, const char *, int);
+int parse_config(struct hostated *, const char *, int);
/* log.c */
-void log_init(int);
-void log_warn(const char *, ...);
-void log_warnx(const char *, ...);
-void log_info(const char *, ...);
-void log_debug(const char *, ...);
-void fatal(const char *);
-void fatalx(const char *);
+void log_init(int);
+void log_warn(const char *, ...);
+void log_warnx(const char *, ...);
+void log_info(const char *, ...);
+void log_debug(const char *, ...);
+void fatal(const char *);
+void fatalx(const char *);
/* buffer.c */
-struct buf *buf_open(size_t);
-struct buf *buf_dynamic(size_t, size_t);
-int buf_add(struct buf *, void *, size_t);
-void *buf_reserve(struct buf *, size_t);
-void *buf_seek(struct buf *, size_t, size_t);
-int buf_close(struct msgbuf *, struct buf *);
-void buf_free(struct buf *);
-void msgbuf_init(struct msgbuf *);
-void msgbuf_clear(struct msgbuf *);
-int msgbuf_write(struct msgbuf *);
+struct buf *buf_open(size_t);
+struct buf *buf_dynamic(size_t, size_t);
+int buf_add(struct buf *, void *, size_t);
+void *buf_reserve(struct buf *, size_t);
+void *buf_seek(struct buf *, size_t, size_t);
+int buf_close(struct msgbuf *, struct buf *);
+void buf_free(struct buf *);
+void msgbuf_init(struct msgbuf *);
+void msgbuf_clear(struct msgbuf *);
+int msgbuf_write(struct msgbuf *);
/* imsg.c */
-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,
- void *, u_int16_t);
-struct buf *imsg_create(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t,
- u_int16_t);
-int imsg_add(struct buf *, void *, u_int16_t);
-int imsg_close(struct imsgbuf *, struct buf *);
-void imsg_free(struct imsg *);
-void imsg_event_add(struct imsgbuf *); /* needs to be provided externally */
+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,
+ void *, u_int16_t);
+struct buf *imsg_create(struct imsgbuf *, enum imsg_type, u_int32_t, pid_t,
+ u_int16_t);
+int imsg_add(struct buf *, void *, u_int16_t);
+int imsg_close(struct imsgbuf *, struct buf *);
+void imsg_free(struct imsg *);
+void imsg_event_add(struct imsgbuf *); /* needs to be provided externally */
/* pfe.c */
pid_t pfe(struct hostated *, int [2], int [2], int [2]);