1999-10-21 09:06:11 +00:00
|
|
|
.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
|
|
|
|
.\" All rights reserved.
|
2001-07-15 07:53:42 +00:00
|
|
|
.\"
|
1999-10-21 09:06:11 +00:00
|
|
|
.\" Subject to the following obligations and disclaimer of warranty, use and
|
|
|
|
.\" redistribution of this software, in source or object code forms, with or
|
|
|
|
.\" without modifications are expressly permitted by Whistle Communications;
|
|
|
|
.\" provided, however, that:
|
|
|
|
.\" 1. Any and all reproductions of the source or object code must include the
|
|
|
|
.\" copyright notice above and the following disclaimer of warranties; and
|
|
|
|
.\" 2. No rights are granted, in any manner or form, to use Whistle
|
|
|
|
.\" Communications, Inc. trademarks, including the mark "WHISTLE
|
|
|
|
.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
|
|
|
|
.\" such appears in the above copyright notice or in the software.
|
2001-07-15 07:53:42 +00:00
|
|
|
.\"
|
1999-10-21 09:06:11 +00:00
|
|
|
.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
|
|
|
|
.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
|
|
|
|
.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
|
|
|
|
.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
|
|
|
|
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
|
|
|
.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
|
|
|
|
.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
|
|
|
|
.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
|
|
|
|
.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
|
|
|
|
.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
|
|
|
|
.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
|
|
.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
|
|
|
|
.\" OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" Author: Archie Cobbs <archie@whistle.com>
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\" $Whistle: netgraph.3,v 1.7 1999/01/25 07:14:06 archie Exp $
|
|
|
|
.\"
|
2004-01-27 20:25:14 +00:00
|
|
|
.Dd January 27, 2004
|
1999-10-21 09:06:11 +00:00
|
|
|
.Dt NETGRAPH 3
|
2001-07-10 13:41:46 +00:00
|
|
|
.Os
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm NgMkSockNode ,
|
|
|
|
.Nm NgNameNode ,
|
|
|
|
.Nm NgSendMsg ,
|
2004-01-27 20:25:14 +00:00
|
|
|
.Nm NgSendAsciiMsg ,
|
|
|
|
.Nm NgSendMsgReply ,
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm NgRecvMsg ,
|
2004-01-27 20:25:14 +00:00
|
|
|
.Nm NgAllocRecvMsg ,
|
|
|
|
.Nm NgRecvAsciiMsg ,
|
|
|
|
.Nm NgAllocRecvAsciiMsg ,
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm NgSendData ,
|
|
|
|
.Nm NgRecvData ,
|
2004-01-27 20:25:14 +00:00
|
|
|
.Nm NgAllocRecvData ,
|
1999-10-21 09:06:11 +00:00
|
|
|
.Nm NgSetDebug ,
|
|
|
|
.Nm NgSetErrLog
|
1999-12-21 01:25:21 +00:00
|
|
|
.Nd netgraph user library
|
2000-04-22 16:12:13 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libnetgraph
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In netgraph.h
|
1999-10-21 09:06:11 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn NgMkSockNode "const char *name" "int *csp" "int *dsp"
|
|
|
|
.Ft int
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fn NgNameNode "int cs" "const char *path" "const char *fmt" ...
|
1999-10-21 09:06:11 +00:00
|
|
|
.Ft int
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fo NgSendMsg
|
|
|
|
.Fa "int cs" "const char *path" "int cookie" "int cmd" "const void *arg"
|
|
|
|
.Fa "size_t arglen"
|
|
|
|
.Fc
|
1999-10-21 09:06:11 +00:00
|
|
|
.Ft int
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fn NgSendAsciiMsg "int cs" "const char *path" "const char *fmt" ...
|
1999-11-30 02:45:32 +00:00
|
|
|
.Ft int
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fo NgSendMsgReply
|
|
|
|
.Fa "int cs" "const char *path" "struct ng_mesg *msg" "const void *arg"
|
|
|
|
.Fa "size_t arglen"
|
|
|
|
.Fc
|
1999-10-21 09:06:11 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn NgRecvMsg "int cs" "struct ng_mesg *rep" "size_t replen" "char *path"
|
|
|
|
.Ft int
|
2004-01-27 20:25:14 +00:00
|
|
|
.Fn NgAllocRecvMsg "int cs" "struct ng_mesg **rep" "char *path"
|
|
|
|
.Ft int
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgRecvAsciiMsg "int cs" "struct ng_mesg *rep" "size_t replen" "char *path"
|
|
|
|
.Ft int
|
2004-01-27 20:25:14 +00:00
|
|
|
.Fn NgAllocRecvAsciiMsg "int cs" "struct ng_mesg **rep" "char *path"
|
|
|
|
.Ft int
|
1999-10-21 09:06:11 +00:00
|
|
|
.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
|
2004-01-27 20:25:14 +00:00
|
|
|
.Fn NgAllocRecvData "int ds" "u_char **buf" "char *hook"
|
|
|
|
.Ft int
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSetDebug "int level"
|
|
|
|
.Ft void
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fo NgSetErrLog
|
|
|
|
.Fa "void \*[lp]*log\*[rp]\*[lp]const char *fmt, ...\*[rp]"
|
|
|
|
.Fa "void \*[lp]*logx\*[rp]\*[lp]const char *fmt, ...\*[rp]"
|
|
|
|
.Fc
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions facilitate user-mode program participation in the kernel
|
|
|
|
.Xr netgraph 4
|
|
|
|
graph-based networking system, by utilizing the netgraph
|
2004-01-27 19:24:53 +00:00
|
|
|
.Vt socket
|
1999-10-21 09:06:11 +00:00
|
|
|
node type (see
|
2001-06-05 12:40:03 +00:00
|
|
|
.Xr ng_socket 4 ) .
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgMkSockNode
|
2003-06-08 10:34:00 +00:00
|
|
|
function should be called first, to create a new
|
2004-01-27 19:24:53 +00:00
|
|
|
.Vt socket
|
|
|
|
type netgraph node with associated control and data sockets.
|
|
|
|
If
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fa name
|
2004-01-27 19:24:53 +00:00
|
|
|
is
|
|
|
|
.No non- Ns Dv NULL ,
|
|
|
|
the node will have that global name assigned to it.
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa csp
|
1999-10-21 09:06:11 +00:00
|
|
|
and
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa dsp
|
2003-06-08 10:34:00 +00:00
|
|
|
arguments will be set to the newly opened control and data sockets
|
1999-10-21 09:06:11 +00:00
|
|
|
associated with the node; either
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa csp
|
1999-10-21 09:06:11 +00:00
|
|
|
or
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa dsp
|
|
|
|
may be
|
|
|
|
.Dv NULL
|
|
|
|
if only one socket is desired.
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
2000-01-28 00:48:27 +00:00
|
|
|
.Fn NgMkSockNode
|
2004-01-27 19:24:53 +00:00
|
|
|
function loads the
|
|
|
|
.Vt socket
|
|
|
|
node type KLD if it is not already loaded.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgNameNode
|
2003-06-08 10:34:00 +00:00
|
|
|
function assigns a global name to the node addressed by
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fa path .
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSendMsg
|
2004-01-27 19:24:53 +00:00
|
|
|
function sends a binary control message from the
|
|
|
|
.Vt socket
|
|
|
|
node associated with control socket
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fa cs
|
|
|
|
to the node addressed by
|
|
|
|
.Fa path .
|
|
|
|
The
|
|
|
|
.Fa cookie
|
|
|
|
indicates how to interpret
|
|
|
|
.Fa cmd ,
|
|
|
|
which indicates a specific command.
|
|
|
|
Extra argument data (if any) is specified by
|
|
|
|
.Fa arg
|
|
|
|
and
|
|
|
|
.Fa arglen .
|
|
|
|
The
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa cookie , cmd ,
|
1999-10-21 09:06:11 +00:00
|
|
|
and argument data are defined by the header file corresponding
|
|
|
|
to the type of the node being addressed.
|
2000-06-21 23:01:07 +00:00
|
|
|
The unique, non-negative token value chosen for use in the message
|
2004-01-27 19:24:53 +00:00
|
|
|
header is returned.
|
|
|
|
This value is typically used to associate replies.
|
1999-10-21 09:06:11 +00:00
|
|
|
.Pp
|
|
|
|
Use
|
|
|
|
.Fn NgSendMsgReply
|
|
|
|
to send reply to a previously received control message.
|
|
|
|
The original message header should be pointed to by
|
|
|
|
.Fa msg .
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgSendAsciiMsg
|
2003-06-08 10:34:00 +00:00
|
|
|
function performs the same function as
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgSendMsg ,
|
1999-12-21 01:25:21 +00:00
|
|
|
but adds support for
|
|
|
|
.Tn ASCII
|
|
|
|
encoding of control messages.
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgSendAsciiMsg
|
2003-06-08 10:34:00 +00:00
|
|
|
function formats its input a la
|
1999-11-30 02:45:32 +00:00
|
|
|
.Xr printf 3
|
1999-12-21 01:25:21 +00:00
|
|
|
and then sends the resulting
|
|
|
|
.Tn ASCII
|
|
|
|
string to the node in a
|
1999-11-30 02:45:32 +00:00
|
|
|
.Dv NGM_ASCII2BINARY
|
2004-01-27 19:24:53 +00:00
|
|
|
control message.
|
|
|
|
The node returns a binary version of the
|
1999-11-30 02:45:32 +00:00
|
|
|
message, which is then sent back to the node just as with
|
|
|
|
.Fn NgSendMsg .
|
2000-06-21 23:01:07 +00:00
|
|
|
As with
|
|
|
|
.Fn NgSendMsg ,
|
|
|
|
the message token value is returned.
|
1999-12-21 01:25:21 +00:00
|
|
|
Note that
|
|
|
|
.Tn ASCII
|
|
|
|
conversion may not be supported by all node types.
|
1999-11-30 02:45:32 +00:00
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgRecvMsg
|
2003-06-08 10:34:00 +00:00
|
|
|
function reads the next control message received by the node associated with
|
1999-10-21 09:06:11 +00:00
|
|
|
control socket
|
|
|
|
.Fa cs .
|
|
|
|
The message and any extra argument data must fit in
|
|
|
|
.Fa replen
|
|
|
|
bytes.
|
|
|
|
If
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fa path
|
|
|
|
is
|
|
|
|
.No non- Ns Dv NULL ,
|
|
|
|
it must point to a buffer of at least
|
|
|
|
.Dv NG_PATHSIZ
|
|
|
|
bytes, which will be filled in (and
|
|
|
|
.Dv NUL
|
|
|
|
terminated) with the path to
|
1999-10-21 09:06:11 +00:00
|
|
|
the node from which the message was received.
|
|
|
|
.Pp
|
2001-08-24 14:52:05 +00:00
|
|
|
The length of the control message is returned.
|
|
|
|
A return value of zero indicates that the socket was closed.
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
2004-01-27 20:25:14 +00:00
|
|
|
.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
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgRecvAsciiMsg
|
2003-06-08 10:34:00 +00:00
|
|
|
function works exactly like
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgRecvMsg ,
|
|
|
|
except that after the message is received, any binary arguments
|
1999-12-21 01:25:21 +00:00
|
|
|
are converted to
|
|
|
|
.Tn ASCII
|
|
|
|
by sending a
|
1999-11-30 02:45:32 +00:00
|
|
|
.Dv NGM_BINARY2ASCII
|
2004-01-27 19:24:53 +00:00
|
|
|
request back to the originating node.
|
|
|
|
The result is the same as
|
1999-11-30 02:45:32 +00:00
|
|
|
.Fn NgRecvAsciiMsg ,
|
2004-01-27 19:24:53 +00:00
|
|
|
with the exception that the reply arguments field will contain a
|
|
|
|
.Dv NUL Ns -terminated
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
version of the arguments (and the reply
|
1999-11-30 02:45:32 +00:00
|
|
|
header argument length field will be adjusted).
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
2004-01-27 20:25:14 +00:00
|
|
|
.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
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSendData
|
2003-06-08 10:34:00 +00:00
|
|
|
function writes a data packet out on the specified hook of the node
|
|
|
|
corresponding to data socket
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fa ds .
|
|
|
|
The node must already be connected to some other node via that hook.
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgRecvData
|
2003-06-08 10:34:00 +00:00
|
|
|
function reads the next data packet (of up to
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fa len
|
|
|
|
bytes) received by the node corresponding to data socket
|
|
|
|
.Fa ds
|
|
|
|
and stores it in
|
|
|
|
.Fa buf ,
|
2004-01-27 19:24:53 +00:00
|
|
|
which must be large enough to hold the entire packet.
|
|
|
|
If
|
|
|
|
.Fa hook
|
|
|
|
is
|
|
|
|
.No non- Ns Dv NULL ,
|
|
|
|
it must point to a buffer of at least
|
|
|
|
.Dv NG_HOOKSIZ
|
|
|
|
bytes, which will be filled in (and
|
|
|
|
.Dv NUL
|
|
|
|
terminated) with the name of
|
1999-10-21 09:06:11 +00:00
|
|
|
the hook on which the data was received.
|
|
|
|
.Pp
|
2001-08-24 14:52:05 +00:00
|
|
|
The length of the packet is returned.
|
|
|
|
A return value of zero indicates that the socket was closed.
|
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
2004-01-27 20:25:14 +00:00
|
|
|
.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
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSetDebug
|
|
|
|
and
|
|
|
|
.Fn NgSetErrLog
|
2003-06-08 10:34:00 +00:00
|
|
|
functions are used for debugging.
|
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSetDebug
|
2003-06-08 10:34:00 +00:00
|
|
|
function sets the debug level (if non-negative), and returns the old setting.
|
2004-01-27 19:24:53 +00:00
|
|
|
Higher debug levels result in more verbosity.
|
|
|
|
The default is zero.
|
1999-10-21 09:06:11 +00:00
|
|
|
All debug and error messages are logged via the functions
|
|
|
|
specified in the most recent call to
|
|
|
|
.Fn NgSetErrLog .
|
|
|
|
The default logging functions are
|
|
|
|
.Xr vwarn 3
|
|
|
|
and
|
|
|
|
.Xr vwarnx 3 .
|
|
|
|
.Pp
|
1999-11-30 02:45:32 +00:00
|
|
|
At debug level 3, the library attempts to display control message arguments
|
1999-12-21 01:25:21 +00:00
|
|
|
in
|
|
|
|
.Tn ASCII
|
|
|
|
format; however, this results in additional messages being
|
2004-01-27 19:24:53 +00:00
|
|
|
sent which may interfere with debugging.
|
|
|
|
At even higher levels,
|
2002-12-27 12:15:40 +00:00
|
|
|
even these additional messages will be displayed, etc.
|
1999-11-30 02:45:32 +00:00
|
|
|
.Pp
|
1999-10-21 09:06:11 +00:00
|
|
|
Note that
|
|
|
|
.Xr select 2
|
|
|
|
can be used on the data and the control sockets to detect the presence of
|
|
|
|
incoming data and control messages, respectively.
|
|
|
|
Data and control packets are always written and read atomically, i.e.,
|
|
|
|
in one whole piece.
|
|
|
|
.Pp
|
|
|
|
User mode programs must be linked with the
|
2004-01-27 19:24:53 +00:00
|
|
|
.Fl l Ns Li netgraph
|
1999-10-21 09:06:11 +00:00
|
|
|
flag to link in this library.
|
|
|
|
.Sh INITIALIZATION
|
2004-01-27 19:24:53 +00:00
|
|
|
To enable netgraph in your kernel, either your kernel must be
|
1999-12-21 01:25:21 +00:00
|
|
|
compiled with
|
2004-01-27 19:24:53 +00:00
|
|
|
.Cd "options NETGRAPH"
|
1999-12-21 01:25:21 +00:00
|
|
|
in the kernel configuration
|
1999-11-30 02:45:32 +00:00
|
|
|
file, or else the
|
1999-10-21 09:06:11 +00:00
|
|
|
.Xr netgraph 4
|
|
|
|
and
|
2001-06-05 12:40:03 +00:00
|
|
|
.Xr ng_socket 4
|
1999-10-21 09:06:11 +00:00
|
|
|
KLD modules must have been loaded via
|
|
|
|
.Xr kldload 8 .
|
2001-08-24 21:39:27 +00:00
|
|
|
.Sh RETURN VALUES
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSetDebug
|
2003-06-08 10:34:00 +00:00
|
|
|
function returns the previous debug setting.
|
2004-01-27 19:24:53 +00:00
|
|
|
.Pp
|
2003-06-08 10:34:00 +00:00
|
|
|
The
|
1999-10-21 09:06:11 +00:00
|
|
|
.Fn NgSetErrLog
|
2003-06-08 10:34:00 +00:00
|
|
|
function has no return value.
|
2004-01-27 19:24:53 +00:00
|
|
|
.Pp
|
2001-08-27 08:01:01 +00:00
|
|
|
All other functions return \-1 if there was an error and set
|
|
|
|
.Va errno
|
2001-08-24 21:39:27 +00:00
|
|
|
accordingly.
|
2004-01-27 19:24:53 +00:00
|
|
|
.Pp
|
2001-08-24 21:39:27 +00:00
|
|
|
A return value of zero from
|
|
|
|
.Fn NgRecvMsg
|
|
|
|
or
|
|
|
|
.Fn NgRecvData
|
|
|
|
indicates that the netgraph socket has been closed.
|
1999-11-30 02:45:32 +00:00
|
|
|
.Pp
|
|
|
|
For
|
|
|
|
.Fn NgSendAsciiMsg
|
|
|
|
and
|
|
|
|
.Fn NgRecvAsciiMsg ,
|
|
|
|
the following additional errors are possible:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er ENOSYS
|
|
|
|
The node type does not know how to encode or decode the control message.
|
|
|
|
.It Bq Er ERANGE
|
|
|
|
The encoded or decoded arguments were too long for the supplied buffer.
|
|
|
|
.It Bq Er ENOENT
|
1999-12-21 01:25:21 +00:00
|
|
|
An unknown structure field was seen in an
|
|
|
|
.Tn ASCII
|
|
|
|
control message.
|
1999-11-30 02:45:32 +00:00
|
|
|
.It Bq Er EALREADY
|
1999-12-21 01:25:21 +00:00
|
|
|
The same structure field was specified twice in an
|
|
|
|
.Tn ASCII
|
|
|
|
control message.
|
1999-11-30 02:45:32 +00:00
|
|
|
.It Bq Er EINVAL
|
1999-12-21 01:25:21 +00:00
|
|
|
.Tn ASCII
|
|
|
|
control message parse error or illegal value.
|
1999-11-30 02:45:32 +00:00
|
|
|
.It Bq Er E2BIG
|
|
|
|
ASCII control message array or fixed width string buffer overflow.
|
|
|
|
.El
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr select 2 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr socket 2 ,
|
1999-10-21 09:06:11 +00:00
|
|
|
.Xr warnx 3 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr kld 4 ,
|
2000-05-04 17:40:13 +00:00
|
|
|
.Xr netgraph 4 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr ng_socket 4
|
1999-10-21 09:06:11 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1999-12-21 01:25:21 +00:00
|
|
|
.Nm netgraph
|
2004-07-02 23:52:20 +00:00
|
|
|
system was designed and first implemented at Whistle Communications, Inc.\& in
|
1999-12-21 01:25:21 +00:00
|
|
|
a version of
|
|
|
|
.Fx 2.2
|
|
|
|
customized for the Whistle InterJet.
|
|
|
|
.Sh AUTHORS
|
2004-01-27 19:24:53 +00:00
|
|
|
.An "Archie Cobbs" Aq archie@FreeBSD.org
|