📄 env_init.c
字号:
/* env_init.c - env_init.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 1994-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. *//* * $Log: env_init.c,v $ * Revision 1.5 2003/01/15 14:05:04 josh * directory structure shifting * * Revision 1.4 2002/05/23 18:51:14 josh * code modifications to support the entity MIB * * Revision 1.3 2001/11/06 21:50:46 josh * second (and hopefully final) pass of new path hacking * * Revision 1.2 2001/11/06 21:20:09 josh * revised new path hacking * * Revision 1.1.1.1 2001/11/05 17:47:42 tneale * Tornado shuffle * * Revision 9.5.4.6 2001/10/02 17:57:02 meister * fix up compiler warnings * * Revision 9.5.4.5 2001/09/27 01:12:05 meister * dynamic config rototill * * Revision 9.5.4.4 2001/09/20 17:10:45 meister * added some missing dynamic component function pointer initializations * * Revision 9.5.4.3 2001/09/13 17:35:25 meister * added some casts to deal with compiler warnings * * Revision 9.5.4.2 2001/08/07 21:53:31 meister * reworked to use dynamic component configuration macros, to allow * separate vxworks agentx components * * Revision 9.5.4.1 2001/08/06 20:05:37 meister * Added dynamic component configuration macros to V3 conditional code * * Revision 9.5 2001/01/19 22:22:21 paul * Update copyright. * * Revision 9.4 2000/03/17 00:19:05 meister * Update copyright message * * Revision 9.3 1999/11/01 19:56:53 josh * cleaning up initializations to keep extra files out of code when not * in use * * Revision 9.2 1999/11/01 15:03:49 josh * manually reinitialize globals on startup -- makes Envoy restartable * * Revision 9.1 1999/10/26 19:58:37 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.0 1998/10/16 22:11:24 sar * Update version stamp to match release * * Revision 8.15 1998/09/22 22:14:41 josh * ENVOY_PSOS_CONFIG is a better name that ENVOY_PSOS_SYSCONF. * Eliminate some confusion, there. * * Revision 8.14 1998/09/11 16:30:43 paul * Auto-initialize common library. * * Revision 8.13 1998/08/12 04:43:56 sar * Move the initialization routines around some in order to minimize * the amount of code that gets pulled in for init purposes. * * Revision 8.12 1998/07/03 19:35:15 josh * modifying init code again -- new scheme allows us to get * certain settings from a sys_conf.h, if there is one. * * Revision 8.11 1998/07/03 16:51:34 sar * Removed the many engine option and moved this engine's boots and time * informtaion into an engine entry * * Revision 8.10 1998/06/22 17:27:44 josh * minor mods to init code * * Revision 8.9 1998/06/19 22:13:11 josh * bugfixes to init code * * Revision 8.8 1998/06/19 16:27:46 josh * modifications to initialize globals in envoy_init() * * Revision 8.7 1998/06/15 18:54:42 josh * a few changes as part of merging in SNMp sources * * Revision 8.6 1998/05/29 17:04:00 josh * newmacros for locking code * * Revision 8.5 1998/05/28 03:43:53 sar * Added a lock to protect the engine boots and time values * * Revision 8.4 1998/05/27 22:55:45 sar * Added routines to manipulate the auth and priv lists (add and find) * and put code into the init routine to install those routines we know * about (if they are installed). * * Revision 8.3 1998/05/24 04:36:09 sar * Split the lock code into a differnet function to make it more * obvious when we actually add something to the main init routine. * * Revision 8.2 1998/04/16 15:48:48 josh * A new lock init API, and a new lock (both optional) * * Revision 8.1 1998/02/25 04:51:47 sra * Update copyrights. * * Revision 8.0 1997/11/18 00:56:48 sar * Updated revision to 8.0 * * Revision 7.1 1997/10/22 03:10:20 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. * *//* [clearcase]modification history-------------------01f,17feb06,job fix APIGEN markup01e,13jan06,job add a prototype for determineSnmpdComponents()01d,12may05,job fix apigen comments01c,18apr05,job update copyright notices01b,16feb05,job apigen for documented APIs01a,24nov03,job update copyright information*//*DESCRIPTIONThis library contains env_init.c routines.INCLUDE FILES: snmp.h*/#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/etimer.h>#include <wrn/wm/snmp/engine/view.h>#include <wrn/wm/common/cmn_init.h>#include <wrn/wm/common/dyncfg.h>#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG && INSTALL_ENVOY_VXWORKS#include <wrn/wm/snmp/engine/vxcmpnts.h>#endif#if INSTALL_COMMON_DYNAMIC_COMP_CONFIGvoid determineSnmpdComponents(void);#endif#include <wrn/wm/snmp/engine/localio.h>DYNCFG_FUNCPTR0(envoy_v3_init,void)DYNCFG_FUNCPTR0(envoy_ax_ma_init,void)DYNCFG_FUNCPTR0(envoy_ax_sa_init,void)DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_MD5,int)DYNCFG_EXTERN_FUNCPTR0(SNMP_Auth_Add_SHA,int)DYNCFG_EXTERN_FUNCPTR0(SNMP_Priv_Add_DES,int) DYNCFG_VBL_DECLARE_GLOBAL(envoy_use_v2_types)DYNCFG_VBL_DECLARE_GLOBAL(envoy_use_v2_protos)DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_coexistence)DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_proxy)DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_target)DYNCFG_VBL_DECLARE_GLOBAL(envoy_snmp_notify)DYNCFG_VBL_DECLARE_GLOBAL(snmpv3_component)DYNCFG_VBL_DECLARE_GLOBAL(agentx_master_component)DYNCFG_VBL_DECLARE_GLOBAL(agentx_subagent_component)#if INSTALL_ENVOY_SNMP_VERSION_3#include <wrn/wm/snmp/engine/v3_ini.h>#include <wrn/wm/snmp/engine/v3_auth.h>#include <wrn/wm/snmp/engine/v3_priv.h>#endif#if INSTALL_ENVOY_SNMP_PROXY#include <wrn/wm/snmp/engine/proxy.h>#endif#if INSTALL_ENVOY_AGENTX#include <wrn/wm/snmp/engine/agentx.h>#endif#if INSTALL_ENVOY_ENTITY_MIB#include <wrn/wm/snmp/engine/entlogic.h>#endif#if INSTALL_ENVOY_PSOS_CONFIG#include <env_conf.h>#endif/* These options may be turned on by the sys_conf.h, or * in envoy.h for source users. */#ifndef ENVOY_SC_USE_AGENTX_MASTER#define ENVOY_SC_USE_AGENTX_MASTER 1#endif#ifndef ENVOY_SC_USE_SNMPV3#define ENVOY_SC_USE_SNMPV3 1#endif#ifndef ENVOY_SC_USE_MD5#define ENVOY_SC_USE_MD5 1#endif#ifndef ENVOY_SC_USE_SHA#define ENVOY_SC_USE_SHA 1#endif#ifndef ENVOY_SC_USE_DES#define ENVOY_SC_USE_DES 1#endif/* End of sys_conf options. */#if (INSTALL_ENVOY_SNMP_LOCK)ENVOY_SNMP_LOCK(SNMP_CoarseLock);ENVOY_SNMP_LOCK(SNMP_infrastructure_lock);#endif /* install locks */#if (INSTALL_ENVOY_SNMP_SERIALIZE)extern INT_32_T Gate_Readers;extern INT_32_T Gate_Writers;extern INT_32_T Gate_Running;struct GATEKEEPER_S;extern struct GATEKEEPER_S *gateroot;#endif /* serialization */#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) || (INSTALL_ENVOY_SNMP_RFC2275_VIEWS)extern VIEWINDEX_T *viewroot;#ifndef ENVOY_INITIALIZE_VIEWROOT#define ENVOY_INITIALIZE_VIEWROOT(VR) ((VR) = 0)#endif#endif#if INSTALL_ENVOY_ENTITY_MIBENT_LOGICAL_T *root_ent_logical = 0;ENT_GENERAL_T root_ent_general;#endif/********************************************************************************* envoy_init - initialize Wind Manage SNMP* SYNOPSIS** \cs* void envoy_init()* \ce** DESCRIPTION** This routine initializes Wind River SNMP. Call it before calling any other * Wind River SNMP routines** PARAMETERS* None.** RETURNS: None.** ERRNO: N/A** SEE ALSO: None.*/void envoy_init(){#if INSTALL_COMMON_DYNAMIC_COMP_CONFIGdetermineSnmpdComponents();#endifenvoy_timer_init();#if (INSTALL_ENVOY_SNMP_VERSION_3 && ENVOY_SC_USE_SNMPV3)DYNCFG_IFCFGVBL_BEGIN(snmpv3_component)DYNCFG_FUNCALL(envoy_v3_init) ();/* try to add in auth routines */#if (INSTALL_ENVOY_MD5 && ENVOY_SC_USE_MD5)(void) DYNCFG_FUNCALL(SNMP_Auth_Add_MD5)();#endif /* (INSTALL_ENVOY_MD5 && ENVOY_SC_USE_MD5) */#if (INSTALL_ENVOY_SHA && ENVOY_SC_USE_SHA)(void) DYNCFG_FUNCALL(SNMP_Auth_Add_SHA)();#endif /* (INSTALL_ENVOY_SHA && ENVOY_SC_USE_SHA) *//* then the priv routine */#if (INSTALL_ENVOY_DES && ENVOY_SC_USE_DES)(void) DYNCFG_FUNCALL(SNMP_Priv_Add_DES)();#endif /* (INSTALL_ENVOY_DES && ENVOY_SC_USE_DES) */DYNCFG_IFCFGVBL_END(snmpv3_component)#endif /* (INSTALL_ENVOY_SNMP_VERSION_3 && ENVOY_SC_USE_SNMPV3) */#if INSTALL_ENVOY_SNMP_PROXYenvoy_proxy_init();#endif#if (INSTALL_ENVOY_AGENTX_MASTER && ENVOY_SC_USE_AGENTX_MASTER)DYNCFG_IFCFGVBL_BEGIN(agentx_master_component)DYNCFG_FUNCALL(envoy_ax_ma_init) ();DYNCFG_IFCFGVBL_END(agentx_master_component)#endif#if INSTALL_ENVOY_AGENTX_SUBDYNCFG_IFCFGVBL_BEGIN(agentx_subagent_component)DYNCFG_FUNCALL(envoy_ax_sa_init) ();DYNCFG_IFCFGVBL_END(agentx_subagent_component)#endif#if INSTALL_ENVOY_SNMP_LOCKENVOY_SNMP_INIT_LOCK_TAG(SNMP_CoarseLock, SNMP_COARSELOCK_TAG);ENVOY_SNMP_INIT_LOCK_TAG(SNMP_infrastructure_lock, SNMP_INFRASTRUCTURELOCK_TAG);#endif#if (INSTALL_ENVOY_SNMP_SERIALIZE)Gate_Readers = 0;Gate_Writers = 0;Gate_Running = 0;gateroot = 0;#endif /* INSTALL_ENVOY_SNMP_SERIALIZE */#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) || (INSTALL_ENVOY_SNMP_RFC2275_VIEWS)ENVOY_INITIALIZE_VIEWROOT(viewroot);#endif#if INSTALL_ENVOY_ENTITY_MIBroot_ent_logical = 0;Ent_General_Set_Defaults(Ent_General_Group_Lookup());#endif COMMON_INIT_FROM_ENVOY(); /* initialize the strong random generator */return;}#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG/* * this function is meant to be called by an snmp component initialization * function startup task (probably in vxWorks) to initialize these component * config variables to zero (not installed). Other component initialization * tasks may subsequently reset them to 1 (installed) */void envoy_dyncfg_init (void){DYNCFG_VBL_SET(envoy_use_v2_types,0);DYNCFG_VBL_SET(envoy_use_v2_protos,0);DYNCFG_VBL_SET(envoy_snmp_coexistence,0);DYNCFG_VBL_SET(envoy_snmp_proxy,0);DYNCFG_VBL_SET(envoy_snmp_target,0);DYNCFG_VBL_SET(envoy_snmp_proxy,0);DYNCFG_VBL_SET(snmpv3_component,0);DYNCFG_VBL_SET(agentx_master_component,0);DYNCFG_VBL_SET(agentx_subagent_component,0);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -