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

📄 v3mt_tgt.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 5 页
字号:
/* *  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. *//* *  Copyright 1999 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: v3mt_tgt.c,v $ * Revision 1.2  2001/11/06 21:20:34  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:40  tneale * Tornado shuffle * * Revision 9.10.4.3  2001/10/16 14:50:26  josh * make sure that the migration from notReady to notInService takes place * correctly for the snmpTargetParamsTable * * Revision 9.10.4.2  2001/09/28 20:49:07  josh * method routines will now allow rows to be created as permanent or * read-only rows.  It will also prevent the deletion of such rows. * * Revision 9.10.4.1  2001/07/16 18:02:11  josh * a first-round commit adding infrastructure support * for the SNMPv3 Coexistence RFC (2576) * * Revision 9.10  2001/04/30 17:37:33  josh * the snmpTargetAddrTable method routines are now a bit more * selective about the values of snmpTargetAddrTAddres that they * allow.  We only do anything special if snmpTargetAddrTDomain is * snmpUDPDomain, but if it is we prevent certain state transitions * in the row status object if the TAddress isn't exactly six bytes * long (we prevent notReady to notInService and notInService to * active, depending on where things started) * * Revision 9.9  2001/04/17 19:12:19  josh * make sure method routines return proper error codes and fully * check format of set tags * * Revision 9.8  2001/04/11 20:12:00  josh * merging changes from the kingfisher branch back onto * the trunk * * Revision 9.7  2001/01/19 22:22:01  paul * Update copyright. * * Revision 9.6.2.2  2001/03/12 22:07:45  tneale * Updated copyright * * Revision 9.6.2.1  2000/11/30 19:40:05  josh * fixing a few small bugs in the notify code and method routines... * * Revision 9.6  2000/03/17 00:17:49  meister * Update copyright message * * Revision 9.5  2000/03/10 15:02:39  josh * fixes to the setproc/cleanup/undoprocs regarding row creation, * so we can back out gracefully but still not shoot ourselves in * foot while doing regular cleanups. * * Revision 9.4  2000/02/16 18:45:53  josh * returning WRONG_LENGTH instead of WRONG_VALUE, where appropriate * * Revision 9.3  2000/02/04 21:56:12  josh * functions which are clearly static have been declared as such. * this makes the vxWorks compiler happy. * * Revision 9.2  2000/01/02 22:55:55  josh * patching up a memory leak here, a broken compare there...per * sar's comments * * Revision 9.1  1999/10/29 21:04:19  josh * fixing a minor nit with NV macros * * Revision 9.0  1999/10/21 20:44:41  josh * updating version stamps * * Revision 1.3  1999/10/21 19:07:21  josh * fixing method routine bugs discovered in testing * * Revision 1.2  1999/10/18 22:49:50  josh * patches to method routines and related code * * Revision 1.1  1999/10/15 13:04:14  josh * method routines for Target MIB from RFC2573 * *//* [clearcase]modification history-------------------01b,18apr05,job  update copyright notices01a,24nov03,job  update copyright information*/#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/mib.h>#include <wrn/wm/snmp/engine/localio.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include <wrn/wm/snmp/engine/objectid.h>#include <wrn/wm/snmp/engine/v3_trgt.h>#include <wrn/wm/snmp/engine/ntfy_chk.h>#if INSTALL_ENVOY_SNMP_COEXISTENCE#include <wrn/wm/snmp/engine/v3_comm.h>#endif /* #if INSTALL_ENVOY_SNMP_COEXISTENCE *//* default values for the macros to map the method routines   to the target_addrs non volatile storage */#if !defined(SNMP_V3_TADDR_DESTROY_BACKOUT)#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TADDR_CREATE_BACKOUT)#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TADDR_UPDATE_BACKOUT)#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TADDR_FINISHED)#define SNMP_V3_TADDR_FINISHED()#endif#if !defined(SNMP_V3_TADDR_DESTROY_TEST)#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TADDR_CREATE_TEST)#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TADDR_UPDATE_TEST)#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TADDR_DESTROY_SET)#define SNMP_V3_TADDR_DESTROY_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_TADDR_CREATE_SET)#define SNMP_V3_TADDR_CREATE_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_TADDR_UPDATE_SET)#define SNMP_V3_TADDR_UPDATE_SET(PKT, VBP, CUR, NEW)#endif/* these aren't defined by default *//*#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV)*//* default values for the macros to map the method routines   to the target_params non volatile storage */#if !defined(SNMP_V3_TPARAM_DESTROY_BACKOUT)#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TPARAM_CREATE_BACKOUT)#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TPARAM_UPDATE_BACKOUT)#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_TPARAM_FINISHED)#define SNMP_V3_TPARAM_FINISHED()#endif#if !defined(SNMP_V3_TPARAM_DESTROY_TEST)#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TPARAM_CREATE_TEST)#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TPARAM_UPDATE_TEST)#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_TPARAM_DESTROY_SET)#define SNMP_V3_TPARAM_DESTROY_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_TPARAM_CREATE_SET)#define SNMP_V3_TPARAM_CREATE_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_TPARAM_UPDATE_SET)#define SNMP_V3_TPARAM_UPDATE_SET(PKT, VBP, CUR, NEW)#endif/* these aren't defined by default *//*#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV)*//* * Method routines for the snmpTargetAddrTable: * *   snmpTargetAddrName -- not-accessible * The locally arbitrary, but unique identifier associated * with this snmpTargetAddrEntry. * *   snmpTargetAddrTDomain -- read-create * This object indicates the transport type of the address * contained in the snmpTargetAddrTAddress object. * *   snmpTargetAddrTAddress -- read-create * This object contains a transport address.  The format of * this address depends on the value of the * snmpTargetAddrTDomain object. * *   snmpTargetAddrTimeout -- read-create * This object should reflect the expected maximum round * trip time for communicating with the transport address * defined by this row.  When a message is sent to this * address, and a response (if one is expected) is not * received within this time period, an implementation * may assume that the response will not be delivered. *  * Note that the time interval that an application waits * for a response may actually be derived from the value * of this object.  The method for deriving the actual time * interval is implementation dependent.  One such method * is to derive the expected round trip time based on a * particular retransmission algorithm and on the number * of timeouts which have occurred.  The type of message may * also be considered when deriving expected round trip * times for retransmissions.  For example, if a message is * being sent with a securityLevel that indicates both * authentication and privacy, the derived value may be * increased to compensate for extra processing time spent * during authentication and encryption processing. * *   snmpTargetAddrRetryCount -- read-create * This object specifies a default number of retries to be * attempted when a response is not received for a generated * message.  An application may provide its own retry count, * in which case the value of this object is ignored. * *   snmpTargetAddrTagList -- read-create * This object contains a list of tag values which are * used to select target addresses for a particular * operation. * *   snmpTargetAddrParams -- read-create * The value of this object identifies an entry in the * snmpTargetParamsTable.  The identified entry * contains SNMP parameters to be used when generating * messages to be sent to this transport address. * *   snmpTargetAddrStorageType -- read-create * The storage type for this conceptual row. * *   snmpTargetAddrRowStatus -- read-create * The status of this conceptual row. *  * To create a row in this table, a manager must * set this object to either createAndGo(4) or * createAndWait(5). *  * Until instances of all corresponding columns are * appropriately configured, the value of the * corresponding instance of the snmpTargetAddrRowStatus * column is 'notReady'. *  * In particular, a newly created row cannot be made * active until the corresponding instances of * snmpTargetAddrTDomain, snmpTargetAddrTAddress, and * snmpTargetAddrParams have all been set. *  * The following objects may not be modified while the * value of this object is active(1): *     - snmpTargetAddrTDomain *     - snmpTargetAddrTAddress * An attempt to set these objects while the value of * snmpTargetAddrRowStatus is active(1) will result in * an inconsistentValue error. *//* An internal routine to retrieve the values of the variables, used * by the method routines snmpTargetAddrEntry_get and * snmpTargetAddrEntry_next.   */static int  snmpTargetAddrEntry_get_value(OIDC_T              lastmatch,                                SNMP_PKT_T         *pktp,                                VB_T               *vbp,				SNMP_TARGET_ADDR_T *taddr){if (STRCMP(VB_TO_COOKIE(vbp), "_snmpTargetAddrTable") == 0) {    switch(lastmatch) {        case LEAF_snmpTargetAddrTDomain:            getproc_got_object_id(pktp, vbp,                                   SNMP_Target_Addr_Get_TDomain(taddr)->num_components,                                  SNMP_Target_Addr_Get_TDomain(taddr)->component_list,                                   0);            break;        case LEAF_snmpTargetAddrTAddress:            getproc_got_string(pktp, vbp,                                SNMP_Target_Addr_Get_TAddress_Len(taddr),                               SNMP_Target_Addr_Get_TAddress(taddr),                               0, VT_STRING);            break;        case LEAF_snmpTargetAddrTimeout:            getproc_got_int32(pktp, vbp, SNMP_Target_Addr_Get_Timeout(taddr));            break;        case LEAF_snmpTargetAddrRetryCount:            getproc_got_int32(pktp, vbp, SNMP_Target_Addr_Get_Retry_Count(taddr));            break;        case LEAF_snmpTargetAddrTagList:            getproc_got_string(pktp, vbp,                                SNMP_Target_Addr_Get_Tag_List_Len(taddr),                               SNMP_Target_Addr_Get_Tag_List(taddr),                               0, VT_STRING);            break;        case LEAF_snmpTargetAddrParams:            getproc_got_string(pktp, vbp,                                SNMP_Target_Addr_Get_Params_Len(taddr),                               SNMP_Target_Addr_Get_Params(taddr),                               0, VT_STRING);            break;        case LEAF_snmpTargetAddrStorageType:            /* Values:             *  other(1)       = VAL_snmpTargetAddrStorageType_other             *  volatile(2)    = VAL_snmpTargetAddrStorageType_volatile             *  nonVolatile(3) = VAL_snmpTargetAddrStorageType_nonVolatile             *  permanent(4)   = VAL_snmpTargetAddrStorageType_permanent             *  readOnly(5)    = VAL_snmpTargetAddrStorageType_readOnly             */            getproc_got_int32(pktp, vbp, SNMP_Target_Addr_Get_Storage(taddr));            break;        case LEAF_snmpTargetAddrRowStatus:            /* Values:             *  active(1)        = VAL_snmpTargetAddrRowStatus_active             *  notInService(2)  = VAL_snmpTargetAddrRowStatus_notInService             *  notReady(3)      = VAL_snmpTargetAddrRowStatus_notReady             *  createAndGo(4)   = VAL_snmpTargetAddrRowStatus_createAndGo             *  createAndWait(5) = VAL_snmpTargetAddrRowStatus_createAndWait             *  destroy(6)       = VAL_snmpTargetAddrRowStatus_destroy             */            getproc_got_int32(pktp, vbp, SNMP_Target_Addr_Get_Status(taddr));            break;        default:            return GEN_ERR;        }    }#if INSTALL_ENVOY_SNMP_COEXISTENCEelse if (STRCMP(VB_TO_COOKIE(vbp), "_snmpTargetAddrExtTable") == 0) {    switch(lastmatch) {        case LEAF_snmpTargetAddrTMask:            getproc_got_string(pktp, vbp,                               SNMP_Target_Addr_Get_TMask_Len(taddr),                               SNMP_Target_Addr_Get_TMask(taddr),                               0, VT_STRING);            break;        case LEAF_snmpTargetAddrMMS:            getproc_got_int32(pktp, vbp, SNMP_Target_Addr_Get_MMS(taddr));            break;        default:            return GEN_ERR;        }

⌨️ 快捷键说明

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