|
NAMEng_ksocket —
kernel socket netgraph node type
SYNOPSIS#include <sys/types.h>
#include <netgraph/ng_ksocket.h>
DESCRIPTIONAksocket node is both a netgraph node and a
BSD socket. The ng_ksocket
node type allows one to open a socket inside the kernel and have it appear as
a Netgraph node. The ng_ksocket node type is the
reverse of the socket node type (see
ng_socket(4)):
whereas the socket node type enables the user-level manipulation (via a
socket) of what is normally a kernel-level entity (the associated Netgraph
node), the ng_ksocket node type enables the
kernel-level manipulation (via a Netgraph node) of what is normally a
user-level entity (the associated socket).
A HOOKSThis node type supports a single hook connection at a time. The name of the hook must be of the form <family>/<type>/<proto>, where the family, type, and proto are the decimal equivalent of the same arguments to socket(2). Alternately, aliases for the commonly used values are accepted as well. For exampleinet/dgram/udp is a more readable but
equivalent version of 2/2/17 .
Data received into socket is sent out via hook. Data received on
hook is sent out from socket, if the latter is connected (an
CONTROL MESSAGESThis node type supports the generic control messages, plus the following:
ASCII FORM CONTROL MESSAGESFor control messages that pass a struct sockaddr in the argument field, the normal ASCII equivalent of the C structure is an acceptable form. For thePF_INET and
PF_LOCAL address families, a more convenient form is
also used, which is the protocol family name, followed by a slash, followed by
the actual address. For PF_INET , the address is an IP
address followed by an optional colon and port number. For
PF_LOCAL , the address is the pathname as a doubly
quoted string.
Examples:
For control messages that pass a struct ng_ksocket_sockopt, the normal ASCII form for that structure is used. In the future, more convenient encoding of the more common socket options may be supported. Setting socket options example:
SHUTDOWNThis node shuts down upon receipt of aNGM_SHUTDOWN
control message, or when the hook is disconnected. Shutdown of the node closes
the associated socket.
SEE ALSOsocket(2), netgraph(4), ng_socket(4), ngctl(8), mbuf_tags(9), socket(9)HISTORYTheng_ksocket node type was implemented in
FreeBSD 4.0.
AUTHORSArchie Cobbs <archie@FreeBSD.org>
Visit the GSP FreeBSD Man Page Interface. |