📄 ipfilterlib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ipFilterLib.html - generated by refgen from ipFilterLib.c --> <title> ipFilterLib </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>ipFilterLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ipFilterLib</strong> - IP filter hooks library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./ipFilterLib.html#ipFilterLibInit">ipFilterLibInit</a>( )</b> - initialize IP filter facility<br><b><a href="./ipFilterLib.html#ipFilterHookAdd">ipFilterHookAdd</a>( )</b> - add a routine to receive all internet protocol packets<br><b><a href="./ipFilterLib.html#ipFilterHookDelete">ipFilterHookDelete</a>( )</b> - delete a IP filter hook routine<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides utilities that give direct access to IP packets.You can examine or process incoming raw IP packets using the hooks you installed by calling <b><a href="./ipFilterLib.html#ipFilterHookAdd">ipFilterHookAdd</a>( )</b>. Using a filter hook, you can build IP traffic monitoring and testing tools. <p>However, you should not use an IP filter hook as a standard means to provide network access to an application. The filter hook lets you see, process, and even consume packets before their intended recipients have seen the packets. For most network applications, this is too much responsibility. Thus, most network applications should access the network access through the higher-level socket interface provided by <b><a href="./sockLib.html#top">sockLib</a></b>. <p>The <b><a href="./ipFilterLib.html#ipFilterLibInit">ipFilterLibInit</a>( )</b> routine links the IP filtering facility into the VxWorks system. This is performed automatically if <b>INCLUDE_IP_FILTER</b> is defined.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call <b><a href="./ipFilterLib.html#ipFilterHookAdd">ipFilterHookAdd</a>( )</b> from within the kernel protection domain only, and the function referenced in the <i>ipFilterHook</i> parameter must reside in the kernel protection domain. This restriction does not apply to non-AE versions of VxWorks. <p><hr><a name="ipFilterLibInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ipFilterLibInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ipFilterLibInit( )</strong> - initialize IP filter facility</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void ipFilterLibInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine links the IP filter facility into the VxWorks system.These routines are included automatically if <b>INCLUDE_IP_FILTER</b>is defined.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ipFilterLib.html#top">ipFilterLib</a></b><hr><a name="ipFilterHookAdd"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ipFilterHookAdd( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ipFilterHookAdd( )</strong> - add a routine to receive all internet protocol packets</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ipFilterHookAdd ( FUNCPTR ipFilterHook /* routine to receive raw IP packets */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine adds a hook routine that will be called for every IPpacket that is received.<p>The filter hook routine should be of the form:<pre>BOOL ipFilterHook ( struct ifnet *pIf, /* interface that received the packet */ struct mbuf **pPtrMbuf, /* pointer to pointer to an mbuf chain */ struct ip **pPtrIpHdr, /* pointer to pointer to IP header */ int ipHdrLen, /* IP packet header length */ )</pre>The hook routine should return TRUE if it has handled the input packet. A returned value of TRUE effectively consumes the packet from the viewpoint of IP, which will never see the packet. As a result, when the filter hook returns TRUE, it must handle the freeing of any resources associated with the packet. For example, the filter hook routine would be responsible for freeing the packet's <b>mbuf</b> chain by calling <b>m_freem(*pPtrMbuf)</b>. <p>The filter hook routine should return FALSE if it has not handled the packet. In response to a FALSE, the network stack submits the packet for normal IP processing.<p>Within the packet's IP header (the filter hook can obtain a pointer to the IP header by dereferencing <b>pPtrIpHdr</b>), you will find that the values in the <b>ip_len</b> field, the <b>ip_id</b> field, and <b>ip_offset</b> field have been converted to the host byte order before the packet was handed to the filter hook.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call <b><a href="./ipFilterLib.html#ipFilterHookAdd">ipFilterHookAdd</a>( )</b> from within the kernel protection domain only, and the function referenced in the <i>ipFilterHook</i> parameter must reside in the kernel protection domain. This restriction does not apply to non-AE versions of VxWorks. <p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ipFilterLib.html#top">ipFilterLib</a></b><hr><a name="ipFilterHookDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ipFilterHookDelete( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ipFilterHookDelete( )</strong> - delete a IP filter hook routine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void ipFilterHookDelete (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes an IP filter hook.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ipFilterLib.html#top">ipFilterLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -