The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/modules/netgraph/ksocket/ng_ksocket.4

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

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

Cache object: d04aa13c4c85e86943f60cd21e8c2a6d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.