From owner-man-jp-reviewer@jp.freebsd.org  Sat Dec 25 09:57:56 1999
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id JAA58769;
	Sat, 25 Dec 1999 09:57:56 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from serio.al.rim.or.jp (serio.al.rim.or.jp [202.247.191.251] (may be forged))
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id JAA58764
	for <man-jp-reviewer@jp.freebsd.org>; Sat, 25 Dec 1999 09:57:55 +0900 (JST)
	(envelope-from kuma@nk.rim.or.jp)
Received: from mail-relay.rim.or.jp by serio.al.rim.or.jp (8.8.8/3.7W/HMX-12) with ESMTP id JAA11644 for <man-jp-reviewer@jp.freebsd.org>; Sat, 25 Dec 1999 09:57:55 +0900 (JST)
Received: from laurel.nk.rim.or.jp (JYOcd-01p48.ppp.odn.ad.jp [210.252.246.48]) by mail-relay.rim.or.jp (3.7W/HMX-12) id JAA14462 for <man-jp-reviewer@jp.freebsd.org>; Sat, 25 Dec 1999 09:57:51 +0900 (JST)
Received: from oasis.laurel.nk.rim.or.jp by laurel.nk.rim.or.jp (8.9.3/8.9.3oasis991011) with ESMTP id JAA15919
	for <man-jp-reviewer@jp.freebsd.org>; Sat, 25 Dec 1999 09:58:07 +0900 (JST)
Message-Id: <199912250058.JAA15919@laurel.nk.rim.or.jp>
To: man-jp-reviewer@jp.freebsd.org
Date: Sat, 25 Dec 1999 09:58:07 +0900
From: Norihiro Kumagai <kuma@nk.rim.or.jp>
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: man-jp-reviewer 1852
Subject: [man-jp-reviewer 1852] ng_socket.8
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: kuma@nk.rim.or.jp

$B7'C+$G$9!#(B

