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

📄 streams.doc9.html

📁 vxworks相关论文
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="../../wrs.css"><title>WindNet STREAMS Components    WindNet STREAMS for Tornado   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="../../icons/contents.gif"></a><a href="streams.doc8.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc10.html"><img border="0" alt="[Next]" src="../../icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="83069" class="autotag">3.3&nbsp;&nbsp;Data Link Provider Interface (DLPI) Driver</a></i></h3></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="83070" class="autotag"> </a>The Data Link Provider Interface (DLPI) specifies a STREAMS-based interface between the data link provider and the data link user.  DLPI enables a Data Link Service (DLS) user to access any DLPI conformant provider without special knowledge of the provider's protocol.  For a complete discussion of DLPI, refer to the <i class="title">Data Link Provider Interface Specification</i> (UNIX International)  and <i class="title">STREAMS Modules and Drivers Unix SVR4.2</i> (UNIX Press).  </p><p class="Body"><a name="82905" class="autotag"> </a>The WindNet STREAMS DLPI library implements the generic Data Link Provider Interface (DLPI) Version 2.0, common for all VxWorks-specific network drivers.  <a href="streams.doc9.html#82973"><i class="title">Figure&nbsp;11</i></a> illustrates this STREAMS-based interface that provides protocol-independent access between the data link user (network layer or user application) and the data link layer (VxWorks network drivers). <div class="frame"><h4 class="EntityTitle"><a name="82973" class="autotag"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 11.  &nbsp;&nbsp;Data Link Provider Interface</font></a></h4><div class="CellBody"><a name="82971" class="autotag"> </a><img class="figure" border="0" alt="" src="images/streams.doc.anc7.gif"></div></div></p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="82910" class="autotag">3.3.1&nbsp;&nbsp;User-Callable Routines</a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="82911" class="autotag"> </a>The DLPI interface is initialized by <b class="routine"><i class="routine">dlpiInit</i></b><b>(&nbsp;)</b>, during system initialization, at which point it installs the DLPI STREAMS driver in the VxWorks I/O subsystem.</p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="82913" class="autotag">3.3.2&nbsp;&nbsp;Implementation</a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="82914" class="autotag"> </a>The WindNet STREAMS DLPI library supports up to eight Service Access Points (SAPs).  Driver open calls are treated as clone opens, thereby assigning a new stream for each open.  Each opened stream is bound to a SAP.  There is a one-to-one correspondence between opened streams and SAPs. </p><p class="Body"><a name="82916" class="autotag"> </a>The DLPI driver serves as a generic driver under which operates a network driver.  The network driver hands over the received packets to the DLPI driver using the network driver's <b class="keyword">etherInputHook</b> function pointer.  This pointer is installed at the time the stream is bound to the SAP, that is, when the <b>DL_BIND_REQ</b> primitive is sent by the DLS user.  The network driver must support <b class="keyword">etherInputHook</b>.  For more information on etherInputHook, see the manual entry for <b class="library">etherLib</b>.</p><p class="Body"><a name="87787" class="autotag"> </a>DLPI defines two styles of DLS provider.  The WindNet STREAMS DLPI driver is a <i class="emphasis">style&nbsp;2</i> DLS provider.  The style 2 provider requires a DLS user to explicitly identify the desired physical point of attachment (PPA) using the <b>DL_ATTACH_REQ</b> primitive. </p><p class="Body"><a name="82917" class="autotag"> </a>The DLPI driver uses the STREAMS buffering mechanism; whereas the generic Wind River network drivers are based on the BSD mbufs buffering mechanism.  The WindNet STREAMS DLPI driver reconciles this difference by converting every mbuf-based packet received to a packet based on STREAMS message blocks, and while transmitting, every STREAMS message block is converted to an mbuf-based packet.  See the <i class="title">VxWorks BSP Porting Kit</i> for guidelines on the writing of generic VxWorks network drivers. </p><p class="Body"><a name="91160" class="autotag"> </a>The attach request primitive <b>DL_ATTACH_REQ</b>, generated by the user, should include in the attach request message the name of the network device to be attached.  The attach request primitive implemented in the DLPI driver gets the name of the appropriate network device from the attach request message.  It then gets the pointer to the appropriate network controller data structure from that name.  The following code shows how the DLS user generates the <b>DL_ATTACH_REQ</b> primitive:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="95228" class="autotag">{</a><a name="95229" class="autotag">int          fd;              /* fd of interface */</a><a name="91163" class="autotag">char         *ppaName;        /* Name of the interface */</a><a name="91164" class="autotag">char         buf[64];         /* DL_ATTACH_REQ buffer */</a><a name="91165" class="autotag">dl_attach_req_t * dlAr = (dl_attach_req_t *)buf;</a><a name="91166" class="autotag">dlAr-&gt;dl_primitive = DL_ATTACH_REQ;</a><a name="91167" class="autotag"></a><a name="91168" class="autotag">/* Create the DL_ATTACH_REQ primitive */</a><a name="91169" class="autotag"></a><a name="91170" class="autotag">dlAr-&gt;dl_ppa = 0;</a><a name="91171" class="autotag">strcpy((char *)&amp;dlAr[1], ppa_name);</a><a name="91172" class="autotag">ctlbuf.len = sizeof(*dlAr) + strlen(ppa_name) + 1;</a><a name="91173" class="autotag"></a><a name="91174" class="autotag">/* The attach request primitive is sent to the DLPI provider. Here the </a><a name="91175" class="autotag">* DLS user is an user application program. If the DLS user is a network </a><a name="91176" class="autotag">* protocol module, then the attach request primitive should be sent to </a><a name="91177" class="autotag">* DLS provider as an M_PROTO message</a><a name="91178" class="autotag">*/ </a><a name="91179" class="autotag"></a><a name="91180" class="autotag">if ( putmsg(fd, &amp;ctlbuf, nilp(struct strbuf), 0) == -1 ) </a><a name="91181" class="autotag">    {</a><a name="91182" class="autotag">    warn("dl_attach: putmsg failed, %s\n", errmsg(0));</a><a name="91183" class="autotag">    return false;</a><a name="91184" class="autotag">    }</a><a name="91185" class="autotag">...</a><a name="91186" class="autotag">...</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="84397" class="autotag"> </a>}</p><p class="Body"><a name="84398" class="autotag"> </a>After the DLPI driver receives a packet, it sends the packet to the appropriate stream, based on the SAP value.  The packet <font face="Palatino, serif"><i class="textVariable">type</i></font> field in the Ethernet frame contains that SAP value.  This DLPI driver supports only Ethernet frame formats.  It does not support IEEE 802.3 frame formats. </p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="82923" class="autotag">3.3.3&nbsp;&nbsp;DLPI Services</a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="82924" class="autotag"> </a>This library supports the subset of DLPI services listed in <a href="streams.doc9.html#86588"><i class="title">Table&nbsp;4</i></a>. <p class="table"><h4 class="EntityTitle"><a name="86588" class="autotag"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 4.  &nbsp;&nbsp;DLPI Primitives</font></a></h4><table border="0" cellpadding="3" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="86590" class="autotag"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Primitive</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="86620" class="autotag"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Service Provided</font></b></div></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"></th><th rowspan="1" colspan="1"></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86594" class="autotag"> </a><b>DL_ATTACH_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86624" class="autotag"> </a>Assign a physical point of attachment (PPA) to a stream.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86596" class="autotag"> </a><b>DL_DETACH_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86626" class="autotag"> </a>Request the DLS provider to detach a physical point of attachment (PPA) from a stream.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86598" class="autotag"> </a><b>DL_BIND_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86628" class="autotag"> </a>Request the DLS provider to bind a data link SAP (DLSAP) to the stream.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86600" class="autotag"> </a><b>DL_BIND_ACK</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86630" class="autotag"> </a>Report the successful bind of a data link SAP to a stream, and return the bound DLSAP address to the DLS user.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86602" class="autotag"> </a><b>DL_INFO_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86632" class="autotag"> </a>Request information of the DLS provider about the DLPI stream.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86604" class="autotag"> </a><b>DL_INFO_ACK</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86634" class="autotag"> </a>Convey information about the DLPI stream to the DLS user by sending a message in response to <b>DL_INFO_REQ</b>.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86606" class="autotag"> </a><b>DL_UNBIND_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86636" class="autotag"> </a>Request the DLS provider to unbind the DLSAP bound by a previous <b>DL_BIND_REQ</b> from this stream.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86608" class="autotag"> </a><b>DL_ERROR_ACK</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86638" class="autotag"> </a>Inform the DLS user that a previously issued request or response was invalid.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86610" class="autotag"> </a><b>DL_UNITDATA_REQ</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86640" class="autotag"> </a>Convey one data link service data unit (DLSDU) from the DLS provider for transmission to a peer DLS user.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86612" class="autotag"> </a><b>DL_UNITDATA_IND</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86642" class="autotag"> </a>Convey one DLSDU from the DLS provider to the DLS user.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="86614" class="autotag"> </a><b>DL_OK_ACK</b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86644" class="autotag"> </a>Acknowledge to the DLS user that a previously issued request primitive was received successfully.</div></td></tr><tr valign="top"><td colspan=1 rowspan=1></td><td colspan=1 rowspan=1></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p><p class="Body"><a name="82949" class="autotag"> </a>For an extensive reference to DLPI Version 2.0, see the <i class="title">Data Link Provider Interface Specification</i> (UNIX International)  and <i class="title">STREAMS Modules and Drivers UNIX SVR4.2</i> (UNIX Press). </p></dd></dl></dd></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="../../icons/contents.gif"></a><a href="streams.doc8.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc10.html"><img border="0" alt="[Next]" src="../../icons/next.gif"></a></p></body></html><!---This file generated April 10, 1998, 12:25PM PDTby WRS Documentation (jeff), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 3.5.0    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

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