⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 etherlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/etherLib.html - generated by refgen from etherLib.c --> <title> etherLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>etherLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>etherLib</strong> - Ethernet raw I/O routines and hooks </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./etherLib.html#etherOutput">etherOutput</a></i>(&nbsp;)</b>  -  send a packet on an Ethernet interface<br><b><i><a href="./etherLib.html#etherInputHookAdd">etherInputHookAdd</a></i>(&nbsp;)</b>  -  add a routine to receive all Ethernet input packets<br><b><i><a href="./etherLib.html#etherInputHookDelete">etherInputHookDelete</a></i>(&nbsp;)</b>  -  delete a network interface input hook routine<br><b><i><a href="./etherLib.html#etherOutputHookAdd">etherOutputHookAdd</a></i>(&nbsp;)</b>  -  add a routine to receive all Ethernet output packets<br><b><i><a href="./etherLib.html#etherOutputHookDelete">etherOutputHookDelete</a></i>(&nbsp;)</b>  -  delete a network interface output hook routine<br><b><i><a href="./etherLib.html#etherAddrResolve">etherAddrResolve</a></i>(&nbsp;)</b>  -  resolve an Ethernet address for a specified Internet address<br><b><i><a href="./etherLib.html#etherTypeGet">etherTypeGet</a></i>(&nbsp;)</b>  -  get the type from an ethernet packet<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides utilities that give direct access to Ethernet packets.Raw packets can be output directly to an interface using <b><i><a href="./etherLib.html#etherOutput">etherOutput</a></i>(&nbsp;)</b>.Incoming and outgoing packets can be examined or processed using the hooks<b><i><a href="./etherLib.html#etherInputHookAdd">etherInputHookAdd</a></i>(&nbsp;)</b> and <b><i><a href="./etherLib.html#etherOutputHookAdd">etherOutputHookAdd</a></i>(&nbsp;)</b>.  The input hook can be used toreceive raw packets that are not part of any of the supported networkprotocols.  The input and output hooks can also be used to build networkmonitoring and testing tools.<p>Normally, the network should be accessed through the higher-level socketinterface provided in sockLib.  The routines in <b><a href="./etherLib.html#top">etherLib</a></b> should rarely,if ever, be necessary for applications.<p></blockquote><h4>CAVEAT</h4><blockquote><p>The following VxWorks network drivers support both the input-hook andoutput-hook routines:<p>&nbsp;&nbsp;&nbsp;&nbsp;if_cpm&nbsp;-&nbsp;Motorola&nbsp;MC68EN360&nbsp;QUICC&nbsp;network&nbsp;interface&nbsp;driver&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;if_eex&nbsp;-&nbsp;Intel&nbsp;EtherExpress&nbsp;16&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;if_ei&nbsp;-&nbsp;Intel&nbsp;82596&nbsp;ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_elc&nbsp;-&nbsp;SMC&nbsp;8013WC&nbsp;Ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_elt&nbsp;-&nbsp;3Com&nbsp;3C509&nbsp;Ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_ene&nbsp;-&nbsp;Novell/Eagle&nbsp;NE2000&nbsp;network&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_fn&nbsp;-&nbsp;Fujitsu&nbsp;MB86960&nbsp;NICE&nbsp;Ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_ln&nbsp;-&nbsp;Advanced&nbsp;Micro&nbsp;Devices&nbsp;Am7990&nbsp;LANCE&nbsp;Ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_sm&nbsp;-&nbsp;shared&nbsp;memory&nbsp;backplane&nbsp;network&nbsp;interface&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_sn&nbsp;-&nbsp;National&nbsp;Semiconductor&nbsp;DP83932B&nbsp;SONIC&nbsp;Ethernet&nbsp;driver<br>&nbsp;&nbsp;&nbsp;&nbsp;if_ultra&nbsp;-&nbsp;SMC&nbsp;Elite&nbsp;Ultra&nbsp;Ethernet&nbsp;network&nbsp;interface&nbsp;driver<p>&nbsp;&nbsp;&nbsp;&nbsp;if_gn&nbsp;-&nbsp;generic&nbsp;MUX&nbsp;interface&nbsp;layer<p>The following drivers support only the input-hook routines:<p>&nbsp;&nbsp;&nbsp;&nbsp;if_nic&nbsp;-&nbsp;National&nbsp;Semiconductor&nbsp;SNIC&nbsp;Chip&nbsp;(for&nbsp;HKV30)<br>&nbsp;&nbsp;&nbsp;&nbsp;if_sl&nbsp;-&nbsp;Serial&nbsp;Line&nbsp;IP&nbsp;(SLIP)&nbsp;network&nbsp;interface&nbsp;driver<p>The following drivers support only the output-hook routines:<p>&nbsp;&nbsp;&nbsp;&nbsp;if_ulip&nbsp;-&nbsp;network&nbsp;interface&nbsp;driver&nbsp;for&nbsp;User&nbsp;Level&nbsp;IP&nbsp;(VxSim)<p>The following drivers do not support either the input-hook or output-hookroutines:<p>&nbsp;&nbsp;&nbsp;&nbsp;if_loop&nbsp;-&nbsp;software&nbsp;loopback&nbsp;network&nbsp;interface&nbsp;driver<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>etherLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b>, <i>VxWorks Programmer's Guide: Network</i><hr><a name="etherOutput"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>etherOutput</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>etherOutput</i>(&nbsp;)</strong> - send a packet on an Ethernet interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS etherOutput    (    struct ifnet *        pIf,          /* interface on which to send */    struct ether_header * pEtherHeader, /* Ethernet header to send */    char *                pData,        /* data to send */    int                   dataLength    /* # of bytes of data to send */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sends a packet on the specified Ethernet interface bycalling the interface's output routine directly.<p>The first argument <i>pIf</i> is a pointer to a variable of type <b>struct ifnet</b>which contains some useful information about the network interface.  Aroutine named <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>(&nbsp;)</b> can retrieve this pointer from the system in thefollowing way:<pre>    struct ifnet *pIf;    ...    pIf = ifunit ("ln0");</pre>If <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>(&nbsp;)</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> points to the data structure thatdescribes the first LANCE network interface device if <b><i><a href="./ifLib.html#ifunit">ifunit</a></i>(&nbsp;)</b> issuccessful.<p>The second argument <i>pEtherHeader</i> should contain a valid Ethernet addressof the machine for which the message contained in the argument <i>pData</i> isintended.  If the Ethernet address of this machine is fixed and well-knownto the user, filling in the structure <b>ether_header</b> can be accomplished byusing <b><i><a href="./bLib.html#bcopy">bcopy</a></i>(&nbsp;)</b> to copy the six-byte Ethernet address into the <b>ether_dhost</b>field of the structure <b>ether_header</b>.  Alternatively, users can make use ofthe routine <b><i><a href="./etherLib.html#etherAddrResolve">etherAddrResolve</a></i>(&nbsp;)</b> which will use ARP (Address ResolutionProtocol) to resolve the Ethernet address for a specified Internetaddress.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the routine runs out of mbufs.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b>, <b><i><a href="./etherLib.html#etherAddrResolve">etherAddrResolve</a></i>(&nbsp;)</b><hr><a name="etherInputHookAdd"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>etherInputHookAdd</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>etherInputHookAdd</i>(&nbsp;)</strong> - add a routine to receive all Ethernet input packets</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS etherInputHookAdd    (    FUNCPTR inputHook, /* routine to receive Ethernet input */    char*   pName,     /* name of device if MUX/END is being used */    int     unit       /* unit of device if MUX/END is being used */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine adds a hook routine that will be called for every Ethernetpacket that is received.<p>The calling sequence of the input hook routine is:<pre>    BOOL inputHook         (         struct ifnet *pIf,    /* interface packet was received on */         char         *buffer, /* received packet */         int          length   /* length of received packet */         )</pre>The hook routine should return TRUE if it has handled the input packet andno further action should be taken with it.  It should return FALSE if ithas not handled the input packet and normal processing (for example, Internet) should take place.<p>The packet is in a temporary buffer when the hook routine is called.This buffer will be reused upon return from the hook.  If the hookroutine needs to retain the input packet, it should copy it elsewhere.<p></blockquote><h4>IMPLEMENTATION</h4><blockquote><p>A call to the function pointed to by the global function pointer<b>etherInputHookRtn</b> should be invoked in the receive routine of everynetwork driver providing this service.  For example:<pre>    ...    #include "etherLib.h"    ...    xxxRecv ()    ...    /* call input hook if any */        if ((etherInputHookRtn != NULL) &amp;&amp;            (* etherInputHookRtn) (&amp;ls-&gt;ls_if, (char *)eh, len))            {            return; /* input hook has already processed this packet */            }</pre></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./etherLib.html#top">etherLib</a></b><hr><a name="etherInputHookDelete"></a>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -