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

📄 c-agent3.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>    The WindNet SNMPv1/v2c Agent   </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><a href="c-agent.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-agent2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-agent4.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="85593">4.3  &nbsp;&nbsp;Data Types and Data Structures</a></i></h3></font><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83690">4.3.1  &nbsp;&nbsp;General Types</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83691"> </a>Most of the general types are defined as type definitions (<b class="command">#typedef</b>) in the header file <b class="file">asn1conf.h</b>. You should not modify this file.</p></dl><dl class="margin"><dd><div class="Item"><a name="83692"> </a><b class="symbol_UC">ALENGTH_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83693"> </a>The fully decoded value of an ASN.1 length field.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83694"> </a><b class="symbol_UC">ATVALUE_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83695"> </a>The fully decoded value of an ASN.1 tag, excluding the context and constructor bits.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83696"> </a><b class="symbol_UC">INT_16_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83697"> </a>Signed 16-bit integer.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83698"> </a><b class="symbol_UC">INT_32_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83699"> </a>Signed 32-bit integer. MIB variables of type <b class="keyword">Integer</b> ought to be of this type.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83700"> </a><b class="symbol_UC">OCTET_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83701"> </a>Unsigned 8-bit character.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83702"> </a><b class="symbol_UC">OIDC_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83703"> </a>An object identifier component. By default this is a 32-bit unsigned integer. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83704"> </a><b class="symbol_UC">UINT_8_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83705"> </a>Unsigned 8-bit integer.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83706"> </a><b class="symbol_UC">UINT_16_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83707"> </a>Unsigned 16-bit integer.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83708"> </a><b class="symbol_UC">UINT_32_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83709"> </a>Unsigned 32-bit integer. MIB variables of type <b class="keyword">Counter</b>, <b class="keyword">Gauge</b>, and <b class="keyword">TimeTicks</b> ought to be of this type.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83710"> </a><b class="symbol_UC">EBUFFER_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83711"> </a>Variables of type <b class="symbol_UC">EBUFFER_T</b> are used to hold strings of bytes generated by the ASN.1 encoding routines. <b class="symbol_UC">EBUFFER_T</b> is also used as a general mechanism for managing variable length byte strings.</div><br><dd><div class="Indent4"><a name="83712"> </a>The <b class="symbol_UC">EBUFFER_T</b> type does not itself include the storage to hold the byte string. That storage is provided by the user of the <b class="symbol_UC">EBUFFER_T</b>. Such storage may be dynamic or static (relative to the lifetime of the <b class="symbol_UC">EBUFFER_T</b> variable itself.)</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83713"> </a><b class="symbol_UC">OBJ_ID_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83714"> </a>An ASN.1 object identifier, in local representation. Manipulation of data structures of this type comprises a significant portion of the execution time used by this SNMP implementation.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83715"> </a><b class="symbol_UC">PTR_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83716"> </a>A generic void pointer. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83717"> </a><b class="symbol_UC">SNMPADDR_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83718"> </a>This type is used to hold network addresses in a general way. It is very similar to the <b class="keyword">sockaddr</b> structure used with the Berkeley socket interface.</div><br></dl></dl></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83719">4.3.2  &nbsp;&nbsp;MIB Tree Types</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="83720"> </a><b class="symbol_UC">MIBLEAF_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83721"> </a>Each instance of type <b class="symbol_UC">MIBLEAF_T</b> represents a scalar (non-tabular) management variable, or an attribute (column) in a table of management variables. The <b class="symbol_UC">MIBLEAF_T</b> instance points to procedures and other information needed to access the associated management variable.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83722"> </a><b class="symbol_UC">MIBNODE_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83723"> </a>Each instance of type <b class="symbol_UC">MIBNODE_T</b> represents an internal node of the management information base tree. Each <b class="symbol_UC">MIBNODE_T</b> is associated with a list of elements of type <b class="symbol_UC">MIBARC_T</b>. This list indicates the <b class="symbol_UC">MIBNODE_T</b> and <b class="symbol_UC">MIBLEAF_T</b> variables at the next lower level of the MIB tree.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83724"> </a><b class="symbol_UC">MIBARC_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83725"> </a>Instances of <b class="symbol_UC">MIBARC_T</b> are used to designate the nodes and leaves of the management information tree which descend from a particular internal node of the tree.</div><br></dl></dl></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83726">4.3.3  &nbsp;&nbsp;SNMP Packet Representation</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="83727"> </a><b class="symbol_UC">SNMP_PKT_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83728"> </a>An SNMP packet is represented internally by an element of type <b class="symbol_UC">SNMP_PKT_T</b>. This type contains a tagged union with two principal variations, one for <b class="keyword">REQUEST</b> and <b class="keyword">RESPONSE</b> PDUs, the other for <b class="keyword">TRAP</b> PDUs.</div><br><dd><div class="Indent4"><a name="83729"> </a>Various additional fields are present to give the MIB developer a means to determine access privileges, MIB views, etc. (for more detailed information, see the definition for the internal representation of an SNMP packet in the file <b class="file">snmpdefs.h</b>). In addition, a pointer is provided (<i class="textVariable">user_private</i>) through which a developer may attach a private data structure. This memory can be released using a private-memory-deallocation hook (see <a href="c-agent8.html#83905"><i class="title">4.8&nbsp;Hooks</i></a>) when the packet has finished processing (the hook is installed during initialization, in the routine <b class="routine"><i class="routine">snmpdInitFinish</i></b><b>(&nbsp;)</b>).</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83733"> </a><b class="symbol_UC">VB_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83737"> </a>Each <i class="term">VarBind</i> (see <a href="c-agent11.html#83986"><i class="title">4.11&nbsp;Request Processing</i></a>) in an SNMP PDU's <i class="term">VarBindList</i> is held in an item of type <b class="symbol_UC">VB_T</b>. This type contains a tagged union capable of holding all of the data types defined by the RFC 1155 and RFC 1902 SMIs.</div><br><dd><div class="Indent4"><a name="83738"> </a>The <b class="symbol_UC">VB_T</b> structure contains additional fields which are intended to be used by a MIB designer when processing incoming PDUs (during the method-routine phase). One of these fields is a linked-list pointer giving the MIB developer the means to generate a relationship between items in a <i class="term">VarBindList</i>. Two other fields are provided to allow the MIB developer to associate space with a <b class="symbol_UC">VB_T</b> item, and to have that space deallocated when the <b class="symbol_UC">VB_T</b> is freed. These are intended for use when a test routine must acquire some resources to determine if a <b class="keyword">SET</b> may be accomplished. The <i class="textVariable">vb_priv</i> field in the <b class="symbol_UC">VB_T</b> may be used to point to these resources while the <i class="textVariable">vb_free_priv</i> field is used to point to a routine which frees user-defined memory. If <i class="textVariable">vb_free_priv</i> is non-null when a packet is being deallocated, the routine pointed to by <i class="textVariable">vb_free_priv</i> is called and may free up any resources that the <b class="symbol_UC">VB_T</b> specifies.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="83739"> </a><b class="symbol_UC">VBL_T</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="83740"> </a>In general, the <i class="term">VarBindList</i> found in SNMP PDUs is represented as an array of elements of type <b class="symbol_UC">VB_T</b>. The location and size of such an array is held in an item of type <b class="symbol_UC">VBL_T</b>. While processing a <b class="keyword">GET BULK</b> request, where the number of <b class="symbol_UC">VB_T</b> variables is not known when the packet is created, additional <b class="symbol_UC">VBL_T</b> variables may be chained in a list using a pointer in the <b class="symbol_UC">VBL_T</b> structure.</div><br></dl></dl></dl></dl></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><a href="c-agent.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-agent2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-agent4.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 + -