summaryrefslogtreecommitdiff
path: root/usr.sbin/dvmrpd/dvmrpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/dvmrpd/dvmrpd.h')
-rw-r--r--usr.sbin/dvmrpd/dvmrpd.h88
1 files changed, 11 insertions, 77 deletions
diff --git a/usr.sbin/dvmrpd/dvmrpd.h b/usr.sbin/dvmrpd/dvmrpd.h
index fd41c286f3a..7067c88e61d 100644
--- a/usr.sbin/dvmrpd/dvmrpd.h
+++ b/usr.sbin/dvmrpd/dvmrpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpd.h,v 1.17 2009/04/16 20:11:12 michele Exp $ */
+/* $OpenBSD: dvmrpd.h,v 1.18 2009/06/06 07:52:04 pyr Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -28,6 +28,8 @@
#include <netinet/in.h>
#include <event.h>
+#include "imsg.h"
+
#define CONF_FILE "/etc/dvmrpd.conf"
#define DVMRPD_SOCKET "/var/run/dvmrpd.sock"
#define DVMRPD_USER "_dvmrpd"
@@ -37,7 +39,6 @@
#define NBR_IDSELF 1
#define NBR_CNTSTART (NBR_IDSELF + 1)
-#define READ_BUF_SIZE 65535
#define RT_BUF_SIZE 16384
#define DVMRPD_FLAG_NO_FIB_UPDATE 0x0001
@@ -51,41 +52,12 @@
#define MAXVIFS 32 /* XXX */
-/* buffer */
-struct buf {
- TAILQ_ENTRY(buf) entry;
- u_char *buf;
- size_t size;
- size_t max;
- size_t wpos;
- size_t rpos;
- int fd;
-};
-
-struct msgbuf {
- u_int32_t queued;
- int fd;
- TAILQ_HEAD(, buf) bufs;
-};
-
-#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 imsgbuf {
- TAILQ_HEAD(, imsg_fd) fds;
- struct buf_read r;
- struct msgbuf w;
- struct event ev;
+struct imsgev {
+ struct imsgbuf ibuf;
void (*handler)(int, short, void *);
- int fd;
- pid_t pid;
- short events;
+ struct event ev;
+ void *data;
+ short events;
};
enum imsg_type {
@@ -118,23 +90,6 @@ enum imsg_type {
IMSG_FLASH_UPDATE_DS
};
-struct imsg_hdr {
- 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_fd {
- TAILQ_ENTRY(imsg_fd) entry;
- int fd;
-};
-
/* interface states */
#define IF_STA_DOWN 0x01
#define IF_STA_QUERIER 0x02
@@ -403,18 +358,6 @@ struct ctl_sum {
u_int32_t hold_time;
};
-/* 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 *);
-
/* dvmrpd.c */
void main_imsg_compose_dvmrpe(int, pid_t, void *, u_int16_t);
@@ -422,18 +365,9 @@ void main_imsg_compose_dvmrpe(int, pid_t, void *, u_int16_t);
struct dvmrpd_conf *parse_config(char *, int);
int cmdline_symset(char *);
-/* 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 */
+int imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, pid_t,
+ int, void *, u_int16_t);
+void imsg_event_add(struct imsgev *);
/* in_cksum.c */
u_int16_t in_cksum(void *, size_t);