ng_device -- device netgraph node type
#include <netgraph/ng_device.h>
A device node is both a netgraph node and a system device interface.
When a device node is created, a new device entry appears which is accessible
via the regular file operators such as open(2), close(2), read(2),
write(2), etc.
The first node is created as /dev/ngd0, all subsequent nodes /dev/ngd1,
/dev/ngd2, etc. The only way a device node can be created is by a connection
to the main device node by another type of netgraph(4) node.
When a node is shut down, the corresponding device is removed and the
device name becomes available for reuse by future device nodes.
A device node has a single hook to which it connects to the requesting
netgraph(4) node. All data coming in over the hook will be presented to
the device for read(2). All data coming in from the device entry by
write(2) will be forwarded to the hook.
The device node has no named hooks. There is one hook which is used for
all interactions. This is the hook created by the calling node.
The device node supports no special control messages. All incoming messages
from the hook will be returned to the sender. Additionally the
node accepts ioctl(2)s from the device entry. These will be encapsulated
into netgraph(4) messages and send out to the hook.
This node shuts down upon receipt of a NGM_SHUTDOWN control message. The
associated interface is removed and becomes available for use by future
device nodes.
Unlike most other node types, a device node does not go away when all
hooks have been disconnected; rather, an explicit NGM_SHUTDOWN control
message is required.
netgraph(4), ngctl(8)
The device node type was first implemented in FreeBSD 5.0.
Mark Santcroos <[email protected]>
FreeBSD 5.2.1 June 15, 2002 FreeBSD 5.2.1 [ Back ] |