|
NAMEng_socket —
netgraph socket node type
SYNOPSIS#include <sys/types.h>
#include <netgraph/ng_socket.h>
DESCRIPTIONAsocket node is both a BSD
socket and a netgraph node. The ng_socket node type
allows user-mode processes to participate in the kernel
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.
A new To transmit and receive netgraph data packets, a
As a special case, to allow netgraph data sockets to be used as stdin or stdout on naive programs, a sendto(2) with a NULL sockaddr pointer, a send(2) or a write(2) will succeed in the case where there is exactly ONE hook attached to the socket node, (and thus the path is unambiguous). There is a user library that simplifies using netgraph sockets; see netgraph(3). HOOKSThis node type supports hooks with arbitrary names (as long as they are unique) and always accepts hook connection requests.CONTROL MESSAGESThis node type supports the generic control messages, plus the following:
All other messages with neither the
SHUTDOWNThis node type shuts down and disappears when both the associatedNG_CONTROL and NG_DATA sockets
have been closed, or a NGM_SHUTDOWN control message is
received. In the latter case, attempts to write to the still-open sockets will
return ENOTCONN . If the
NGM_SOCK_CMD_NOLINGER message has been received,
closure of the last hook will also initiate a shutdown of the node.
SEE ALSOsocket(2), netgraph(3), netgraph(4), ng_ksocket(4), ngctl(8)HISTORYTheng_socket node type was implemented in
FreeBSD 4.0.
AUTHORSJulian Elischer <julian@FreeBSD.org>BUGSIt is not possible to reject the connection of a hook, though any data received on that hook can certainly be ignored.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. Some node-initiated messages should be defined for this purpose (to be sent up the control socket).
Visit the GSP FreeBSD Man Page Interface. |