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

📄 vb_rtns.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* vb_rtns.c - vb_rtns.c routines *//* *  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 1988-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: vb_rtns.c,v $ * Revision 1.4  2003/01/15 14:05:10  josh * directory structure shifting * * Revision 1.3  2001/11/06 21:50:52  josh * second (and hopefully final) pass of new path hacking * * Revision 1.2  2001/11/06 21:20:34  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:44  tneale * Tornado shuffle * * Revision 9.10.4.4  2001/09/21 20:52:29  josh * extra cleanup for various combinations of installation options * * Revision 9.10.4.3  2001/09/21 19:29:23  josh * adjustments for expanded structures and moved functions * * Revision 9.10.4.2  2001/08/07 21:53:35  meister * reworked to use dynamic component configuration macros, to allow * separate vxworks agentx components * * Revision 9.10.4.1  2001/08/06 20:05:41  meister * Added dynamic component configuration macros to V3 conditional code * * Revision 9.10  2001/01/19 22:22:30  paul * Update copyright. * * Revision 9.9  2000/03/17 00:19:34  meister * Update copyright message * * Revision 9.8  2000/02/02 17:35:29  josh * adding VBList_Free() API call * * Revision 9.7  1999/10/29 16:52:57  sar * Move the zeroing of the vblp into the while loop so that we only try * to zero things if we actually have a vblp to work with * * Revision 9.6  1999/10/26 19:58:34  sar * Modify the handling of cleanups for sub agents that timeout. * We now use the infrastructure lock to mediate access to the * cookies, group lists, groups and handles by the query and timeout * code for the epilogue sub agent scheme.  This allows the cleanups * to occur more quickly than previously and be interleaved with * the queries more. * * Revision 9.5  1999/10/18 22:32:55  sar * Insert code in clean_pkt to free the continue lock, also * remove the call to initalize_pkt in clean_pkt * * Revision 9.4  1999/09/09 19:39:40  sar * Cleanup the search oid in all agentx cases, not just master agent * * Revision 9.3  1999/04/09 20:37:13  josh * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT * * Revision 9.2  1999/03/30 15:58:40  josh * backing out file that shouldn't have been committed * * Revision 9.1  1999/03/30 15:20:18  josh * feature to allow customer-driven context conversion into AgentX * * Revision 9.0  1998/10/16 22:12:43  sar * Update version stamp to match release * * Revision 8.6  1998/06/05 18:53:25  sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.5  1998/06/01 20:41:53  sar * Removed the msg_con_name field from SNMP_PKT_T and used the community * field instead. * * Revision 8.4  1998/05/29 17:06:51  josh * new locking macro * * Revision 8.3  1998/05/24 04:37:21  sar * Add code to initialize and cleanup fields that were added for SNMPv3 * * Revision 8.2  1998/02/25 15:21:37  sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 8.1  1998/02/25 04:52:52  sra * Update copyrights. * * Revision 8.0  1997/11/18 00:57:05  sar * Updated revision to 8.0 * * Revision 1.4  1997/11/01 01:25:40  sar * In the packet we are processing save a pointer to the coarse lock we * are using so that we can free it later without needing to know which * lock it was. * * Revision 1.3  1997/10/22 03:10:27  sar * Modified the installation options for agentx and the older sub agent scheme * * Also moved the allocation of the locks into envoy_init (env_init.c), * so they can be initialized if necessary. * * Revision 1.2  1997/10/21 02:58:24  sar * Move some of the macro defintions out to the port files, * Also move the leaf decrement function to vb_rtns * * Revision 1.1  1997/10/16 00:37:39  sar * Routines from breaking up snmp_d.c.  These were spun off so that * programs that need to manipulate snmp packets but didn't want to * decode an asn1 stream could avoid the excess routines.  Generally * these programs will be sub agents. * *//* [clearcase]modification history-------------------01d,12may05,job  fix apigen comments01c,18apr05,job  update copyright notices01b,22feb05,job  apigen for documented APIs01a,24nov03,job  update copyright information*//*DESCRIPTIONThis library contains vb_rtns.c routines.INCLUDE FILES: snmp.h*//* These functions were originally in snmp_d.c, they were moved here   to allow other functions to access them without including the    packet decode routines.  More revision log entries may be found there */#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/localio.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/decode.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/snmpstat.h>#if INSTALL_ENVOY_AGENTX_MASTER#include <wrn/wm/snmp/engine/agentx.h>#endif#include <wrn/wm/common/bug.h>#include <wrn/wm/common/dyncfg.h>DYNCFG_VBL_DECLARE_EXTERN(snmpv3_component)DYNCFG_VBL_DECLARE_EXTERN(agentx_master_component)/****************************************************************************\NOMANUALNAME:  Clean_vb_dataPURPOSE:  Clean up any dynamically allocated memory which may be attached          to a VarBinds data areaPARAMETERS:        VB_T *          The VarBind to be cleanedRETURNS:  nothing****************************************************************************/void  Clean_vb_data(VB_T *vbp){switch (vbp->vb_data_flags_n_type) {    case VT_STRING:    case VT_OPAQUE:        if (vbp->value_u.v_string.start_bp != 0)            EBufferClean(&(vbp->value_u.v_string));        break;    case VT_OBJECT:        Clean_Obj_ID(&(vbp->value_u.v_object));        break;    }}/****************************************************************************\NOMANUALNAME:  Clean_vbPURPOSE:  Clean up any dynamically allocated memory which may be attached          to an VarBindPARAMETERS:        VB_T *          The VarBind to be cleanedRETURNS:  nothing****************************************************************************/void  Clean_vb(VB_T *vbp){  /* if needed, clean up after an aborted set */  if (vbp->vb_free_priv != 0) {      (*vbp->vb_free_priv)((PTR_T)vbp);      vbp->vb_free_priv = 0;      }  Clean_Obj_ID(&(vbp->vb_obj_id));  Clean_vb_data(vbp);#if INSTALL_ENVOY_AGENTX_MASTER  DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)  /* If this is an agentx leaf we need to adjust the reference counter     for the leaf and if it becomes 0 free the leaf.  Currently we grab     the lock here, though this might go into another routine sometime */  if (vbp->vb_ml.ml_leaf && (vbp->vb_ml.ml_leaf->node_type & AGENTX_LEAF)) {#if INSTALL_ENVOY_SNMP_LOCK      /* Try to get the infrastructure lock.  We don't have any	 good options if we can't get the lock so the user shouldn't	 do that.  If they do we generate a bug report and if they	 don't handle that we skip cleaning up the leaf which is	 the least bad thing to do */      if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock)) {	  BUG(BUG_ENVOY_LOCKING, BUG_FATAL, 0,	      (BUG_OUT, "Clean_vb(): infrastructure lock broken", 0));	  return;	  }#endif      vbp->vb_ml.ml_leaf->ref_count--;      if (vbp->vb_ml.ml_leaf->ref_count == 0) {	  SNMP_memory_free(vbp->vb_ml.ml_leaf);	  }      ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock);      }      DYNCFG_IFCFGVBL_END(agentx_master_component)#endif#if INSTALL_ENVOY_AGENTX  /* DYNCFG_IFCFGVBL_BEGIN(agentx_component) */  Clean_Obj_ID(&vbp->ax_search_end);  /* DYNCFG_IFCFGVBL_END(agentx_component) */#endif}/****************************************************************************\NOMANUALNAME:  Clean_vb_listPURPOSE:  Clean up any dynamically allocated memory which may be attached          to an VarBindListPARAMETERS:        VBL_T *         The VarBindList to be cleanedRETURNS:  nothing****************************************************************************/void  Clean_vb_list(VBL_T * vblp){  VB_T  *vbp;  VBL_T *vblpcur, *vblpnext;  /* set up the initial value then loop until we run out of vbl's,     as we plan to use vblp later don't change what it points to */  vblpcur = vblp;  while(vblpcur != 0) {      /* clean up the vblist associated with this vbl */      if ((vbp = vblpcur->vblist) != 0) {          int i;          for (i = 0; i < vblpcur->vbl_count; i++, vbp++) {              Clean_vb(vbp);              }          SNMP_memory_free((char *)(vblpcur->vblist));          }      /* get a pointer to the next vbl */      vblpnext = vblpcur->vblp;      /* if the current one isn't the first one, free it */      if (vblpcur != vblp)           SNMP_memory_free ((char *)(vblpcur));      else {	  /* or zero out the first vblp so we don't have any accidents */	  vblp->vbl_count = 0;	  vblp->vblist    = 0;	  vblp->vblp      = 0;          }      /* set the current one to the next one and do the loop */      vblpcur = vblpnext;      }}

⌨️ 快捷键说明

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