iwm: Fix S:N reporting in ifconfig(8)
[dragonfly.git] / share / man / man4 / ng_ksocket.4
CommitLineData
984263bc
MD
1.\" Copyright (c) 1999 Whistle Communications, Inc.
2.\" All rights reserved.
3.\"
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.
14.\"
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
31.\" OF SUCH DAMAGE.
32.\"
33.\" Author: Archie Cobbs <archie@FreeBSD.org>
34.\"
35.\" $FreeBSD: src/share/man/man4/ng_ksocket.4,v 1.15.2.1 2001/12/21 09:00:51 ru Exp $
36.\"
37.Dd November 15, 1999
38.Dt NG_KSOCKET 4
39.Os
40.Sh NAME
41.Nm ng_ksocket
42.Nd kernel socket netgraph node type
43.Sh SYNOPSIS
44cb301e 44.In netgraph/ksocket/ng_ksocket.h
984263bc
MD
45.Sh DESCRIPTION
46A
47.Nm ksocket
48node is both a netgraph node and a
49.Bx
50socket. The
51.Nm
52node type allows one to open a socket inside the kernel and have
53it appear as a Netgraph node. The
54.Nm
55node type is the reverse of the socket node type (see
56.Xr ng_socket 4 ) :
57whereas the socket node type enables the user-level manipulation (via
58a socket) of what is normally a kernel-level entity (the associated
59Netgraph node), the
60.Nm
61node type enables the kernel-level manipulation (via a Netgraph node) of
62what is normally a user-level entity (the associated socket).
63.Pp
64A
65.Nm
66node allows at most one hook connection. Connecting to the node is
67equivalent to opening the associated socket. The name given to the hook
68determines what kind of socket the node will open (see below).
69When the hook is disconnected and/or the node is shutdown, the
70associated socket is closed.
71.Sh HOOKS
72This node type supports a single hook connection at a time.
73The name of the hook must be of the form
74.Em <family>/<type>/<proto> ,
75where the
76.Em family ,
77.Em type ,
78and
79.Em proto
80are the decimal equivalent of the same arguments to
81.Xr socket 2 .
82Alternately, aliases for the commonly used values are accepted as
83well. For example
84.Dv inet/dgram/udp
85is a more readable but equivalent version of
86.Dv 2/2/17 .
87.Sh CONTROL MESSAGES
88This node type supports the generic control messages, plus the following:
89.Bl -tag -width foo
90.It Dv NGM_KSOCKET_BIND
91This functions exactly like the
92.Xr bind 2
93system call. The
94.Dv "struct sockaddr"
95socket address parameter should be supplied as an argument.
96.It Dv NGM_KSOCKET_LISTEN
97This functions exactly like the
98.Xr listen 2
3221afbe 99system call. The backlog parameter (a single 32 bit
984263bc
MD
100.Dv int )
101should be supplied as an argument.
102.It Dv NGM_KSOCKET_CONNECT
103This functions exactly like the
104.Xr connect 2
105system call. The
106.Dv "struct sockaddr"
107destination address parameter should be supplied as an argument.
108.It Dv NGM_KSOCKET_ACCEPT
109Currently unimplemented.
110.It Dv NGM_KSOCKET_GETNAME
111Equivalent to the
112.Xr getsockname 2
113system call. The name is returned as a
114.Dv "struct sockaddr"
115in the arguments field of the reply.
116.It Dv NGM_KSOCKET_GETPEERNAME
117Equivalent to the
118.Xr getpeername 2
119system call. The name is returned as a
120.Dv "struct sockaddr"
121in the arguments field of the reply.
122.It Dv NGM_KSOCKET_SETOPT
123Equivalent to the
124.Xr setsockopt 2
125system 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
128Equivalent to the
129.Xr getsockopt 2
130system call, except that the option is passed in a
131.Dv "struct ng_ksocket_sockopt" .
132When sending this command, the
133.Dv value
134field should be empty; upon return, it will contain the
135retrieved value.
136.El
137.Sh ASCII FORM CONTROL MESSAGES
138For control messages that pass a
139.Dv "struct sockaddr"
140in the argument field, the normal
141.Tn ASCII
142equivalent of the C structure
143is an acceptable form. For the
144.Dv PF_INET
145and
146.Dv PF_LOCAL
147address families, a more convenient form is also used, which is
148the protocol family name, followed by a slash, followed by the actual
149address. For
150.Dv PF_INET ,
151the address is an IP address followed by an optional colon and port number.
152For
153.Dv PF_LOCAL ,
154the address is the pathname as a doubly quoted string.
155.Pp
156Examples:
157.Bl -tag -width XXXXXXXXXX
158.It Dv PF_LOCAL
159local/"/tmp/foo.socket"
160.It Dv PF_INET
161inet/192.168.1.1:1234
162.It Other
163.Dv "\&{ family=16 len=16 data=[0x70 0x00 0x01 0x23] \&}"
164.El
165.Pp
166For control messages that pass a
167.Dv "struct ng_ksocket_sockopt" ,
168the normal
169.Tn ASCII
170form for that structure is used. In the future, more
171convenient encoding of the more common socket options may be supported.
172.Sh SHUTDOWN
173This node shuts down upon receipt of a
174.Dv NGM_SHUTDOWN
175control message, or when the hook is disconnected.
176Shutdown of the node closes the associated socket.
177.Sh SEE ALSO
178.Xr socket 2 ,
179.Xr netgraph 4 ,
180.Xr ng_socket 4 ,
181.Xr ngctl 8
182.Sh HISTORY
183The
184.Nm
185node type was implemented in
186.Fx 4.0 .
187.Sh AUTHORS
b2a6f486 188.An Archie Cobbs Aq Mt archie@FreeBSD.org