summaryrefslogtreecommitdiffstats
path: root/lib/libnetgraph/netgraph.3
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-01-27 20:25:14 +0000
committerru <ru@FreeBSD.org>2004-01-27 20:25:14 +0000
commitadc82a1e80759afba2cfae432d4ee1ca190be1f4 (patch)
tree92ee6204e54cff03c751ded7b2d193159acbf5f2 /lib/libnetgraph/netgraph.3
parentf24f6452fe6f2143c7c182fae610d62cfa8994b8 (diff)
downloadFreeBSD-src-adc82a1e80759afba2cfae432d4ee1ca190be1f4.zip
FreeBSD-src-adc82a1e80759afba2cfae432d4ee1ca190be1f4.tar.gz
- Added three new interfaces, NgAllocRecvMsg(), NgAllocRecvAsciiMsg(),
and NgAllocRecvData(), that dynamically allocate buffer for a binary message, an ascii message, and a data packet, respectively. The size of the allocated buffer is equal to the socket's receive buffer size to guarantee that a message or a data packet is not truncated. - Get rid of the static size buffer in NgSendAsciiMsg(). OK'ed by: archie, julian
Diffstat (limited to 'lib/libnetgraph/netgraph.3')
-rw-r--r--lib/libnetgraph/netgraph.341
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/libnetgraph/netgraph.3 b/lib/libnetgraph/netgraph.3
index 8520170..108775e 100644
--- a/lib/libnetgraph/netgraph.3
+++ b/lib/libnetgraph/netgraph.3
@@ -35,16 +35,22 @@
.\" $FreeBSD$
.\" $Whistle: netgraph.3,v 1.7 1999/01/25 07:14:06 archie Exp $
.\"
-.Dd January 19, 1999
+.Dd January 27, 2004
.Dt NETGRAPH 3
.Os
.Sh NAME
.Nm NgMkSockNode ,
.Nm NgNameNode ,
.Nm NgSendMsg ,
+.Nm NgSendAsciiMsg ,
+.Nm NgSendMsgReply ,
.Nm NgRecvMsg ,
+.Nm NgAllocRecvMsg ,
+.Nm NgRecvAsciiMsg ,
+.Nm NgAllocRecvAsciiMsg ,
.Nm NgSendData ,
.Nm NgRecvData ,
+.Nm NgAllocRecvData ,
.Nm NgSetDebug ,
.Nm NgSetErrLog
.Nd netgraph user library
@@ -71,12 +77,18 @@
.Ft int
.Fn NgRecvMsg "int cs" "struct ng_mesg *rep" "size_t replen" "char *path"
.Ft int
+.Fn NgAllocRecvMsg "int cs" "struct ng_mesg **rep" "char *path"
+.Ft int
.Fn NgRecvAsciiMsg "int cs" "struct ng_mesg *rep" "size_t replen" "char *path"
.Ft int
+.Fn NgAllocRecvAsciiMsg "int cs" "struct ng_mesg **rep" "char *path"
+.Ft int
.Fn NgSendData "int ds" "const char *hook" "const u_char *buf" "size_t len"
.Ft int
.Fn NgRecvData "int ds" "u_char *buf" "size_t len" "char *hook"
.Ft int
+.Fn NgAllocRecvData "int ds" "u_char **buf" "char *hook"
+.Ft int
.Fn NgSetDebug "int level"
.Ft void
.Fo NgSetErrLog
@@ -204,6 +216,15 @@ The length of the control message is returned.
A return value of zero indicates that the socket was closed.
.Pp
The
+.Fn NgAllocRecvMsg
+function works exactly like
+.Fn NgRecvMsg ,
+except that the buffer for a message is dynamically allocated
+to guarantee that a message is not truncated.
+The size of the buffer is equal to the socket's receive buffer size.
+The caller is responsible for freeing the buffer when it is no longer required.
+.Pp
+The
.Fn NgRecvAsciiMsg
function works exactly like
.Fn NgRecvMsg ,
@@ -222,6 +243,15 @@ version of the arguments (and the reply
header argument length field will be adjusted).
.Pp
The
+.Fn NgAllocRecvAsciiMsg
+function works exactly like
+.Fn NgRecvAsciiMsg ,
+except that the buffer for a message is dynamically allocated
+to guarantee that a message is not truncated.
+The size of the buffer is equal to the socket's receive buffer size.
+The caller is responsible for freeing the buffer when it is no longer required.
+.Pp
+The
.Fn NgSendData
function writes a data packet out on the specified hook of the node
corresponding to data socket
@@ -252,6 +282,15 @@ The length of the packet is returned.
A return value of zero indicates that the socket was closed.
.Pp
The
+.Fn NgAllocRecvData
+function works exactly like
+.Fn NgRecvData ,
+except that the buffer for a data packet is dynamically allocated
+to guarantee that a data packet is not truncated.
+The size of the buffer is equal to the socket's receive buffer size.
+The caller is responsible for freeing the buffer when it is no longer required.
+.Pp
+The
.Fn NgSetDebug
and
.Fn NgSetErrLog
OpenPOWER on IntegriCloud