diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-01 21:25:19 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-01 21:25:19 +0000 |
commit | 11750cd51d0158acbff6eca77fe6350328f2f744 (patch) | |
tree | 644f3c9052d67220d38f6cdf5f9481fc3a7031b7 /usr.sbin/ospfd/ospfd.h | |
parent | fbfc7897c23382d51bf9270c5986ea78fc80b41e (diff) |
Introduce dynmaic buffers. Dynamic buffers are realloced() until max is
hit. This makes it possible to alloc a buffer based on the max packet size
and filling it up slowly till the packet is finished or *sigh* an overflow
is detected. While doing that switch most sizes from ssize_t to the unsigned
size_t as this makes more sense. The ssize_t -> size_t change is mostly from
henning@
Diffstat (limited to 'usr.sbin/ospfd/ospfd.h')
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index 43ee8980c8c..9c284c02533 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.2 2005/01/28 17:53:33 norby Exp $ */ +/* $OpenBSD: ospfd.h,v 1.3 2005/02/01 21:25:18 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -55,9 +55,10 @@ struct buf { TAILQ_ENTRY(buf) entry; u_char *buf; - ssize_t size; - ssize_t wpos; - ssize_t rpos; + size_t size; + size_t max; + size_t wpos; + size_t rpos; int fd; }; @@ -362,9 +363,10 @@ int area_del(struct area *); struct area *area_find(struct ospfd_conf *, struct in_addr); /* buffer.c */ -struct buf *buf_open(ssize_t); -int buf_add(struct buf *, void *, ssize_t); -void *buf_reserve(struct buf *, ssize_t); +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); int buf_close(struct msgbuf *, struct buf *); int buf_write(int, struct buf *); void buf_free(struct buf *); |