📄 muxtklib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/muxTkLib.html - generated by refgen from muxTkLib.c --> <title> muxTkLib </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>muxTkLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>muxTkLib</strong> - MUX toolkit Network Interface Library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./muxTkLib.html#muxTkDrvCheck">muxTkDrvCheck</a>( )</b> - checks if the device is an NPT or an END interface<br><b><a href="./muxTkLib.html#muxTkCookieGet">muxTkCookieGet</a>( )</b> - returns the cookie for a device<br><b><a href="./muxTkLib.html#muxTkBind">muxTkBind</a>( )</b> - bind an NPT protocol to a driver<br><b><a href="./muxTkLib.html#muxTkReceive">muxTkReceive</a>( )</b> - receive a packet from a NPT driver<br><b><a href="./muxTkLib.html#muxTkSend">muxTkSend</a>( )</b> - send a packet out on a Toolkit or END network interface<br><b><a href="./muxTkLib.html#muxTkPollSend">muxTkPollSend</a>( )</b> - send a packet out in polled mode to an END or NPT interface<br><b><a href="./muxTkLib.html#muxTkPollReceive">muxTkPollReceive</a>( )</b> - poll for a packet from a NPT or END driver<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides additional APIs offered by the Network ProtocolToolkit (NPT) architecture. These APIs extend the original release ofthe MUX interface.<p>A NPT driver is an enhanced END but retains all of the END's functionality.NPT also introduces the term "network service sublayer" or simply "servicesublayer" which is the component that interfaces between the network service(or network protocol) and the MUX. This service sublayer may be built into the network service or protocol rather than being a separate component.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>vxWorks.h</b>, <b>taskLib.h</b>, <b>stdio.h</b>, <b>errno.herrnoLib.h</b>, <b>lstlib.h</b>,<b>logLib.h</b>, <b>string.h</b>, <b>m2Lib.h</b>, <b>net/if.h</b>, <b>bufLib.h</b>, <b>semlib.h</b>, <b>end.h</b>, <b>muxLib.h</b>,<b>muxTkLib.h</b>, <b>netinet/if_ether.h</b>, <b>net/mbuf.h</b><hr><a name="muxTkDrvCheck"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>muxTkDrvCheck( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>muxTkDrvCheck( )</strong> - checks if the device is an NPT or an END interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int muxTkDrvCheck ( char * pDevName /* device name */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function returns 1 if the driver indicated by <i>pDevName</i> is of theToolkit (NPT) paradigm, and 0 (zero) if it is an END. This routine iscalled by the network service sublayer so that it can discover the drivertype before it binds to it via the MUX.<p></blockquote><h4>RETURNS</h4><blockquote><p>1 for an NPT driver, 0 for an END or other driver, or ERROR (-1) if no device is found with the given name<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./muxTkLib.html#top">muxTkLib</a></b>, <b><a href="./muxTkLib.html#muxTkBind">muxTkBind</a>( )</b>, <b><a href="./muxLib.html#muxBind">muxBind</a>( )</b><hr><a name="muxTkCookieGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>muxTkCookieGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>muxTkCookieGet( )</strong> - returns the cookie for a device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void *muxTkCookieGet ( char * pName, /* Device Name */ int unit /* Device Unit */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the cookie for a device.<p></blockquote><h4>RETURNS</h4><blockquote><p>a cookie to the device or NULL if unsuccessful</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./muxTkLib.html#top">muxTkLib</a></b><hr><a name="muxTkBind"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>muxTkBind( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>muxTkBind( )</strong> - bind an NPT protocol to a driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void * muxTkBind ( char * pName, /* interface name, for example, ln, ei,... */ int unit, /* unit number */ BOOL (* stackRcvRtn) (void* ,long, M_BLK_ID, void * ), /* receive function to be called. */ STATUS (* stackShutdownRtn) (void * ), /* routine to call to shutdown the stack */ STATUS (* stackTxRestartRtn) (void * ), /* routine to tell the stack it can transmit */ void (* stackErrorRtn) (void* , END_ERR* ), /* routine to call on an error. */ long type, /* protocol type from RFC1700 and many */ /* other sources (for example, 0x800 is IP) */ char * pProtoName, /* string name for protocol */ void * pNetCallbackId, /* returned to network service sublayer */ /* during recv */ void * pNetSvcInfo, /* reference to netSrvInfo structure */ void * pNetDrvInfo /* reference to netDrvInfo structure */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>A network protocol, network service, or service sublayer uses this routineto bind to a specific driver. This bind routine is valid both for END andNPT drivers, but the specified stack routine parameters must use the NPTfunction prototypes, and are somewhat different from those used with<b><a href="./muxLib.html#muxBind">muxBind</a>( )</b>.<p>The driver is specified by the <i>pName</i> and <i>unit</i> arguments, (for example,ln and 0, ln and 1, or ei and 0).<p><dl><dt><i>pName</i><dd>Expects a pointer to a character string that contains the name of thedevice that this network service wants to use to send and receive packets.<dt><i>unit</i><dd>Expects the unit number of the device of the type indicated by <i>pName</i>.<dt><i>stackRcvRtn</i><dd>Expects a pointer to the function that the MUX will call when itwants to pass a packet up to the network service. For a description ofhow to write this routine, see the <i>WindNet TCP/IP Network Programmer's Guide </i><dt><i>stackShutdownRtn</i><dd>Expects a pointer to the function that the MUX will call toshutdown the network service. For a description of how to write sucha routine, see the <i>WindNet TCP/IP Network Programmer's Guide </i><dt><i>stackTxRestartRtn</i><dd>Expects a pointer to the function that the MUX will call after packettransmission has been suspended, to tell the network service that it cancontinue transmitting packets. For a description of how to write thisroutine, see the <i>WindNet TCP/IP Network Programmer's Guide </i><dt><i>stackErrorRtn</i><dd>Expects a pointer to the function that the MUX will call to give errorsto the network service. For a description of how to write this routine,see the section<i>WindNet TCP/IP Network Programmer's Guide </i><dt><i>type</i><dd>Expects a value that indicates the protocol type. The MUX uses this typeto prioritize a network service as well as to modify its capabilities. Forexample, a network service of type <b>MUX_PROTO_SNARF</b> has the highest priority(see the description of protocol prioritizing provided in<i>WindNet TCP/IP Network Programmer's Guide. </i>Aside from <b>MUX_PROTO_SNARF</b> and <b>MUX_PROTO_PROMISC</b>, valid network servicetypes include any of the values specified in RFC 1700, or can beuser-defined.<p>The <i>stackRcvRtn</i> is called whenever the MUX has a packet of the specifiedtype. If the type is <b>MUX_PROTO_PROMISC</b>, the protocol is consideredpromiscuous and will get all of the packets that have not been consumedby any other protocol. If the type is <b>MUX_PROTO_SNARF</b>, it will get all ofthe packets that the MUX sees.<p>If the type is <b>MUX_PROTO_OUTPUT</b>, this network service is an output protocoland all packets that are to be output on this device are first passed to<i>stackRcvRtn</i> routine rather than being sent to the device. This can beused by a network service that needs to send packets directly to anothernetwork service, or in a loop-back test. If the <i>stackRcvRtn</i> returns OK,the packet is consumed and as no longer available. The <i>stackRcvRtn</i> for anoutput protocol may return ERROR to indicate that it wants to look at thepacket without consuming it.<dt><i>pProtoName</i><dd>Expects a pointer to a character string for the name of thisnetwork service. This string can be NULL, in which case a network servicename is assigned internally.<dt><i>pNetCallbackId</i><dd>Expects a pointer to a structure defined by the protocol. This argumentis passed up to the protocol as the first argument of all the callbacks.This argument corresponds to the <i>pSpare</i> argument in <b><a href="./muxLib.html#muxBind">muxBind</a>( )</b><dt><i>pNetSvcInfo</i><dd>Reference to an optional structure specifying network service layerinformation needed by the driver<dt><i>pNetDrvInfo</i><dd>Reference to an optional structure specifying network driver informationneeded by the network protocol, network service, or service sublayer</dl></blockquote><h4>RETURNS</h4><blockquote><p>A cookie that uniquely represents the binding instance, or NULLif the bind fails.<p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_muxLib_NO_DEVICE</b>, <b>S_muxLib_END_BIND_FAILED</b>, <b>S_muxLib_NO_TK_DEVICE</b>,<b>S_muxLib_NOT_A_TK_DEVICE</b>, <b>S_muxLib_ALREADY_BOUND</b>, <b>S_muxLib_ALLOC_FAILED</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./muxTkLib.html#top">muxTkLib</a></b>, <b><a href="./muxLib.html#muxBind">muxBind</a>( )</b><hr><a name="muxTkReceive"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>muxTkReceive( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>muxTkReceive( )</strong> - receive a packet from a NPT driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS muxTkReceive ( void * pCookie, /* cookie passed in endLoad() call */ M_BLK_ID pMblk, /* a buffer passed to us. */ long netSvcOffset, /* offset to network datagram in the packet */ long netSvcType, /* network service type */ BOOL uniPromiscuous, /* TRUE when driver is in promiscuous mode */ void * pSpareData /* out of band data */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This is the routine that the NPT driver calls to hand a packet to the MUX.This routine forwards the received <b>mBlk</b> chain to the network servicesublayer by calling its registered <b>stackRcvRtn( )</b>.<p>Typically, a driver includes an interrupt handling routine to processreceived packets. It should keep processing to a minimum during interruptcontext and then arrange for processing of the received packet withintask context.<p>Once the frame has been validated, the driver should pass it to the MUXwith the <b>receiveRtn</b> member of its <b>END_OBJ</b> structure. This routine hasthe same prototype as (and typically is) <b><a href="./muxTkLib.html#muxTkReceive">muxTkReceive</a>( )</b>.<p>Depending on the protocol type (for example, <b>MUX_PROTO_SNARF</b> or<b>MUX_PROTO_PROMISC</b>), this routine either forwards the received packet chainunmodified or it changes the data pointer in the <b>mBlk</b> to strip off theframe header before forwarding the packet.<p><dl><dt><i>pCookie</i><dd>Expects the <b>END_OBJ</b> pointer returned by the driver's <b>endLoad( )</b> or<b>nptLoad( )</b> function<p><dt><i>pMblk</i><dd>Expects a pointer to the <b>mBlk</b> structure containing the packet that hasbeen received<p><dt><i>netSvcOffset</i><dd>Expects an offset into the frame to the point where the data field (thenetwork service layer header) begins<p><dt><i>netSvcType</i><dd>Expects the network service type of the service for which the packet isdestined (typically this value can be found in the header of the receivedframe)<p><dt><i>uniPromiscuous</i><dd>Expects a boolean set to TRUE when driver is in promiscuous mode andreceives a unicast or a multicast packet not intended for this device.When TRUE the packet is not handed over to network services other than
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -