1 .\" Copyright (c) 1999 Whistle Communications, Inc.
2 .\" All rights reserved.
4 .\" Subject to the following obligations and disclaimer of warranty, use and
5 .\" redistribution of this software, in source or object code forms, with or
6 .\" without modifications are expressly permitted by Whistle Communications;
7 .\" provided, however, that:
8 .\" 1. Any and all reproductions of the source or object code must include the
9 .\" copyright notice above and the following disclaimer of warranties; and
10 .\" 2. No rights are granted, in any manner or form, to use Whistle
11 .\" Communications, Inc. trademarks, including the mark "WHISTLE
12 .\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
13 .\" such appears in the above copyright notice or in the software.
15 .\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
16 .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
17 .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
18 .\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
20 .\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
21 .\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
22 .\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
23 .\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
24 .\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
25 .\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26 .\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
27 .\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
33 .\" Author: Archie Cobbs <archie@FreeBSD.org>
35 .\" $FreeBSD: src/share/man/man4/ng_ksocket.4,v 1.15.2.1 2001/12/21 09:00:51 ru Exp $
42 .Nd kernel socket netgraph node type
44 .In netgraph/ksocket/ng_ksocket.h
48 node is both a netgraph node and a
52 node type allows one to open a socket inside the kernel and have
53 it appear as a Netgraph node. The
55 node type is the reverse of the socket node type (see
57 whereas the socket node type enables the user-level manipulation (via
58 a socket) of what is normally a kernel-level entity (the associated
61 node type enables the kernel-level manipulation (via a Netgraph node) of
62 what is normally a user-level entity (the associated socket).
66 node allows at most one hook connection. Connecting to the node is
67 equivalent to opening the associated socket. The name given to the hook
68 determines what kind of socket the node will open (see below).
69 When the hook is disconnected and/or the node is shutdown, the
70 associated socket is closed.
72 This node type supports a single hook connection at a time.
73 The name of the hook must be of the form
74 .Em <family>/<type>/<proto> ,
80 are the decimal equivalent of the same arguments to
82 Alternately, aliases for the commonly used values are accepted as
85 is a more readable but equivalent version of
88 This node type supports the generic control messages, plus the following:
90 .It Dv NGM_KSOCKET_BIND
91 This functions exactly like the
95 socket address parameter should be supplied as an argument.
96 .It Dv NGM_KSOCKET_LISTEN
97 This functions exactly like the
99 system call. The backlog parameter (a single 32 bit
101 should be supplied as an argument.
102 .It Dv NGM_KSOCKET_CONNECT
103 This functions exactly like the
106 .Dv "struct sockaddr"
107 destination address parameter should be supplied as an argument.
108 .It Dv NGM_KSOCKET_ACCEPT
109 Currently unimplemented.
110 .It Dv NGM_KSOCKET_GETNAME
113 system call. The name is returned as a
114 .Dv "struct sockaddr"
115 in the arguments field of the reply.
116 .It Dv NGM_KSOCKET_GETPEERNAME
119 system call. The name is returned as a
120 .Dv "struct sockaddr"
121 in the arguments field of the reply.
122 .It Dv NGM_KSOCKET_SETOPT
125 system call, except that the option name, level, and value are passed in a
126 .Dv "struct ng_ksocket_sockopt" .
127 .It Dv NGM_KSOCKET_GETOPT
130 system call, except that the option is passed in a
131 .Dv "struct ng_ksocket_sockopt" .
132 When sending this command, the
134 field should be empty; upon return, it will contain the
137 .Sh ASCII FORM CONTROL MESSAGES
138 For control messages that pass a
139 .Dv "struct sockaddr"
140 in the argument field, the normal
142 equivalent of the C structure
143 is an acceptable form. For the
147 address families, a more convenient form is also used, which is
148 the protocol family name, followed by a slash, followed by the actual
151 the address is an IP address followed by an optional colon and port number.
154 the address is the pathname as a doubly quoted string.
157 .Bl -tag -width XXXXXXXXXX
159 local/"/tmp/foo.socket"
161 inet/192.168.1.1:1234
163 .Dv "\&{ family=16 len=16 data=[0x70 0x00 0x01 0x23] \&}"
166 For control messages that pass a
167 .Dv "struct ng_ksocket_sockopt" ,
170 form for that structure is used. In the future, more
171 convenient encoding of the more common socket options may be supported.
173 This node shuts down upon receipt of a
175 control message, or when the hook is disconnected.
176 Shutdown of the node closes the associated socket.
185 node type was implemented in
188 .An Archie Cobbs Aq Mt archie@FreeBSD.org