diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-06 09:02:47 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-06 09:02:47 +0000 |
commit | 43b3ccb7b66fe7ac8ef51712e09e4d04777fb3c0 (patch) | |
tree | f7a3ed200a44161068d03ed37714ff75bd226535 /usr.sbin/ospf6d/ospf6d.h | |
parent | 13bd723f39459bc3835159e553a7c494c498c93b (diff) |
make ospf6ctl/ospf6d imsg-in-a-lib ready too.
ospf6ctl is already broken in tree (not connected to build).
ok pyr@
Diffstat (limited to 'usr.sbin/ospf6d/ospf6d.h')
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.h | 83 |
1 files changed, 11 insertions, 72 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h index 7bb8bdc1cc7..0867478471b 100644 --- a/usr.sbin/ospf6d/ospf6d.h +++ b/usr.sbin/ospf6d/ospf6d.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.h,v 1.14 2009/01/28 22:47:36 stsp Exp $ */ +/* $OpenBSD: ospf6d.h,v 1.15 2009/06/06 09:02:46 eric Exp $ */ /* * Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org> @@ -29,6 +29,7 @@ #include <netinet/in.h> #include <event.h> +#include "imsg.h" #include "ospf6.h" #define CONF_FILE "/etc/ospf6d.conf" @@ -61,40 +62,12 @@ #define REDISTRIBUTE_ON 0x01 #define REDISTRIBUTE_DEFAULT 0x02 -/* buffer */ -struct buf { - 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; -}; - -#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 { @@ -150,18 +123,6 @@ enum imsg_type { IMSG_DEMOTE }; -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; -}; - /* area */ struct vertex; struct rde_nbr; @@ -532,18 +493,6 @@ void area_track(struct area *, int); int area_border_router(struct ospfd_conf *); u_int32_t area_ospf_options(struct area *); -/* 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 *); - /* carp.c */ int carp_demote_init(char *, int); void carp_demote_shutdown(void); @@ -554,19 +503,6 @@ int carp_demote_set(char *, int); struct ospfd_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 */ - /* interface.c */ int if_init(void); struct iface *if_find(unsigned int); @@ -613,11 +549,14 @@ u_int32_t rtlabel_id2tag(u_int16_t); u_int16_t rtlabel_tag2id(u_int32_t); void rtlabel_tag(u_int16_t, u_int32_t); -/* ospfd.c */ +/* ospf6d.c */ void main_imsg_compose_ospfe(int, pid_t, void *, u_int16_t); void main_imsg_compose_rde(int, pid_t, void *, u_int16_t); int ospf_redistribute(struct kroute *, u_int32_t *); void merge_config(struct ospfd_conf *, struct ospfd_conf *); +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); /* printconf.c */ void print_config(struct ospfd_conf *); |