ng_socket.8 $B$N=iLu$G$9!#(B
$B=Q8l$N07$$$G$9$,!"(B
  netgraph	netgraph ($BLu$5$:$=$N$^$^(B)
  node		$B%N!<%I(B
  hook		$B%U%C%/(B
$B$H$$$&46$8$G$d$C$F$_$^$7$?!#B>$N$_$J$5$s$O$I$&$7$F$^$9$+!)(B
$B$"$o$;$i$l$=$&$J$i$"$o$;$F$_$h$&$+$H;W$&$N$G$9$,!#(B

--
$B7'C+(B $BE5Bg(B

--- ng_socket.8-org	Sun Dec 19 23:22:59 1999
+++ ng_socket.8	Sat Dec 25 09:52:50 1999
@@ -39,136 +39,152 @@
 .\" jpman %Id: ng_socket.8,v 0.0 1999/11/28 13:24:13 horikawa Stab %
 .Dt NG_SOCKET 8
 .Os FreeBSD 4.0
-.Sh NAME
+.Sh $BL>>N(B
 .Nm ng_socket
 .Nd netgraph socket node type
-.Sh SYNOPSIS
+.Sh $B=q<0(B
 .Fd #include <netgraph/ng_message.h>
 .Fd #include <netgraph/ng_socket.h>
-.Sh DESCRIPTION
-A
+.Sh $B2r@b(B
 .Nm socket
-node is both a BSD socket and a netgraph node.  The
+$B%N!<%I$K$O!"(BBSD $B%=%1%C%H$H(B netgraph $B%N!<%I$NN>J}$,$"$j$^$9!#(B
+$B%N!<%I7?(B
 .Nm socket
-node type allows user-mode processes to participate in the kernel
+$B$K$h$C$F!"%f!<%6%b!<%I%W%m%;%9$,!"(BBSD $B%=%1%C%H%$%s%?%U%'!<%9$rMQ$$$F(B
+$B%+!<%M%kCf$N(B
 .Xr netgraph 4
-networking subsystem using the BSD socket interface. The process must have
-root privileges to be able to create netgraph sockets however once created,
-any process that has one may use it.
+$B%M%C%H%o!<%/%5%V%7%9%F%`$K4XM?$9$k$3$H$,$G$-$^$9!#(B
+$B$$$:$l$+$N%W%m%;%9$,4{$K(B netgraph $B%=%1%C%H$r@8@.$7!"(B
+$B$=$l$,;H$($k>uBV$K$"$k$H$7$F$b!"(Bnetgraph $B%=%1%C%H$r@8@.$G$-$k$h$&$K(B
+$B$9$k$?$a$K$O!"$=$N%W%m%;%9$,%k!<%HFC8"$r;}$DI,MW$,$"$j$^$9!#(B
 .Pp
-A new
+$B?7$7$$(B
 .Nm socket
-node is created by creating a new socket of type
-.Dv NG_CONTROL
-in the protocol family
-.Dv PF_NETGRAPH ,
-using the
+$B%N!<%I$r@8@.$9$k$K$O!"(B
 .Xr socket 2
-system call.
-Any control messages received by the node 
-and not having a cookie value of 
+$B%7%9%F%`%3!<%k$rMQ$$$F!"(B
+$B%W%m%H%3%k%U%!%_%j(B
+.Dv PF_NETGRAPH
+$B$KB0$9$k(B
+.Dv NG_CONTROL
+$B7?$N%=%1%C%H$r?7$?$K@8@.$7$^$9!#(B
+$B$3$N%N!<%I$K$h$j<u?.$5$l!"%/%C%-!<$NCM$H$7$F(B
 .Dv NGM_SOCKET_COOKIE
-are received  by the process, using
-.Xr recvfrom 2 ;
-the socket address argument is a
+$B$r;}$?$J$$@)8f%a%C%;!<%8$O!"$=$N%W%m%;%9$,(B
+.Xr recvfrom 2
+$B$rMQ$$$F<u?.$7$^$9!#$3$N$H$-!"(B
+$B%=%1%C%H%"%I%l%90z?t$O!"Aw?.B&$N(B netgraph $B%"%I%l%9$r4^$`9=B$BN(B
 .Dv "struct sockaddr_ng"
-containing the sender's netgraph address. Conversely, control messages
-can be sent to any node by calling
-.Xr sendto 2 ,
-supplying the recipient's address in a
-.Dv "struct sockaddr_ng" .
-The
+$B$G$9!#5U$K!"(B
+$B<u?.B&$N%"%I%l%9$r9=B$BN(B
+.Dv "struct sockaddr_ng"
+$B$KF~$l$F(B
+.Xr sendto 2
+$B$r8F$S=P$9$3$H$K$h$j!"$I$N$h$&$J%N!<%I$K$G$b@)8f%a%C%;!<%8$rAw?.$9$k$3$H$,(B
+$B$G$-$^$9!#(B
 .Xr bind 2
-system call may be used to assign a global netgraph name to the node.
+$B%7%9%F%`%3!<%k$rMQ$$$F!"Bg0h(B netgraph $BL>$r%N!<%I$K3d$j?6$k(B
+$B$3$H$,$G$-$^$9!#(B
 .Pp
-To transmit and receive netgraph data packets, a
-.Dv NG_DATA
-socket must also be created using
+netgraph $B%G!<%?%Q%1%C%H$rAw<u?.$9$k$?$a$K$O!"@)8f%=%1%C%H$K2C$($F!"(B
 .Xr socket 2
-and associated with a
+$B$rMQ$$$F(B
+.Dv NG_DATA
+$B%=%1%C%H$r@8@.$7!"(B
 .Nm socket
-node.
-.Dv NG_DATA sockets do not automatically
-have nodes associated with them; they are bound to a specific node via the
+$B%N!<%I$K4XO"IU$1$kI,MW$,$"$j$^$9!#(B
+.Dv NG_DATA
+$B%=%1%C%H$O!"$=$l$i$K4XO"$9$k%N!<%I$r<+F0E*$K;}$D$o$1$G$O$"$j$^$;$s!#(B
 .Xr connect 2
-system call. The address argument is the netgraph address of the
+$B%7%9%F%`%3!<%k$rMQ$$$F%N!<%I$r;XDj$7$F7k9g$7$^$9!#(B
+$B%"%I%l%90z?t$O!"$9$G$K@8@.$7$?(B
 .Nm socket
-node already created. Once a data socket is associated with a node,
-any data packets received by the node are read using
+$B%N!<%I$N(B netgraph $B%"%I%l%9$G$9!#(B
+1 $B2s%G!<%?%=%1%C%H$r%N!<%I$K4XO"IU$1$F$7$^$&$H!"$=$N%N!<%I$,(B
+$B<u?.$7$?$9$Y$F$N%G!<%?%Q%1%C%H$O(B
 .Xr recvfrom 2
-and any packets to be sent out from the node are written using
-.Xr sendto 2 .
-In the case of data sockets, the
+$B$K$h$jFI$_9~$^$l$^$9!#(B
+$B$=$7$F!"$=$N%N!<%I$+$iAw=P$5$l$k$9$Y$F$N%Q%1%C%H$r(B
+.Xr sendto 2
+$B$K$h$j=q$-=P$7$^$9!#(B
+$B%G!<%?%=%1%C%H$N>l9g!"9=B$BN(B
 .Dv "struct sockaddr_ng"
-contains the name of the
-.Em hook
-on which the data was received or should be sent.
-.Pp
-As a special case, to allow netgraph data sockets to be used as stdin or stdout
-on naive programs, a
+$B$O!"%G!<%?$r<u?.$7$?(B
+.Em $B%U%C%/(B(hook)
+$B$b$7$/$O=q$-=P$9$Y$-(B
+.Em $B%U%C%/(B
+$B$NL>A0$r4^$_$^$9!#(B
+.Pp
+$BFCJL$J>l9g$H$7$F!"C1=c$J%W%m%0%i%`$G!"(Bnetgraph $B%G!<%?%=%1%C%H$r(B
+$BI8=`F~=PNO$H$7$F;HMQ$G$-$k$h$&$K$9$k:]$K$O!"(B
+NULL $B$N(B sockaddr $B%]%$%s%?$r;XDj$7$F(B
 .Xr sendto  2
-with a NULL sockaddr pointer, a 
+$B$r8F$S=P$9$+!"(B
 .Xr send 2
-or a 
+$B$+!"(B
 .Xr write 2
-will succeed in the case where there is exactly ONE hook  attached to
-the socket node, (and thus the path is unambiguous).
-.Pp
-There is a user library that simplifies using netgraph sockets; see
-.Xr netgraph 3 .
-.Sh HOOKS
-This node type supports hooks with arbitrary names (as long as
-they are unique) and always accepts hook connection requests.
-.Sh CONTROL MESSAGES
-This node type supports the generic control messages, plus the following:
+$B$r8F$S=P$7$^$9$,!"$3$l$,@.8y$9$k$N$O!"(B
+$B$=$N%=%1%C%H%N!<%I$K%U%C%/$,$A$g$&$I0l$D$@$13d$jIU$1$i$l$F(B
+($B%Q%9$,$"$$$^$$$5$J$/7hDj$G$-$F(B) $B$$$k>l9g$K8B$j$^$9(B
+.Pp
+netgraph $B%=%1%C%H$r4JC1$KMxMQ$G$-$k$h$&$K$9$k$?$a$N%f!<%6%i%$%V%i%j$,(B
+$B$"$j$^$9!#(B
+.Xr netgraph 3
+$B$r;2>H$7$F2<$5$$!#(B
+.Sh $B%U%C%/(B
+$B$3$N%N!<%I7?$O!"(B($B0l0U@-$,$"$k8B$j(B) $BG$0U$NL>A0$r;}$D%U%C%/$r%5%]!<%H(B
+$B$7$^$9!#$^$?!"%U%C%/$X$N@\B3MW5a$r>o$K<uM}$7$^$9!#(B
+.Sh $B@)8f%a%C%;!<%8(B
+$B$3$N%N!<%I7?$O!"HFMQ$N@)8f%a%C%;!<%8$K2C$($F!"<!$K<($9@)8f%a%C%;!<%8$r(B
+$B%5%]!<%H$7$^$9!#(B
 .Bl -tag -width foo
 .It Dv NGM_SOCK_CMD_NOLINGER
-When the last hook is removed from this node, it will shut down as
-if it had received a 
+$B$3$N%N!<%I$+$i:G8e$N%U%C%/$,:o=|$5$l$?$H$-$K!"(B
 .Dv NGM_SHUTDOWN
-message. Attempts to access the sockets associated will return
-.Er ENOTCONN .
+$B$r<u?.$7$?$+$N$h$&$K%7%c%C%H%@%&%s$7$^$9!#4XO"$9$k%=%1%C%H$X$N%"%/%;%9$O!"(B
+.Er ENOTCONN
+$B$rJV$7$^$9!#(B
 .It Dv NGM_SOCK_CMD_LINGER
-This is the default mode. When the last hook is removed, the node will
-continue to exist, ready to accept new hooks until it
-is explicitly shut down.
+$B$3$l$O!"%G%U%)%k%H$N%b!<%I$G$9!#:G8e$N%U%C%/$,:o=|$5$l$F$b!"(B
+$B%N!<%I$OB8:_$7B3$1$^$9!#L@<(E*$K%7%c%C%H%@%&%s$5$l$J$$8B$j!"(B
+$B?7$7$$%U%C%/$r<uM}$G$-$k>uBV$N$^$^$G$9!#(B
 .El
 .Pp
-All other messages
-with neither the
 .Dv NGM_SOCKET_COOKIE
-or
+$B$+(B
 .Dv NGM_GENERIC_COOKIE
-will be passed unaltered up the 
+$B0J30$N$9$Y$F$N%a%C%;!<%8$O!"JQ99$5$l$:$K(B
 .Dv NG_CONTROL 
-socket.
-.Sh SHUTDOWN
-This node type shuts down and disappears when both the associated
+$B%=%1%C%H$KEO$5$l$^$9!#(B
+.Sh $B%7%c%C%H%@%&%s(B
+$B$3$N%N!<%I7?$O!"4XO"IU$1$i$l$F$$$k(B
 .Dv NG_CONTROL
-and
+$B$H(B
 .Dv NG_DATA
-sockets have been closed, or a
+$B%=%1%C%H$,4{$K%/%m!<%:$5$l$F$$$k$+!"(B
 .Dv NGM_SHUTDOWN
-control message is received. In the latter case, attempts to write
-to the still-open sockets will return
-.Er ENOTCONN .
-If the 
+$B@)8f%a%C%;!<%8$r<u?.$7$?>l9g$K!"%7%c%C%H%@%&%s$5$l!">CLG$7$^$9!#(B
+$B8e$N>l9g!"%*!<%W%s$5$l$F$$$k%=%1%C%H$K=q$-9~$b$&$H$9$k$H!"(B
+.Er ENOTCONN
+$B$,JV$5$l$^$9!#(B
+$B4{$K(B
 .Dv NGM_SOCK_CMD_NOLINGER
-message has been received, closure of the last hook will also initiate
-a shutdown of the node.
-.Sh BUGS
-It is not possible to reject the connection of a hook, though any
-data received on that hook can certainly be ignored.
-.Pp
-The controlling process is not notified of all events that an in-kernel node
-would be notified of, e.g. a new hook, or hook removal. We should define
-some node-initiated messages for this purpose (to be sent up the control
-socket).
-.Sh SEE ALSO
+$B%a%C%;!<%8$r<u?.$7$F$$$k$H!":G8e$N%U%C%/$r%/%m!<%:$9$k$HF1;~$K(B
+$B$=$N%N!<%I$N%7%c%C%H%@%&%s=hM}$,3+;O$5$l$^$9!#(B
+.Sh $B%P%0(B
+$B$I$N$h$&$J%G!<%?$r<u?.$7$F$b3N<B$KL5;k$G$-$k$h$&$K%U%C%/$r@_Dj$9$k$3$H$,(B
+$B$G$-$k$K$b$+$+$o$i$:!"(B
+$B%U%C%/$X$N@\B3$r5qH]$9$k$3$H$O$G$-$^$;$s!#(B
+.Pp
+$B%+!<%M%kFb%N!<%I$KDLCN$5$l$k%$%Y%s%H(B ($B$?$H$($P!"?75,%U%C%/!"%U%C%/:o=|(B
+$B$J$I(B) $B$N$9$Y$F$,@)8f%W%m%;%9$KDLCN$5$l$^$;$s!#$3$NL\E*$N$?$a$K$O!"(B
+($B@)8f%=%1%C%H$KAw=P$9$k$?$a$K(B) $B%N!<%I$,H/?.$9$k%a%C%;!<%8$r(B
+$B$$$/$D$+Dj5A$9$kI,MW$,$"$j$^$9!#(B
+.Sh $B4XO"9`L\(B
 .Xr socket 2 ,
 .Xr netgraph 3 ,
 .Xr netgraph 4 ,
 .Xr ng_ksocket 8 ,
-.Xr ngctl 8 .
-.Sh AUTHOR
+.Xr ngctl 8
+.Sh $B:n<T(B
 Julian Elischer <julian@whistle.com>
