📄 vmth2275.c
字号:
/* * 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: vmth2275.c,v $ * Revision 1.3 2002/06/18 20:01:33 josh * check against a rowStatus of ETC_STO_RONLY instead of * ETC_STO_PERM * * Revision 1.2 2001/11/06 21:20:35 josh * revised new path hacking * * Revision 1.1.1.1 2001/11/05 17:47:41 tneale * Tornado shuffle * * Revision 9.6.4.2 2001/10/16 14:44:39 josh * it's SNMP_View_Get_StorageType(), not SNMP_View_Get_Storage() * * Revision 9.6.4.1 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.6 2001/04/25 16:40:04 josh * make sure the instance is thoroughly checked in the * vacmViewTreeFamilyTable before trying to create a * new row * * Revision 9.5 2001/01/19 22:22:01 paul * Update copyright. * * Revision 9.4 2000/03/17 00:17:51 meister * Update copyright message * * Revision 9.3 2000/03/10 15:02:40 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.2 2000/02/16 19:59:30 josh * more WRONG_LENGTH/WRONG_VALUE changes * * Revision 9.1 2000/02/04 21:56:13 josh * functions which are clearly static have been declared as such. * this makes the vxWorks compiler happy. * * Revision 9.0 1998/10/16 22:10:00 sar * Update version stamp to match release * * Revision 1.13 1998/09/04 15:11:07 sar * Added some casts to try and keep the msc compiler happy and not * complaining about signed/unsigned mismatches. * * Revision 1.12 1998/07/20 02:04:38 sar * Changed the *_FINISHED calls to *_FINISHED() * * Revision 1.11 1998/07/01 01:46:16 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.10 1998/06/30 00:30:14 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.9 1998/06/29 21:56:23 sar * Update the next code to match the current view structures * * Revision 1.8 1998/06/22 03:34:23 sar * Cast some things to unsigned ints to try and keep compilers happy * * Revision 1.7 1998/06/20 17:49:46 sar * Modified the names and calling sequences for snmp_rfc2275 functions * * Revision 1.6 1998/06/18 04:48:53 sar * Update deinstall routines * * Revision 1.5 1998/06/17 02:06:05 sar * Clean up the checking of the object id in the next code * * Revision 1.4 1998/06/16 05:32:10 sar * clean up some type info * rearrange the handling of the instance info for the next routine * * Revision 1.3 1998/06/09 21:36:53 sar * Cleaned up some problems with alloc and memcmp and arguments of 0 * * Revision 1.2 1998/05/23 20:32:06 sar * Correct copyright statement * * Revision 1.1 1998/05/22 19:47:03 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/asn1conf.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/objectid.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/mib.h>#include <wrn/wm/snmp/engine/view.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include <wrn/wm/snmp/engine/smi.h>#define MAX_SUBIDS 128extern VIEWINDEX_T *viewroot;sbits32_t v3_vacmViewSpinLock = 0;#if !defined(SNMP_VIEW_2275_DESTROY_BACKOUT)#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_VIEW_2275_CREATE_BACKOUT)#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_VIEW_2275_UPDATE_BACKOUT)#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW)#endif#if !defined(SNMP_VIEW_2275_FINISHED)#define SNMP_VIEW_2275_FINISHED()#endif#if !defined(SNMP_VIEW_2275_DESTROY_TEST)#define SNMP_VIEW_2275_DESTROY_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_VIEW_2275_CREATE_TEST)#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_VIEW_2275_UPDATE_TEST)#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) NO_ERROR#endif#if !defined(SNMP_VIEW_2275_DESTROY_SET)#define SNMP_VIEW_2275_DESTROY_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_VIEW_2275_CREATE_SET)#define SNMP_VIEW_2275_CREATE_SET(PKT, VBP, CUR, NEW)#endif#if !defined(SNMP_VIEW_2275_UPDATE_SET)#define SNMP_VIEW_2275_UPDATE_SET(PKT, VBP, CUR, NEW)#endif/* these aren't defined by default *//*#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV)#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV)#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV)*//* view table lastmatch values */#define LM_viewName 1#define LM_viewSubtree 2#define LM_viewMask 3#define LM_viewType 4#define LM_viewStorageType 5#define LM_viewStatus 6/****************************************************************************NAME: viewtable_destroy_cleanupPURPOSE: Cleanup after a view 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 a PTR_T or VB_T rather than a VIEWLEAF_TPARAMETERS: PTR_T A pointer to the View to delete or A pointer to the vb that points to the view to delete cast as a PTR_TRETURNS: Nothing****************************************************************************/static void viewtable_destroy_cleanup(PTR_T viewptr){SNMP_VIEW_2275_DESTROY_BACKOUT(((VB_T *)viewptr)->vb_priv, 0);}/****************************************************************************NAME: viewtable_create_cleanupPURPOSE: Cleanup after a view test (create) succeeded but some other test failed. As this is a create the state pointer points to a structure that is instlled, we need to deinstall it, call the backout routine and cleanup the state.PARAMETERS: PTR_T A pointer to the vb that points to the view to delete cast as a PTR_TRETURNS: Nothing****************************************************************************/static void viewtable_create_cleanup(PTR_T viewptr){VIEWLEAF_T *view;view = (VIEWLEAF_T *)(((VB_T *)viewptr)->vb_priv);SNMP_VIEW_2275_CREATE_BACKOUT(0, view);SNMP_View_2275_Deinstall(view);SNMP_View_Delete(view);}/****************************************************************************NAME: viewtable_update_cleanupPURPOSE: Cleanup after a view test (update) succeeded but some other test failed. As this is an update the state pointer points to a structure that isn't installed. The next pointer of that structure points to the installed copy. We call the backout routine and cleanup the state.PARAMETERS: PTR_T A pointer to the vb that points to the view to delete cast as a PTR_TRETURNS: Nothing****************************************************************************/static void viewtable_update_cleanup(PTR_T viewptr){VIEWLEAF_T *view;view = (VIEWLEAF_T *)(((VB_T *)viewptr)->vb_priv);SNMP_VIEW_2275_UPDATE_BACKOUT(view->lexinext, view);SNMP_View_Delete(view);}/****************************************************************************NAME: viewtable_destroy_undoPURPOSE: This routine attempts to undo a previous destroy set. It expects the old information to be pointed to by vb_priv and tries to reinstall it. If we can't reinstall the access we leave the cleanup routine alone in order to get the FINISHED macro to run.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 processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/static void viewtable_destroy_undo(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){VIEWLEAF_T *view;ALENGTH_T namelen = ETC_VIEW_NAME_MAX;bits8_t name[ETC_VIEW_NAME_MAX];/* assume things will go well and mark the vbp as done */undoproc_good(pktp, vbp);/* find the state block we saved and then reset the vb_priv info so we don't have any accidents later */view = (VIEWLEAF_T *)vbp->vb_priv;vbp->vb_priv = 0;/* Reacquire the naming information, we don't need to test it as it was validated during the testproc */ (void) oid_to_string(tcount, tlist, &namelen, name, 0);if (SNMP_View_2275_Install(view, name, namelen) == 0) {#if defined(SNMP_VIEW_DESTROY_UNDO_2275) if (SNMP_VIEW_2275_DESTROY_UNDO(pktp, vbp, 0, view) == 0) { vbp->vb_free_priv = 0; return; } else SNMP_View_2275_Deinstall(view);#else vbp->vb_free_priv = 0; return;#endif }SNMP_View_Delete(view);undoproc_error(pktp, vbp, UNDO_FAILED);return;}/****************************************************************************NAME: viewtable_create_undoPURPOSE: This routine attempts to undo a previous create set. It expects the new information to be pointed to by vb_priv and tries to deinstall and destroy the entry.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 processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/static void viewtable_create_undo(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){VIEWLEAF_T *view;/* assume things will go well */undoproc_good(pktp, vbp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -