📄 etherlib.html
字号:
<p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>etherInputHookDelete</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>etherInputHookDelete</i>( )</strong> - delete a network interface input hook routine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void etherInputHookDelete ( FUNCPTR inputHook, char * pName, int unit )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a network interface input hook.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b><hr><a name="etherOutputHookAdd"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>etherOutputHookAdd</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>etherOutputHookAdd</i>( )</strong> - add a routine to receive all Ethernet output packets</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS etherOutputHookAdd ( FUNCPTR outputHook /* routine to receive Ethernet output */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine adds a hook routine that will be called for every Ethernetpacket that is transmitted.<p>The calling sequence of the output hook routine is:<pre> BOOL outputHook ( struct ifnet *pIf, /* interface packet will be sent on */ char *buffer, /* packet to transmit */ int length /* length of packet to transmit */ )</pre>The hook is called immediately before transmission. The hook routineshould return TRUE if it has handled the output packet and no furtheraction should be taken with it. It should return FALSE if it has nothandled the output packet and normal transmission should take place.<p>The Ethernet packet data is in a temporary buffer when the hook routineis called. This buffer will be reused upon return from the hook. Ifthe hook routine needs to retain the output packet, it should be copiedelsewhere.<p></blockquote><h4>IMPLEMENTATION</h4><blockquote><p>A call to the function pointed to be the global function pointer<b>etherOutputHookRtn</b> should be invoked in the transmit routine of everynetwork driver providing this service. For example:<p><pre> ... #include "etherLib.h" ... xxxStartOutput () /* call output hook if any */ if ((etherOutputHookRtn != NULL) && (* etherOutputHookRtn) (&ls->ls_if, buf0, len)) { /* output hook has already processed this packet */ } else ...</pre></blockquote><h4>RETURNS</h4><blockquote><p>OK, if the hook could be added, ERROR otherwise.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b><hr><a name="etherOutputHookDelete"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>etherOutputHookDelete</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>etherOutputHookDelete</i>( )</strong> - delete a network interface output hook routine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void etherOutputHookDelete ( FUNCPTR outputHook )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a network interface output hook, which must be suppliedas the only argument.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b><hr><a name="etherAddrResolve"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>etherAddrResolve</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>etherAddrResolve</i>( )</strong> - resolve an Ethernet address for a specified Internet address</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS etherAddrResolve ( struct ifnet * pIf, /* interface on which to send ARP req */ char * targetAddr, /* name or Internet address of target */ char * eHdr, /* where to return the Ethernet addr */ int numTries, /* number of times to try ARPing */ int numTicks /* number of ticks between ARPing */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine uses the Address Resolution Protocol (ARP) and internal ARPcache to resolve the Ethernet address of a machine that owns the Internetaddress given in <i>targetAddr</i>.<p>The first argument <i>pIf</i> is a pointer to a variable of type <b>struct ifnet</b>which identifies the network interface through which the ARP request messagesare to be sent out. The routine <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>( )</b> is used to retrieve this pointerfrom the system in the following way:<pre> struct ifnet *pIf; ... pIf = ifunit ("ln0");</pre>If <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>( )</b> returns a non-NULL pointer, it is a valid pointer tothe named network interface device structure of type <b>struct ifnet</b>.In the above example, <i>pIf</i> will be pointing to the data structure thatdescribes the first LANCE network interface device if <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>( )</b> issuccessful.<p>The six-byte Ethernet address is copied to <i>eHdr</i>, if the resolution of<i>targetAddr</i> is successful. <i>eHdr</i> must point to a buffer of at leastsix bytes.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK if the address is resolved successfully, or ERROR if <i>eHdr</i> is NULL,<i>targetAddr</i> is invalid, or address resolution is unsuccessful.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b>, <b><i><a href="./etherLib.html#etherOutput">etherOutput</a></i>( )</b><hr><a name="etherTypeGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>etherTypeGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>etherTypeGet</i>( )</strong> - get the type from an ethernet packet</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>USHORT etherTypeGet ( char * pPacket /* pointer to the beginning of the packet */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns a short that is the ethertype (defined in RFC1700) from either an 802.3 addressed packet or an RFC 894 packet.Most packets are encoded as described in RFC 894 but we should also beable to understand 802.3 addressing. <p></blockquote><h4>RETURNS</h4><blockquote><p>A USHORT value that is the ethertype, or 0 on error.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b>, <i>RFC 894, TCP/IP Illustrated, </i>Volume 1, by Richard Stevens.</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -