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

📄 snmpsnmp.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* snmpSnmp.c - snmp v1 method routines for snmp group *//* *  Copyright 2000-2005 Wind River Systems, Inc. *  All rights reserved.  Provided under license only. *  Distribution or other use of this software is only *  permitted pursuant to the terms of a license agreement *  from Wind River Systems (and is otherwise prohibited). *  Refer to that license agreement for terms of use. */#include "copyright_wrs.h"/*modification history-------------------01d,19apr05,job  update copyright notices01c,01dec03,job  update copyright information01b,21oct98,ann  fixed logical error in snmpTest (SPR# 21819)01a,10mar96,rjc  written*//* * $Log: snmpsnmp.c,v $ * Revision 1.4  2001/11/09 17:30:25  tneale * Another adjustment for generated header files * * Revision 1.3  2001/11/09 14:54:09  tneale * Fixed paths for generated files mibhand.h and mibleaf.h * * Revision 1.2  2001/11/08 22:18:35  meister * rework pathnames * * Revision 1.1.1.1  2001/11/05 17:47:50  tneale * Tornado shuffle * * Revision 1.7  2001/06/21 17:45:16  josh * Make sure all objects are properly handled -- we shouldn't be * generating GEN_ERRs while doing a tree walk * * Revision 1.6  2001/01/19 22:25:06  paul * Update copyright. * * Revision 1.5  2000/03/09 17:42:27  josh * setting up prototypes and includes where appropriate to eliminate * build warnings * * Revision 1.4  2000/03/08 23:09:02  sar * Added code for silent and proxy drops but leave it turned off for backwards * compatibility reasons * * Revision 1.3  2000/03/07 21:17:29  josh * fixing log comments * * Revision 1.2  2000/03/07 20:58:37  josh * putting CVS headers and logs into files that were lacking * *//* includes */#include <wrn/wm/snmp/vxagent/snmpdLib.h>#include <wrn/wm/snmp/engine/snmpstat.h>#include "m2Lib.h"#include <wrn/wm/snmp/vxagent/mibleaf.h>#include <wrn/wm/snmp/vxagent/mibhand.h>#include <wrn/wm/snmp/engine/auxfuncs.h>/* globals */SNMP_STATS_T    snmp_stats;    /* structure for snmp statistics */    /*******************************************************************************  snmpGet -  Get method routine for snmp. **  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.**  NOMANUAL**  RETURNS: N/A*/    void snmpGet    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);     if (compc != 1 || *compl != 0)        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            getproc_nosuchins (pktp, vbp);            }        return;        }    for ( ; vbp; vbp = vbp->vb_link)        {        switch(vbp->vb_ml.ml_last_match)            {            case LEAF_snmpInPkts:                getproc_got_uint32  (pktp, vbp, snmp_stats.snmpInPkts,                                   VT_COUNTER);                break;            case LEAF_snmpInBadCommunityNames:                getproc_got_uint32 (pktp, vbp,                                     snmp_stats.snmpInBadCommunityNames,                                     VT_COUNTER);                break;            case LEAF_snmpInBadCommunityUses:                getproc_got_uint32 (pktp, vbp,                                     snmp_stats.snmpInBadCommunityUses,                                     VT_COUNTER);                break;            case LEAF_snmpInASNParseErrs:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInASNParseErrs,                                     VT_COUNTER);                break;            case LEAF_snmpOutPkts:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutPkts,                                     VT_COUNTER);                break;            case LEAF_snmpInBadVersions:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInBadVersions,                                     VT_COUNTER);                break;            case LEAF_snmpInTooBigs:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInTooBigs,                                     VT_COUNTER);                break;            case LEAF_snmpInNoSuchNames:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInNoSuchNames,                                     VT_COUNTER);                break;            case LEAF_snmpInBadValues:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInBadValues,                                     VT_COUNTER);                break;            case LEAF_snmpInReadOnlys:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInReadOnlys,                                     VT_COUNTER);                break;            case LEAF_snmpInGenErrs:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInGenErrs,                                     VT_COUNTER);                break;            case LEAF_snmpInTotalReqVars:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInTotalReqVars,                                     VT_COUNTER);                break;            case LEAF_snmpInTotalSetVars:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInTotalSetVars,                                     VT_COUNTER);                break;            case LEAF_snmpInGetRequests:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInGetRequests,                                     VT_COUNTER);                break;            case LEAF_snmpInGetNexts:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInGetNexts,                                     VT_COUNTER);                break;            case LEAF_snmpInSetRequests:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInSetRequests,                                     VT_COUNTER);                break;            case LEAF_snmpInGetResponses:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInGetResponses,                                     VT_COUNTER);                break;            case LEAF_snmpInTraps:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpInTraps,                                     VT_COUNTER);                break;            case LEAF_snmpOutTooBigs:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutTooBigs,                                     VT_COUNTER);                break;            case LEAF_snmpOutNoSuchNames:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutNoSuchNames,                                     VT_COUNTER);                break;            case LEAF_snmpOutBadValues:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutBadValues,                                     VT_COUNTER);                break;            case LEAF_snmpOutGenErrs:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutGenErrs,                                     VT_COUNTER);                break;            case LEAF_snmpOutGetRequests:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutGetRequests,                                     VT_COUNTER);                break;            case LEAF_snmpOutGetNexts:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutGetNexts,                                     VT_COUNTER);                break;            case LEAF_snmpOutSetRequests:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutSetRequests,                                     VT_COUNTER);                break;            case LEAF_snmpOutGetResponses:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutGetResponses,                                     VT_COUNTER);                break;            case LEAF_snmpOutTraps:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpOutTraps,                                     VT_COUNTER);                break;            case LEAF_snmpEnableAuthenTraps:                getproc_got_int32 (pktp, vbp,                                   (INT_32_T)snmp_stats.snmpEnableAuthTraps);                 break; 	    /* The following two cases are included to show how the proxy	       and silent drops objects would be handled.  They're included               for thse builds which already necessarily include RFC 1907, 	       but are otherwise excluded */#if (INSTALL_ENVOY_VXWORKS_RFC2233)            case LEAF_snmpSilentDrops:                getproc_got_uint32 (pktp, vbp, snmp_stats.snmpSilentDrops,				    VT_COUNTER);                 break;             case LEAF_snmpProxyDrops:	        getproc_got_uint32 (pktp, vbp, snmp_stats.snmpProxyDrops,				    VT_COUNTER);                 break; #endif /* #if (INSTALL_ENVOY_VXWORKS_RFC2233) */            default:                getproc_error  (pktp, vbp, GEN_ERR);                return;             }        }    }        /*******************************************************************************  snmpSet -  Get method routine for snmp. **  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.**  NOMANUAL**  RETURNS: N/A*/void snmpSet    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    snmp_stats.snmpEnableAuthTraps = vbp->value_u.v_number;    setproc_good (pktp, vbp);    return;    }        /*******************************************************************************  snmpTest -  Get method routine for snmp. **  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.**  NOMANUAL**  RETURNS: N/A*/    void snmpTest    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    if ((compc != 1) && (*compl != 0))        {       testproc_error (pktp, vbp, GEN_ERR);       return;       }    /* Check for the only 2 permissible values */    if ((vbp->value_u.v_number != VAL_snmpEnableAuthenTraps_enabled) &&         (vbp->value_u.v_number !=  VAL_snmpEnableAuthenTraps_disabled))       {       testproc_error (pktp, vbp, WRONG_VALUE);       return;       }    testproc_good (pktp, vbp);    }    

⌨️ 快捷键说明

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