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

📄 v3mt_acc.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 1998 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: v3mt_acc.c,v $ * Revision 1.4  2002/11/18 18:50:23  josh * fixing name length checks to allow for some edge cases * * Revision 1.3  2002/01/11 22:42:56  josh * check the proper values when setting the storageType * * Revision 1.2  2001/11/06 21:20:32  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:40  tneale * Tornado shuffle * * Revision 9.7.4.1  2001/09/28 20:49:05  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.7  2001/04/11 20:11:59  josh * merging changes from the kingfisher branch back onto * the trunk * * Revision 9.6  2001/01/19 22:22:00  paul * Update copyright. * * Revision 9.5.2.2  2001/03/12 22:07:44  tneale * Updated copyright * * Revision 9.5.2.1  2000/10/24 17:22:47  josh * bring vacmSecurityToGroupStatus object into line with RFC 2575 -- * a newly-created row is notReady until vacmGroupName is set * * Revision 9.5  2000/03/17 00:17:47  meister * Update copyright message * * Revision 9.4  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.3  2000/02/16 19:59:29  josh * more WRONG_LENGTH/WRONG_VALUE changes * * Revision 9.2  2000/02/16 18:45:51  josh * returning WRONG_LENGTH instead of WRONG_VALUE, where appropriate * * Revision 9.1  2000/02/04 21:56:11  josh * functions which are clearly static have been declared as such. * this makes the vxWorks compiler happy. * * Revision 9.0  1998/10/16 22:09:55  sar * Update version stamp to match release * * Revision 1.13  1998/09/16 05:27:03  sar * Correct a type vpb => vbp * * Revision 1.12  1998/09/04 15:11:08  sar * Added some casts to try and keep the msc compiler happy and not * complaining about signed/unsigned mismatches. * * Revision 1.11  1998/07/20 02:04:39  sar * Changed the *_FINISHED calls to *_FINISHED() * * Revision 1.10  1998/07/01 01:46:13  sar * fixes to set type code * in the set cleanup routines check the vb_priv pointer rather. * than the vbp itself * in the test routines mark strings as being changed if we are * creating an entry so they will get properly copied * and other minor cleanups * * Revision 1.9  1998/06/30 00:30:13  sar * When doing a test we shouldn't mark all the vbs as having been done. * In v3mt_usr.c arrange to only check the user flags if this entry wasn't * already finished (nis or active). * * Revision 1.8  1998/06/22 03:34:24  sar * Cast some things to unsigned ints to try and keep compilers happy * * Revision 1.7  1998/06/19 20:18:56  sar * Make all files include asn1conf.h and snmp.h to make sure we get the * common code * * Revision 1.6  1998/06/16 05:32:09  sar * clean up some type info * rearrange the handling of the instance info for the next routine * * Revision 1.5  1998/06/09 21:36:51  sar * Cleaned up some problems with alloc and memcmp and arguments of 0 * * Revision 1.4  1998/05/30 03:07:33  sar * Updated names used for max lengths of strings for clarity * Update user_lookup * * Revision 1.3  1998/05/29 17:08:15  josh * need to add a cast to the call to SNMP_Group_Name() * * Revision 1.2  1998/05/23 20:32:04  sar * Correct copyright statement * * Revision 1.1  1998/05/22 19:47:01  sar * Method routines for use with snmp v3 tables.  The tables are: * access, group, context, user and views. * *//* [clearcase]modification history-------------------01b,18apr05,job  update copyright notices01a,24nov03,job  update copyright information*/#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/v3_acc.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/vbdefs.h>#include <wrn/wm/snmp/engine/auxfuncs.h>/* default values for the macros to map the group method routines   to the users non volatile storage */#if !defined(SNMP_V3_GROUP_DESTROY_BACKOUT)#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_GROUP_CREATE_BACKOUT)#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_GROUP_UPDATE_BACKOUT)#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_GROUP_FINISHED)#define SNMP_V3_GROUP_FINISHED()#endif#if !defined(SNMP_V3_GROUP_DESTROY_TEST)#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_GROUP_CREATE_TEST)#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_GROUP_UPDATE_TEST)#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_GROUP_DESTROY_SET)#define SNMP_V3_GROUP_DESTROY_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_GROUP_CREATE_SET)#define SNMP_V3_GROUP_CREATE_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_GROUP_UPDATE_SET)#define SNMP_V3_GROUP_UPDATE_SET(PKT, VBP, CUR, NEW)#endif/* these aren't defined by default *//*#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV)*//* default values for the macros to map the access method routines   to the users non volatile storage */#if !defined(SNMP_V3_ACCESS_DESTROY_BACKOUT)#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_ACCESS_CREATE_BACKOUT)#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_ACCESS_UPDATE_BACKOUT)#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_V3_ACCESS_FINISHED)#define SNMP_V3_ACCESS_FINISHED()#endif#if !defined(SNMP_V3_ACCESS_DESTROY_TEST)#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_ACCESS_CREATE_TEST)#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_ACCESS_UPDATE_TEST)#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_V3_ACCESS_DESTROY_SET)#define SNMP_V3_ACCESS_DESTROY_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_ACCESS_CREATE_SET)#define SNMP_V3_ACCESS_CREATE_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_V3_ACCESS_UPDATE_SET)#define SNMP_V3_ACCESS_UPDATE_SET(PKT, VBP, CUR, NEW)#endif/* these aren't defined by default *//*#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV)#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV)*//* group table lastmatch values */#define LM_groupName    3#define LM_groupStorage 4#define LM_groupStatus  5/****************************************************************************NAME:  get_group_dataPURPOSE:  install data into a vbp.  this routine will be called	  from grouptable_get and grouptable_next, they will have	  already found the proper group we just find the right	  field in that group and stuff it into the vbpPARAMETERS:	SNMP_PKT_T *	SNMP packet currently being processed.	VB_T *		Variable being processed.	SNMP_GROUP_T *  the view to extract inforamtion fromRETURNS: void****************************************************************************/static void  get_group_data(SNMP_PKT_T   *pktp,		 VB_T	      *vbp,		 SNMP_GROUP_T *group){for(; vbp; vbp = vbp->vb_link) {    switch(vbp->vb_ml.ml_last_match) {        case LM_groupName:	    getproc_got_string(pktp, vbp, SNMP_Group_Get_Group_Len(group),			       SNMP_Group_Get_Group(group), 0, VT_STRING);	    break;        case LM_groupStorage:	    getproc_got_int32(pktp, vbp, SNMP_Group_Get_Storage(group));	    break;        case LM_groupStatus:	    getproc_got_int32(pktp, vbp, SNMP_Group_Get_Status(group));	    break;        }    }return;}/****************************************************************************NAME:  grouptable_getPURPOSE:  Find the appropriate entry in the group table and attach information	  from it to the vbp using the getproc_got_* functions.	  If we can't find an entry indicate that by calling getproc_nosuchins.PARAMETERS:	OIDC_T		Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int		Number of components in the unused part of the			object identifier	OIDC_T *	Unused part of the object identifier	SNMP_PKT_T *	SNMP packet currently being processed.	VB_T *		Variable being processed.RETURNS: void****************************************************************************/void  grouptable_get(OIDC_T		 last_match,		int		 tcount,		OIDC_T		*tlist,		SNMP_PKT_T	*pktp,		VB_T		*vbp){SNMP_GROUP_T *group = 0;bits8_t name[ETC_ACCESS_GROUP_MAX];ALENGTH_T namelen = ETC_ACCESS_GROUP_MAX;/* group the vbs that are touching the given entry */group_by_getproc_and_instance(pktp, vbp, tcount, tlist);/* gather the indexing information, the index will be of the form:   <model number> <len> <name>   first we do some minor checks then we attempt to find the group */if ((tcount >= 3 ) &&    (tlist[0] != 0) &&    (tlist[0] < 0x80000000L) &&    (tlist[1] >= 1) &&    (tlist[1] <= ETC_ACCESS_GROUP_MAX) &&    (tlist[1] == (OIDC_T)(tcount - 2)) &&    (oid_to_string(tcount - 1, tlist + 1, &namelen, name, 0) == 0)) {    group = SNMP_Group_Lookup((sbits32_t)tlist[0], name, namelen);    }/* install the right info into the vbps */if (group == 0)    for(; vbp; vbp = vbp->vb_link)        getproc_nosuchins(pktp,vbp);else    get_group_data(pktp, vbp, group);return;}/****************************************************************************NAME:  grouptable_nextPURPOSE:  Find the appropriate entry in the group table and attach information	  from it to the vbp using the getproc_got_* functions.	  If we can't find an entry indicate that by calling nextproc_no_nextPARAMETERS:	OIDC_T		Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int		Number of components in the unused part of the			object identifier	OIDC_T *	Unused part of the object identifier	SNMP_PKT_T *	SNMP packet currently being processed.	VB_T *		Variable being processed.RETURNS: void****************************************************************************/void  grouptable_next(OIDC_T	 last_match,		  int		 tcount,		  OIDC_T	*tlist,		  SNMP_PKT_T	*pktp,		  VB_T		*vbp){SNMP_GROUP_T *group;OIDC_T rlist[ETC_ACCESS_GROUP_MAX + 2];ALENGTH_T namelen;bits8_t name[ETC_ACCESS_GROUP_MAX];/* group the vbs that are touching the given entry */group_by_getproc_and_instance(pktp, vbp, tcount, tlist);group = SNMP_Group_Next(tcount, tlist);/* install the right info into the vbps */if (group == 0)    for(; vbp; vbp = vbp->vb_link)        nextproc_no_next(pktp,vbp);else {    get_group_data(pktp, vbp, group);    /* determine and insert instance information */    namelen = ETC_ACCESS_GROUP_MAX;    SNMP_Group_Name(group, (sbits32_t *)&(rlist[0]), name, &namelen);    (void) string_to_oid(namelen, name, ETC_ACCESS_GROUP_MAX + 1,			 rlist + 1, 0);    for(; vbp; vbp = vbp->vb_link)        nextproc_next_instance(pktp, vbp, (int)(namelen + 2), rlist);    }return;}/****************************************************************************NAME: grouptable_destroy_cleanupPURPOSE: Cleanup after a group test (delete) succeeded but some other test	 failed.  We merely call the DESTROY_BACKOUT macro to allow	 the customer to restore any changed state.	 Expects the pointer to point to a VB_TPARAMETERS: 	ptr_t   A pointer to the vb that points to the group		that we were going to delete, cast as a ptr_tRETURNS: Nothing****************************************************************************/static void  grouptable_destroy_cleanup(ptr_t groupptr){SNMP_V3_GROUP_DESTROY_BACKOUT(((VB_T *)groupptr)->vb_priv, 0);}/****************************************************************************NAME: grouptable_create_cleanupPURPOSE: Cleanup after a group create test succeeded but some         other test failed.  As this is a create the state	 pointer points to a structure that is installed,

⌨️ 快捷键说明

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