.\" Copyright (c) 1999 Whistle Communications, Inc. .\" All rights reserved. .\" .\" 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. .\" .\" 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 .\" .\" $FreeBSD$ .\" .Dd November 15, 1999 .Dt NG_KSOCKET 8 .Os FreeBSD .Sh NAME .Nm ng_ksocket .Nd kernel socket netgraph node type .Sh SYNOPSIS .Fd #include .Sh DESCRIPTION A .Nm ksocket node is both a netgraph node and a BSD socket. The .Nm ksocket node type allows one to open a socket inside the kernel and have it appear as a Netgraph node. The .Nm ksocket node type is the reverse of the socket node type (see .Xr ng_socket 8 "):" whereas the socket node type enables the user-level manipulation (via a socket) of a kernel-level entity (the associated Netgraph node), the .Nm ksocket node type enables the kernel-level manipulation (via a Netgraph node) of a user-level entity (the associated socket). .Pp A .Nm ksocket node allows at most one hook connection. Connecting to the node is equivalent to opening the associated socket. The name given to the hook determines what kind of socket the node will act like (see below). When the hook is disconnected and/or the node is shutdown, the associated socket is closed. .Sh HOOKS This node type supports a single hook connection at a time. The name of the hook must be of the form .Dv Em // , where the .Dv Em family , .Dv Em type , and .Dv Em proto are the decimal equivalent of the same arguments to .Xr socket 2 . Alternately, aliases for the commonly used values are accepted as well. For example .Dv inet/dgram/udp is a more readable but equivalent version of .Dv 2/2/17 . .Sh CONTROL MESSAGES This node type supports the generic control messages, plus the following: .Bl -tag -width foo .It Dv NGM_KSOCKET_BIND This functions exactly like the .Xr bind 2 system call. The .Dv "struct sockaddr" socket address parameter should be supplied as an argument. .It Dv NGM_KSOCKET_LISTEN This functions exactly like the .Xr listen 2 system call. The backlog paramter (a single .Dv int ) should be supplied as an argument. .It Dv NGM_KSOCKET_CONNECT This functions exactly like the .Xr connect 2 system call. The .Dv "struct sockaddr" socket address parameter should be supplied as an argument. .It Dv NGM_KSOCKET_ACCEPT Currently unimplemented. .It Dv NGM_KSOCKET_GETNAME Currently unimplemented. .It Dv NGM_KSOCKET_GETPEERNAME Currently unimplemented. .It Dv NGM_KSOCKET_SETOPT Currently unimplemented. .It Dv NGM_KSOCKET_GETOPT Currently unimplemented. .El .Pp .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN control message, or when the hook is disconnected. Shutdown of the node closes the associated socket. .Sh SEE ALSO .Xr socket 2 , .Xr netgraph 4 , .Xr ng_socket 8 , .Xr ngctl 8 . .Sh AUTHOR Archie Cobbs