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

📄 nvutils.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 5 页
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/nvutils.c,v 1.5 2003/01/15 14:04:32 josh Exp $ *//* * Copyright (C) 1999-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 1993-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. ****************************************************************************//* * $Log: nvutils.c,v $ * Revision 1.5  2003/01/15 14:04:32  josh * directory structure shifting * * Revision 1.4  2002/05/23 18:51:12  josh * code modifications to support the entity MIB * * Revision 1.3  2002/01/15 21:40:57  josh * write out snmpTargetAddrExtTable objects, read IP addresses * correctly into demo notification code * * Revision 1.2  2001/11/08 15:56:23  tneale * Updated for newest file layout * * Revision 1.1.1.1  2001/11/05 17:48:42  tneale * Tornado shuffle * * Revision 7.26.4.3  2001/07/20 20:36:58  josh * nvutils support for community objects * * Revision 7.26.4.2  2001/07/16 18:10:45  josh * updating snark code to work with coexistence added * * Revision 7.26.4.1  2001/06/28 18:24:11  josh * Seeding the Cormorant branch with the code from the old * cormorant branch * * Revision 7.26  2001/04/13 20:07:52  josh * overwriting trunk version of this file with the version * from the kingfisher branch * * Revision 7.25  2001/01/19 22:23:47  paul * Update copyright. * * Revision 7.24  2000/06/09 14:59:08  josh * updated for proxy code and new installation options * * Revision 7.23.4.1  2001/04/13 20:00:17  josh * preserving cormorant-related changes on the cormorant branch * * Revision 7.23.2.4  2001/03/12 22:09:39  tneale * Updated copyright * * Revision 7.23.2.3  2001/01/25 22:19:37  josh * don't try to read in the v3traps stuff if there isn't anything to read... * * Revision 7.23.2.2  2001/01/19 21:38:27  josh * a new mechanism for hardcoding traps with arbitrary varbind lists * into an agent.  useful for testing purposes * * Revision 7.23.2.1  2000/09/20 18:32:23  josh * updating nvutils to take target/notify split into account * * Revision 7.23  2000/03/17 00:12:41  meister * Update copyright message * * Revision 7.22  2000/01/02 22:56:55  josh * updating nvutils code to deal with an API change * * Revision 7.21  1999/11/11 15:58:04  josh * fix target and notify reading code so it doesn't choke on comments * * Revision 7.20  1999/10/19 23:14:51  sar * compare the string and not the token * * Revision 7.19  1999/10/19 15:16:33  josh * adding support for new sections: target_addr, target_params, notify, * notify_filter_profile, and notify_filter. * * Revision 7.18  1999/05/25 01:56:34  sar * Corrrect agent_tokens to engine_tokens and made the tokenizer * stop when it gets to a tag of zero rather than a token of zero * * Revision 7.17  1998/07/20 01:56:47  sar * Removed ENVOY_TIME * Added () to SNMP_Engine_Get_My_* calls * * Revision 7.16  1998/07/03 16:58:49  sar * Remove many engine install option, modifed the installation * of this engine's information * * Revision 7.15  1998/07/01 01:39:52  sar * fixed typo for prefix * fixed use of nameacc instead of infoacc while writing access entities * * Revision 7.14  1998/06/28 21:53:37  sar * Don't allocate space for v3engine_ptr if not needed * * Revision 7.13  1998/06/23 20:43:41  sar * Update the calling arguments for the config command to allow the * caller to hand in a string.  If the string isn't zero the engine * id of this engine is extracted from it, otherwise the engine id * comes from the nv file. * The user parsing code now looks up the auth and priv routines before * trying to use them. * * Revision 7.12  1998/06/20 17:47:18  sar * Modify the names and calling sequences for view_rfc2275 functions * * Revision 7.11  1998/06/18 04:16:55  sar * Updated use of SNMP_View_RFC2275_Install, it now always allocates * space for the name so it doesn't need the static/dynamic flag. * * Revision 7.10  1998/06/16 05:34:52  sar * clean up some type info * return the 1445 routines to their previous state * return the proper errors for v3 routines * * Revision 7.9  1998/06/09 16:52:45  sar * Added v3 contexts, fixed some access calls that accidently got * v3 tags. * * Revision 7.8  1998/06/07 02:42:50  sar * moved the globarl configuration variables to nvutils and renamed them. * modified a variable name "access" to "acc_str" to avoid conflicts. * * Revision 7.7  1998/05/30 02:43:53  sar * Update the max length names for clarity * * Revision 7.6  1998/05/23 19:11:34  sar * Modified the view routines to include rfc2275 and added other * routines to deal with v3 mibs (access, groups, users, engineids etc). * * Revision 7.5  1998/02/25 04:57:58  sra * Update copyrights. * * Revision 7.4  1997/03/20 06:53:49  sra * DFARS-safe copyright text.  Zap! * * Revision 7.3  1997/02/25 10:58:16  sra * Update copyright notice, dust under the bed. * * Revision 7.2  1997/01/08 23:26:53  sar * Updated include files to use envoy/h as appropriate after * move from envoy/utils to snark/snmptalk * * Revision 7.1  1997/01/08  01:58:11  sar * Removed no_pp stuff and updated copyrights * * Revision 7.0  1996/03/18  20:19:20  sar * Updated rev to 7.0 and copyright to 96 * * Revision 6.5  1996/01/26  22:05:01  sar * corrected some of the scanf arguments "ud" -> "lu" * * Revision 6.4  1996/01/16  20:32:17  sar * Ifdefed some used stuff (all the read utilities). * * Revision 6.3  1996/01/10  16:41:40  sar * Usec updates - added a new set of options to the config file * for use with the usec agentid, access, context and user info. * * Revision 6.2  1995/11/11  00:09:41  sar * Added a new command option to decide where the rfc1445 viewtree * comes from - the config.txt file or nvviews.c * * Revision 6.1  1995/10/20  22:39:59  sar * Cut nvutils down to only have the routines for dealing with views. * * Revision 6.0  1995/05/31  21:50:15  sra * Release 6.0. * * Revision 5.5  1995/05/26  00:49:16  sar * Modified the status codes to deal with CAG0. * * Revision 5.4  1994/11/07  22:16:28  sar * Made stdf.h be a local include file, this means we need to copy * stdf.h to where ever nvutils.c is (also need stdf.c as well). * * Revision 5.3  1994/11/01  17:54:49  sar * Added a flag to the mod list entry to allow us to determine if the * entry was being deleted and therefore shouldn't be written out. * * Revision 5.2  1994/10/25  20:06:34  sar * in a fprintf statement changed the control string to use %ld instead of %d * * Revision 5.1  1994/09/23  19:29:50  sar * Removed the old non volatile scheme and added a new one that is hopefully * easier to use and allows for some new options such as a read only * flag to prohibit creating a new config file.  The config stuff will * only be included if needed. * In snmptalk and snmpint added a next function. * *//* [clearcase]modification history-------------------01a,19apr05,job  update copyright notices*/#include <wrn/wm/common/install.h>#include <wrn/wm/common/config.h>#include <snmptalk.h>#include <stdio.h>#include <ctype.h>#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/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/view.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include <wrn/wm/snmp/engine/smi.h>#include <wrn/wm/demo/nvutils.h>#if (INSTALL_ENVOY_SNMP_VERSION_3) #include <wrn/wm/snmp/engine/objectid.h>#include <wrn/wm/snmp/engine/v3_eng.h>#include <wrn/wm/snmp/engine/v3_user.h>#include <wrn/wm/snmp/engine/v3_auth.h>#include <wrn/wm/snmp/engine/v3_priv.h>#include <wrn/wm/snmp/engine/v3_acc.h>#include <wrn/wm/snmp/engine/v3_con.h>#if (INSTALL_ENVOY_SNMP_V3_TARGET)#include <wrn/wm/snmp/engine/v3_trgt.h>#if (INSTALL_ENVOY_SNMP_V3_NOTIFY)#include <wrn/wm/snmp/engine/v3_ntfy.h>#endif /* #if (INSTALL_ENVOY_SNMP_V3_NOTIFY) */#if (INSTALL_ENVOY_SNMP_V3_PROXY)#include <wrn/wm/snmp/engine/v3_proxy.h>#endif /* #if (INSTALL_ENVOY_SNMP_V3_PROXY) */#if (INSTALL_ENVOY_SNMP_COEXISTENCE)#include <wrn/wm/snmp/engine/v3_comm.h>#endif /* #if (INSTALL_ENVOY_SNMP_COEXISTENCE) */#endif /* #if (INSTALL_ENVOY_SNMP_V3_TARGET) */#endif /* #if (INSTALL_ENVOY_SNMP_VERSION_3) */#if (INSTALL_ENVOY_ENTITY_MIB)#include <wrn/wm/snmp/engine/entlogic.h>#endif /* #if (INSTALL_ENVOY_ENTITY_MIB) */#include <wrn/wm/common/glue.h>/****************************************************************************Space for the non-volatile configuration file names****************************************************************************/char  NV_Config_Static[MAX_NVF]      = "snmp_nv.txt";char *NV_Config_File                 = NV_Config_Static;char  NV_Old_Config_Static[MAX_NVF]  = "snmp_nv.old";char *NV_Old_Config_File             = NV_Old_Config_Static;char  NV_Temp_Config_Static[MAX_NVF] = "snmp_nv.tmp";char *NV_Temp_Config_File            = NV_Temp_Config_Static;/* Flags to tell us what to do.   Read only: only read the file (1), the default is writeable (0)   Get views: from config file (1) or the precompiled versin (0) */int NV_Read_Only         = 0;int NV_Views_From_Config = 1;extern VIEWINDEX_T *precomp_viewroot;TB_T etc_tokens[] = { {TPREAMBLE, "preamble"},#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS)		      {TVIEW, "1445view"},#endif#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS)		      {TVIEW, "2275view"},#endif		      {TV3MYENGINE, "v3myengine"}, {TV3ENGINE,  "v3engines"},		      {TV3USER,     "v3user"},     {TV3GROUP,   "v3group"},		      {TV3ACCESS,   "v3access"},   {TV3CONTEXT, "v3context"},		      {TMYAGENT,    "myagent"},    {TAGENT,     "agent"},		      {TACCESS,     "access"},     {TCONTEXT,   "context"},		      {TUSER,       "user"},       		      {TV3TADDR,    "v3targetaddr"}, 		      {TV3TPARM,    "v3targetparams"},		      {TV3NTFY,     "v3notify"},   		      {TV3NPROF,    "v3notifyprofile"},		      {TV3NFILT,    "v3notifyfilter"},                      {TV3PROXY,    "v3proxy"},    {TV3TRAP,     "v3trap"},                      {TCOMMUNITY,  "community"},  {TENTLOGIC,   "entlogic"},                      {0, ""}                      };TB_T preamble_tokens[] = { {TVERSION, "version"}, {0, ""} };TB_T view_tokens[] = { {TVID,      "identity"}, {TVSTATUS, "status"},                       {TVSTORAGE, "storage"},  {TVMASK,   "mask"},                       {TVTYPE,    "type"},     {0, ""}                     };TB_T agent_tokens[] = { {TAGID, "agentid"}, {TAGBOOTS, "agentboots"}, {0, ""}};TB_T access_tokens[] = { {TACID,    "agentid"},     {TACUNAME, "username"},                         {TACCNAME, "contextname"}, {TACQOS,   "qos"},                         {TACPRIV,  "privileges"},  {TACRIND,  "readindex"},                         {TACWIND,  "writeindex"},  {0, ""}                       };TB_T context_tokens[] = { {TCID,    "agentid"}, {TCCNAME, "contextname"},                          {TCFLAGS, "flags"},   {0, ""}			};TB_T user_tokens[] = { {TUID,       "agentid"},  {TUUNAME,   "username" },                       {TUAUTHPROT, "authprot"}, {TUAUTHKEY, "authkey"},                       {0, ""}                     };TB_T engine_tokens[] = { {TENGID, "engineid"}, {TENGBOOTS, "engineboots"},			 {TENGTADDR, "engineaddress"}, {0, ""}                       };TB_T v3user_tokens[] = { {TV3UID,       "engineid"}, {TV3UUNAME,   "username"},			 {TV3UAUTHPROT, "authprot"}, {TV3UAUTHKEY, "authkey"},			 {TV3UPRIVPROT, "privprot"}, {TV3UPRIVKEY, "privkey"},			 {TV3USTATUS,   "status"},   {TV3USTORAGE, "storage"},			 {0, ""}                       };TB_T v3group_tokens[] = { {TV3GUSER,    "user"},    {TV3GMODEL,  "model"},			  {TV3GGROUP,   "group"},   {TV3GSTATUS, "status"},			  {TV3GSTORAGE, "storage"}, {0, ""}			};TB_T v3access_tokens[] = { {TV3ACGROUP,  "group"},  {TV3ACPREFIX,  "prefix"},			   {TV3ACMATCH,  "match"},  {TV3ACMODEL,   "model"},			   {TV3ACLEVEL,  "level"},  {TV3ACREAD,    "read"},			   {TV3ACWRITE,  "write"},  {TV3ACNOTIFY,  "notify"},			   {TV3ACSTATUS, "status"}, {TV3ACSTORAGE, "storage"},			   {0, ""}			};TB_T v3context_tokens[] = { {TV3CNAME, "context"}, {0, ""}			};TB_T v3taddr_tokens[] = { {TV3TADDRNAME, "name"}, 			  {TV3TADDRTDOM, "tdomain"},			  {TV3TADDRTADDR, "taddress"}, 			  {TV3TADDRTMASK, "tmask"},			  {TV3TADDRTMOUT, "timeout"}, 			  {TV3TADDRRETRY, "retry"},			  {TV3TADDRTMMS, "maxmsg"},			  {TV3TADDRTLIST, "taglist"}, 			  {TV3TADDRPARMS, "params"},			  {TV3TADDRSTORAGE, "storage"},			  {TV3TADDRSTATUS, "status"}, {0, ""}                        };TB_T v3tparm_tokens[] = { {TV3TPARMNAME, "name"}, {TV3TPARMMPMOD, "mpmodel"},			  {TV3TPARMSECMOD, "sec_model"},			  {TV3TPARMSECNAM, "sec_name"},			  {TV3TPARMSECLVL, "sec_lvl"},			  {TV3TPARMSTORAGE, "storage"},			  {TV3TPARMSTATUS, "status"}, {0, ""}                        };TB_T v3ntfy_tokens[] = { {TV3NTFYNAME, "name"}, {TV3NTFYTAG, "tag"},			 {TV3NTFYTYPE, "type"}, {TV3NTFYSTORAGE, "storage"},			 {TV3NTFYSTATUS, "status"}, {0, ""}                       };TB_T v3nprof_tokens[] = { {TV3NPROFPARM, "params_name"},			  {TV3NPROFNAME, "profile_name"},			  {TV3NPROFSTORAGE, "storage"},			  {TV3NPROFSTATUS, "status"}, {0, ""}                        };TB_T v3nfilt_tokens[] = { {TV3NFILTPNAME, "profile_name"},			  {TV3NFILTSTREE, "subtree"}, {TV3NFILTMASK, "mask"},			  {TV3NFILTTYPE, "type"}, {TV3NFILTSTORAGE, "storage"},			  {TV3NFILTSTATUS, "status"}, {0, ""}                        };TB_T v3proxy_tokens[] = { {TV3PROXYNAME, "proxy_name"},			  {TV3PROXYTYPE, "proxy_type"},                          {TV3PROXYCONID, "context_engine_id"},                          {TV3PROXYCONNAME, "context_name"},                          {TV3PROXYPARAMSIN, "target_params_in"},                          {TV3PROXYSINGLE, "single_target_out"},                          {TV3PROXYMULTIPLE, "multiple_target_out"}, 			  {TV3PROXYSTORAGE, "storage"},			  {TV3PROXYSTATUS, "status"}, {0, ""}                        };TB_T v3trap_tokens[] = { {TV3TRAPNAME, "trap_name"},                         {TV3TRAPOID, "object_oid"},                         {TV3TRAPTYPE, "object_type"},                         {TV3TRAPVALUE, "object_value"},                         {TV3TRAPCOUNT, "vb_count"}, {0, ""}                       };TB_T community_tokens[] = { {TCOMMINDEX, "index"},                            {TCOMMNAME, "name"},                            {TCOMMSECNAME, "sec_name"},                            {TCOMMCONID, "context_engine_id"},                            {TCOMMCONNAME, "context_name"},                            {TCOMMTAG, "transport_tag"},                            {TCOMMSTORAGE, "storage"},                            {TCOMMSTATUS, "status"}, {0, ""}                          };                          

⌨️ 快捷键说明

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