diff options
| author | 2016-09-30 11:57:57 +0000 | |
|---|---|---|
| committer | 2016-09-30 11:57:57 +0000 | |
| commit | 5c0cb926a5ed35b0e9346c80e018c71f8041fd90 (patch) | |
| tree | 4770cd6a6b87abbb2633fbe76a357d33beb3a304 /usr.sbin/switchd/imsg_util.c | |
| parent | In ssh tests set REGRESS_FAIL_EARLY with ?= so that the environment (diff) | |
| download | wireguard-openbsd-5c0cb926a5ed35b0e9346c80e018c71f8041fd90.tar.xz wireguard-openbsd-5c0cb926a5ed35b0e9346c80e018c71f8041fd90.zip | |
Implement socket server code that properly handles async I/O, partial
messages, multiple messages per buffer and important things like
connection limits and file descriptor accounting. It works with TCP
connections as well as switch(4). The ofrelay.c part replaces
networking that was in ofp.c and will soon handle all socket
connections of switchd. It is called "ofrelay" because it will be
used as client, server, and forwarder.
OK rzalamena@
Diffstat (limited to 'usr.sbin/switchd/imsg_util.c')
| -rw-r--r-- | usr.sbin/switchd/imsg_util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/switchd/imsg_util.c b/usr.sbin/switchd/imsg_util.c index dccc01b8def..e7e79fdee1d 100644 --- a/usr.sbin/switchd/imsg_util.c +++ b/usr.sbin/switchd/imsg_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg_util.c,v 1.4 2016/09/29 17:03:00 reyk Exp $ */ +/* $OpenBSD: imsg_util.c,v 1.5 2016/09/30 11:57:57 reyk Exp $ */ /* * Copyright (c) 2010-2016 Reyk Floeter <reyk@openbsd.org> @@ -208,6 +208,15 @@ ibuf_setsize(struct ibuf *buf, size_t len) } int +ibuf_setmax(struct ibuf *buf, size_t len) +{ + if (len > buf->size) + return (-1); + buf->max = len; + return (0); +} + +int ibuf_prepend(struct ibuf *buf, void *data, size_t len) { struct ibuf *new; |
