📄 c-wtx2.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> The WTX Protocol </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="c-wtx.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-wtx.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-wtx1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-wtx3.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="84391">4.2 Protocol Overview</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84392"> </a>The WTX protocol permits a number of tools running on a host system to communicate with one or more host-based target servers, in order to operate on targets running VxWorks (see <a href="c-wtx2.html#84399">Figure 4-1</a>).Target servers can also connect to VxSim, a target simulator. A target server can connect to only one target, but a tool can connect to more than one target server at a time, allowing multi-processor application development. <div class="frame"><h4 class="EntityTitle"><a name="84399"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-1: WTX Protocol Environment</font></a></h4><dl class="margin"><div class="Anchor"><a name="84424"> </a><img class="figure" border="0" src="images/c-wtx0.gif"></div></dl></div></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84425">4.2.1 Language Support</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84427"> </a>The WTX protocol is usually accessed by Tcl commands or C functions rather than directly (see <a href="c-wtx2.html#89693">Figure 4-2</a>). Introductory material for protocol and language bindings is presented in <a href="c-wtx4.html#85250"><i class="title">4.4 WTX Tcl API</i></a> and in <a href="c-wtx5.html#85723"><i class="title">4.5 WTX C API</i></a>. Tornado provides a Tcl interpreter and <a href="c-wtx4.html#85250"><i class="title">4.4 WTX Tcl API</i></a> offers many interactive examples. You may want to work through the Tcl examples to become familiar with WTX even if you plan to program primarily in a compiled C environment.</p><dd><p class="Body"><a name="89689"> </a>The WTX Java API provides a set of Java classes permitting access to the WTX protocol services. It is built on top of the WTX C API using the Java Native Interface. Use this interface to create tools that access the target server or the Tornado registry when Java is the implementation language. This API is unsupported. It can be downloaded from the Wind River System WEB server (www.wrs.com). <div class="frame"><h4 class="EntityTitle"><a name="89693"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-2: WTX APIs</font></a></h4><dl class="margin"><div class="Anchor"><a name="89713"> </a><img class="figure" border="0" src="images/c-wtxa1.gif"></div></dl></div></p><dd><p class="Body"><a name="84465"> </a>The online reference material under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Tornado API Guide>WTX Protocol</font></b>, <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">WTX Tcl Library</font></b>, and <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">WTX C Library </font></b>gives detailed descriptions of WTX services, error messages, and API parameters.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84466">4.2.2 WTX Protocol Usage</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84467"> </a>The WTX protocol provides the interface between the tools and the target server. A tool requests information or an action of the target server, WTX conveys that request, and the target server makes an appropriate response. <a href="c-wtx2.html#84474">Figure 4-3</a> is a schematic representation of a series of interactions between WindSh (a tool) and the target server, showing how WTX commands fit into the process. <div class="frame"><h4 class="EntityTitle"><a name="84474"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-3: WTX Protocol Links Tool to Target</font></a></h4><dl class="margin"><div class="CellBody"><a name="84534"> </a><img class="figure" border="0" src="images/c-wtxa2.gif"></div></dl></div></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84535">4.2.3 WTX Message Format</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84537"> </a>All WTX messages are defined in<b class="symbol_UC"> </b><i class="textVariable">installDir</i><b class="symbol_UC">/</b><b class="file">host/include/wtxmsg.h</b>. Their names are prefixed with "<b class="symbol_UC">WTX_MSG_</b>". They all contain a <b class="symbol_UC">WTX_CORE</b> structure (shown below) which carries the identifier of the tool making the request and an <b class="keyword">errCode</b> field. The <b class="keyword">errCode</b> contains <b class="symbol_UC">OK</b> (0) when the call succeeds or an error status code (a value other than 0) when the call fails. The error status corresponds to the <b class="keyword">errno</b> set by the server. The error status values are defined in <i class="textVariable">installDir</i>/<b class="file">host/inclu</b><b>de/wtxerr.h</b>.</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="84539">typedef struct wtx_core /* WTX message core */ { UINT32 objId; /* identifier */ WTX_ERROR_T errCode; /* service error code */ UINT32 protVersion; /* WTX protocol version */ } WTX_CORE;</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84545">4.2.4 Debugging WTX Tools</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="86304"> </a>The target server option <b class="operator">-Wd</b> <i class="textVariable">filename</i> is designed to simplify debugging WTX tools. This option causes all the WTX messages exchanged between the connected tools and the target server to be written to the specified file. A sample file is as follows:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="86832">User Name : chrisc Started : Fri Jan 8 17:59:37 1999 Target Server Name : t80-202@couesnon Target Name : t80-202 Target Server Options : tgtsvr.ex -V -Wd /tmp/WTXtrace t80-202 Host : SunOS couesnon 5.5.1 Generic_103640-12 sun4u 0 8 WTX_TOOL_ATTACH Fri Jan 8 17:59:48 1999 In WTX_MSG_TOOL_DESC WTX_CORE objId 0x0 errCode 0 protVersion 0 WTX_TOOL_DESC id 0x0 toolName wtxtcl toolArgv Unknown toolVersion Unknown userName chrisc@couesnon pReserved Unknown next Unknown Out status Ok WTX_MSG_TOOL_DESC WTX_CORE objId 0x0 errCode 0 protVersion 0 WTX_TOOL_DESC id 0x1a5278 toolName wtxtcl toolArgv Unknown toolVersion Unknown userName chrisc@couesnon pReserved Unknown next Unknown</a></b></pre></dl></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="c-wtx.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-wtx.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-wtx1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-wtx3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -