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

📄 c-extend3.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
    for ( ; vbp; vbp = vbp-&gt;vb_link)       getproc_nosuchins(pktp, vbp);     return;     }    sysVars.sysState = VAL_sysState_system_running;  /* System is Running */    /* Get data from vxWorks */    remCurIdGet (sysVars.sysUserName, sysVars.sysUserPassw);        /* retrieve all the values from the same data structure */    for ( ; vbp; vbp = vbp-&gt;vb_link) {     if ((error = sysconfig_get_value(vbp-&gt;vb_ml.ml_last_match, pktp,          vbp, &amp;sysVars)) != NO_ERROR)       getproc_error(pktp, vbp, error);     } }   /* The next method routine. It is similar to the get routine except the    check done is different   */  void   sysconfig_next(OIDC_T      lastmatch,                  int         compc,                  OIDC_T     *compl,                 SNMP_PKT_T *pktp,                 VB_T       *vbp) {   OIDC_T instance = 0;    /* the only time there's a next for a scalar is if we're given    * no instance at all. */    if (compc != 0)     {     nextproc_no_next(pktp, vbp);     return;     }    sysVars.sysState = VAL_sysState_system_running;  /* System is Running */    /* Get data from VxWorks */   remCurIdGet (sysVars.sysUserName, sysVars.sysUserPassw);     for (snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);      vbp; vbp = vbp-&gt;vb_link) {      nextproc_next_instance(pktp, vbp, 1, &amp;instance);      sysconfig_get_value(vbp-&gt;vb_ml.ml_last_match, pktp, vbp, &amp;sysVars);   } }   /* The test method routine. We perform a number fo checks on the  * input varbinds to decide if the set should proceed or not */  void   sysconfig_test(OIDC_T      lastmatch,                  int         compc,                  OIDC_T     *compl,                 SNMP_PKT_T *pktp,                 VB_T       *vbp) {   VB_T *group_vbp;    /* Only scalar variables here, check for .0 */   if (!((compc == 1) &amp;&amp; (*compl == 0))) {     testproc_error(pktp, vbp, NO_SUCH_NAME);     return;   }    /* find all the varbinds that share the same getproc and instance and    * group them together. */    snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);    /* now check each varbind */    for (group_vbp = vbp;        group_vbp;        group_vbp = group_vbp-&gt;vb_link) {      switch (group_vbp-&gt;vb_ml.ml_last_match) {      case LEAF_sysState:        switch (VB_GET_INT32(group_vbp)) {       case VAL_sysState_system_reboot:         break;        case VAL_sysState_system_running:       default:         testproc_error(pktp, group_vbp, WRONG_VALUE);         continue;       }        testproc_good(pktp, group_vbp);       break;      case LEAF_sysUserName:        { long length = EBufferUsed(VB_GET_STRING(group_vbp));          if (!((length &gt;= MINSIZE_sysUserName) &amp;&amp;               (length &lt;= MAXSIZE_sysUserName))) {           testproc_error(pktp, group_vbp, WRONG_VALUE);           break;         }       }       testproc_good(pktp, group_vbp);       break;      case LEAF_sysUserPassw:        { long length = EBufferUsed(VB_GET_STRING(group_vbp));          if (!((length &gt;= MINSIZE_sysUserPassw) &amp;&amp;               (length &lt;= MAXSIZE_sysUserPassw))) {           testproc_error(pktp, group_vbp, WRONG_VALUE);           break;         }       }        testproc_good(pktp, group_vbp);       break;      default:       testproc_error(pktp, group_vbp, GEN_ERR);       return;     }   } }  /* This routine reboots the VxWorks target. */ void snmpReboot ()     {     printf("\007\007SNMP System Reboot Command in progress\n");     taskDelay (200);    /* Wait 200 ticks before Reboot */     reboot (0);         /* Reboot System */     }    void   sysconfig_set(OIDC_T      lastmatch,                 int         compc,                 OIDC_T     *compl,                 SNMP_PKT_T *pktp,                 VB_T       *vbp) {    for ( ; vbp; vbp = vbp-&gt;vb_link) {      switch (vbp-&gt;vb_ml.ml_last_match) {      case LEAF_sysState:        sysVars.sysState = VB_GET_INT32(vbp);                   if (taskSpawn ((char*)NULL, 150, VX_NO_STACK_FILL, 1024,                 (FUNCPTR) snmpReboot, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == ERROR)           {           setproc_error (pktp, vbp, COMMIT_FAILED);           return;           }       else           {           setproc_good(pktp, vbp);           }       break;      case LEAF_sysUserName:        /* Get data from VxWorks */       remCurIdGet (sysVars.sysUserName, sysVars.sysUserPassw);        (void) memcpy (sysVars.sysUserName, EBufferStart (VB_GET_STRING(vbp)),                      EBufferUsed (VB_GET_STRING(vbp))) ;       sysVars.sysUserName [EBufferUsed (VB_GET_STRING(vbp))] = '\0';        /* Set data from VxWorks */       remCurIdSet (sysVars.sysUserName, sysVars.sysUserPassw);        setproc_good(pktp, vbp);       break;      case LEAF_sysUserPassw:        /* Get data from VxWorks */       remCurIdGet (sysVars.sysUserName, sysVars.sysUserPassw);         (void) memcpy (sysVars.sysUserPassw, EBufferStart (VB_GET_STRING(vbp)),                      EBufferUsed (VB_GET_STRING(vbp)));        sysVars.sysUserPassw [EBufferUsed (VB_GET_STRING(vbp))] = '\0';        /* Set data from VxWorks */       remCurIdSet (sysVars.sysUserName, sysVars.sysUserPassw);        setproc_good(pktp, vbp);       break;      default:       setproc_error(pktp, vbp, COMMIT_FAILED);       return;     }   } }</a></b></pre></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="84245"><br></a><img border="0" alt="*" src="icons/note.gif">&nbsp;&nbsp;&nbsp;</td><td><div class="Note"><hr><b class="symbol_UC">NOTE: </b>Also see <a href="c-extend5.html#84336"><i class="title">6.5&nbsp;Asynchronous Method Routines</i></a>.<hr></div></td></tr></table></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h4 class="HStep"><i><a name="84246">Step 5: &nbsp;&nbsp;Building the Agent</a></i></h4></font><dl class="margin"><dd><p class="Body"><a name="84247"> </a>After the method routines have been written, the next step is to build the agent with the new MIB source. A makefile to help automate this task is provided. Be sure to copy the new MIB file into the agent directory (shown below), or to point to it on the command line.</p></dl></dl><h4 class="EntityTitle"><a name="84248"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 6-5:&nbsp;&nbsp;Building the Agent</font></a></h4><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84249"> </a>To rebuild for a SunOS host and an MVME147 target, first enter the following from your working MIB development directory:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84250"></b><tt class="output">% </tt><b>cp demo.c demo.mib $WIND_BASE/target/src/snmpv1/agent</a></b><dd> <b><a name="84251"></b><tt class="output">% </tt><b>cd $WIND_BASE/target/src/snmpv1/agent</a></b></pre></dl><dd><p class="Body"><a name="84252"> </a>The build requires three variables: <b class="symbol_UC">MIBSRC</b> to specify the MIB information file(s); <b class="symbol_UC">CPU</b> to specify the target CPU type; and <b class="symbol_UC">TOOL</b> to specify the host tool chain. The <b class="symbol_UC">CPU</b> and <b class="symbol_UC">TOOL</b> values must be specified when invoking the <b class="command">make</b> command. <b class="symbol_UC">CPU</b> and <b class="symbol_UC">TOOL</b> for a particular host and target can be determined by looking in the makefile provided in the target-specific BSP directory. Both of these values are defined in this file.</p><dd><p class="Body"><a name="84253"> </a>Edit your makefile and add <b class="file">demo.o</b> (the object to build) to the make variable <b class="symbol_UC">OBJ</b>, and add <b class="file">demo.mib</b> to the variable <b class="symbol_UC">MIBSRC</b>. Then enter:</p><dl class="margin"><dd><pre class="Code2"><b><a name="84254"></b><tt class="output">% </tt><b>make CPU=MC68020 TOOL=gnu clean</a></b><dd> <b><a name="84255"></b><tt class="output">% </tt><b>make CPU=MC68020 TOOL=gnu</a></b></pre></dl></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h4 class="HStep"><i><a name="84256">Step 6: &nbsp;&nbsp;Integrating the Agent into VxWorks </a></i></h4></font><dl class="margin"><dd><p class="Body"><a name="84257"> </a>Rebuild VxWorks. Make sure the VxWorks SNMP agent is configured to be built into the VxWorks image (see <a href="c-config.html#83635"><i class="title">5.&nbsp;Configuring the WindNet SNMPv1/v2c Agent</i></a>). The next time the target boots, the new variables should be included in the agent MIB. </p></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-extend.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-extend2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-extend4.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 + -