📄 bpfdrv.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/bpfDrv.html - generated by refgen from bpfDrv.c --> <title> bpfDrv </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>bpfDrv</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>bpfDrv</strong> - Berkeley Packet Filter (BPF) I/O driver library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./bpfDrv.html#bpfDrv">bpfDrv</a>( )</b> - initialize the BPF driver<br><b><a href="./bpfDrv.html#bpfDevCreate">bpfDevCreate</a>( )</b> - create Berkeley Packet Filter device<br><b><a href="./bpfDrv.html#bpfDevDelete">bpfDevDelete</a>( )</b> - destroy Berkeley Packet Filter device<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides a driver which supports the customized retrieval ofincoming network data that meets the criteria imposed by a user-specifiedfilter.<p></blockquote><h4>USER-CALLABLE ROUTINES</h4><blockquote><p>The <b><a href="./bpfDrv.html#bpfDrv">bpfDrv</a>( )</b> routine initializes the driver and the <b><a href="./bpfDrv.html#bpfDevCreate">bpfDevCreate</a>( )</b> routinecreates a packet filter device. Each BPF device allows direct access to theincoming data from one or more network interfaces.<p></blockquote><h4>CREATING BPF DEVICES</h4><blockquote><p>In order to retrieve incoming network data, a BPF device must be created bycalling the <b><a href="./bpfDrv.html#bpfDevCreate">bpfDevCreate</a>( )</b> routine:<pre> STATUS bpfDevCreate ( char * pDevName, /* I/O system device name */ int numUnits, /* number of device units */ int bufSize /* block size for the BPF device */ )</pre>The <i>numUnits</i> parameter specifies the maximum number of BPF units forthe device. Each unit is accessed through a separate file descriptorfor use with a unique filter and/or a different network interface. Forexample, the following call creates the "/bpf0" and "/bpf1" units:<pre> bpfDevCreate ("/bpf", 2, 4096);</pre></blockquote><h4>CONFIGURING BPF DEVICES</h4><blockquote><p>After opening a device unit, the associated file descriptor must be bound toa specific network interface with the BIOCSETIF <b><a href="./ioLib.html#ioctl">ioctl</a>( )</b> option. The BIOCSETF<b><a href="./ioLib.html#ioctl">ioctl</a>( )</b> option adds any filter instructions. Each file descriptor receivesa copy of any data which matches the filter. Different file descriptors mayshare the same interface. The underlying filters will receive an identicaldata stream.<p></blockquote><h4>IOCTL FUNCTIONS</h4><blockquote><p>The BPF driver supports the following <b><a href="./ioLib.html#ioctl">ioctl</a>( )</b> functions:<p></blockquote><h4>NOTE</h4><blockquote><p>When reading data from BPF units, the supplied buffer must be able toaccept an entire block of data as defined by the <i>bufSize</i> parameter tothe <b><a href="./bpfDrv.html#bpfDevCreate">bpfDevCreate</a>( )</b> routine. That value is also available with the BIOCGBLEN<b><a href="./ioLib.html#ioctl">ioctl</a>( )</b> option described above.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>bpfDrv.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b><hr><a name="bpfDrv"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>bpfDrv( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>bpfDrv( )</strong> - initialize the BPF driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS bpfDrv (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine installs the Berkeley Packet Filter driver for access throughthe I/O system. It is required before performing any I/O operations and isexecuted automatically if <b>INCLUDE_BPF</b> is defined at the time the systemis built. Subsequent calls to the routine just count the number of userswith BPF access.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if initialization fails.<p></blockquote><h4>ERRNO</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bpfDrv.html#top">bpfDrv</a></b><hr><a name="bpfDevCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>bpfDevCreate( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>bpfDevCreate( )</strong> - create Berkeley Packet Filter device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS bpfDevCreate ( char * pDevName, /* I/O system device name */ int numUnits, /* number of device units */ int bufSize /* BPF device block size (0 for default) */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a Berkeley Packet Filter device. Each of the<i>numUnits</i> units corresponds to a single available file descriptor formonitoring a network device. The <i>pDevName</i> parameter provides the nameof the BPF device to the I/O system. The default name of "/bpf" (assignedif <i>pDevName</i> is NULL) produces units named "/bpf0", "/bpf1", etc., up tothe <i>numUnits</i> limit.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if device creation failed.<p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_ioLib_NO_DRIVER</b></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bpfDrv.html#top">bpfDrv</a></b><hr><a name="bpfDevDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>bpfDevDelete( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>bpfDevDelete( )</strong> - destroy Berkeley Packet Filter device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS bpfDevDelete ( char * pDevName /* name of BPF device to remove */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine removes a Berkeley Packet Filter device and releases allallocated memory. It will close any open files using the device.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if device not found<p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_ioLib_NO_DRIVER</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bpfDrv.html#top">bpfDrv</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -