📄 snmpconf.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/snmpconf.c,v 1.4 2003/01/15 14:04:35 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 1991-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* Routines for parsing the snmp configuration information as well as a bunch of standard variable space, moved here from snmptalk/parse.c*/ /* * $Log: snmpconf.c,v $ * Revision 1.4 2003/01/15 14:04:35 josh * directory structure shifting * * Revision 1.3 2002/03/11 19:13:57 josh * dest_addr is now an ipaddr_t, and added a v6_scope for IPv6 support * * Revision 1.2 2001/11/08 15:56:27 tneale * Updated for newest file layout * * Revision 1.1.1.1 2001/11/05 17:48:43 tneale * Tornado shuffle * * Revision 1.6 2001/01/19 22:23:52 paul * Update copyright. * * Revision 1.5 2000/03/17 00:12:45 meister * Update copyright message * * Revision 1.4 1998/11/25 03:38:18 sra * "timeout" => "snmp_timeout" to fix OpEN symbol conflict. * * Revision 1.3 1998/10/28 18:51:01 josh * marging in courier-sep98 branch * * Revision 1.2.4.1 1998/09/12 19:27:33 sra * Minor kludges to make this development snapshot of snark compile with * the released versions of the Attache, Envoy, and Emissary products. * These changes will need to be un-done when this branch is merged back * into the main code base. * * Revision 1.2 1998/07/06 01:04:56 sar * Add some casts and change atoi to strtol to make compilers happy * * Revision 1.1 1998/06/23 20:40:57 sar * Moved the general snmp configuration code here from snmptalk/parse.c. * Also arranged for the snmp config routine to call the nv config routine * if necessary. * *//* [clearcase]modification history-------------------01b,19apr05,job update copyright notices01a,25mar05,job add an option handler for -a*//* * Revision history from when this was snmptalk/parse.c * * * Revision 7.13 1998/06/07 02:52:56 sar * Move the global configuration arguments to snark library * * Revision 7.12 1998/06/04 15:13:51 sar * Cleaned up some installation options to allow v3 to work if v2 isn't * installed * * Revision 7.11 1998/06/03 21:50:28 sar * Moved nvutils and nvviews to snark/lib so we can have one copy shared * amongst the demos * Moved the common string functions from stdf to common/lib and created * a series of macros for this code to use * Moved strdup to snark/lib and renamed it to etc_strdup to avoid * needing one from the system libraries * * Revision 7.10 1998/05/23 18:19:25 sar * Added global arguments for v3 along with their defaults * * Revision 7.9 1998/02/25 15:21:58 sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 7.8 1998/02/25 04:58:00 sra * Update copyrights. * * Revision 7.7 1997/05/17 23:08:59 sra * Clean up some SunOS/gcc warnings. * * Revision 7.6 1997/03/20 06:53:53 sra * DFARS-safe copyright text. Zap! * * Revision 7.5 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 7.4 1997/02/19 08:10:29 sra * More fun merging snmptalk into snark, general snark cleanup. * * Revision 7.3 1997/01/10 20:32:39 sra * Punt this copy of parse_line(), since there's a better one snark/lib. * * 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 02:00:21 sar * updated config_defaults to use snark read_ini code and removed outfile * * Revision 7.0 1996/03/18 20:19:20 sar * Updated rev to 7.0 and copyright to 96 * * Revision 6.4 1996/01/26 22:05:01 sar * added a check to see if usec is installed when deciding what * to do about nv config files. * * Revision 6.3 1996/01/10 16:41:40 sar * Usec updates * * 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 * remvoed dparty, sparty and context info * * Revision 6.0 1995/05/31 21:50:19 sra * Release 6.0. * * Revision 5.4 1995/03/21 00:50:48 sar * Added a packet_dump option to snmptalk, this allows the user to trun * packet dumping on & off while snmptalk is running. * * Revision 5.3 1994/11/09 01:43:52 sar * Read the nv config file if/when we need to. If the master_agent or * v2_view options are installed we always read it, if they aren't vut * v2 is installed we check the snmptalk_version flag if it is 2 we read * the file if it is 1 we don't. The first time we switch to v2 we * try and read the file and complain if one doesn't exist. If we only * have v1 installed we never read the config file. * * Revision 5.2 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. * * Revision 5.1 1994/07/24 15:41:03 dab * Added ability to set UDP port used by manager and the set command can * now specify enumerated integer values by symbolic name. * * Revision 5.0 1994/05/16 15:57:40 sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.2 1994/03/22 10:07:20 sra * Add "snmp-version" keyword to config file. * * Revision 4.1 1993/11/30 19:52:15 sar * Changed the initial source and destination parties and context to use * an ip address of 127.0.0.1. * * Revision 4.0 1993/06/24 17:14:56 sar * Updated rev to 4.0 and copyright to 93 * * Revision 3.11 1993/06/13 02:48:16 sar * moved inclusion of stdf.h to be after asn1.h so that NO_PP will be defined * if desired. * * Revision 3.10 1993/06/09 20:00:50 dab * need <types.h> to get NO_PP * * Revision 3.9 1993/05/19 20:38:22 sar * Added procedure prototypes to some of the routines. (#if !defined(NO_PP)...) * * Revision 3.8 1993/05/17 20:36:13 sar * added <install.h> and "stdf.h" to include string routines that zortech * didn't have. * * Revision 3.7 1993/05/13 19:08:06 sar * Added code to use a file implementation of nv memory * * Revision 3.6 1993/03/03 20:04:39 dab * The routine ini_lookup() returns a malloc'd string, free it. * Added new routine parse_hex_octet_string. * * Revision 3.5 1993/03/02 18:18:33 dab * Added read_config_defaults() * * Revision 3.4 1993/02/19 19:29:35 dab * Added the -m switch to set the name of the mib file. * * Revision 3.3 1993/02/17 21:19:41 sar * Added declarations for spoid, dpoid and cpoid (source and dest parties and * context oids) and their lengths (spoidlen, dpoidlen and cpoidlen). * These are used to determine what parties to use for a v2 packet. * * Revision 3.1 92/06/16 16:05:40 dab * Added batch mode * * Revision 3.0 92/04/03 19:53:14 dab * Release 3.0 * * Revision 2.102 91/11/03 10:04:49 dab * Don't include <strings.h>, let system.h do it instead. * * Revision 2.101 91/10/30 09:21:25 dab * Include system.h instead of trying to declare strdup or not * in here. * * Revision 2.100 91/08/09 14:05:21 dab * Update version number. This is just before the work to upgrade to * release 3.0. * * Revision 1.1 91/07/11 18:13:29 romkey * Initial revision * */#include <wrn/wm/common/install.h>#include <wrn/wm/common/types.h>#include <wrn/wm/common/config.h>#include <wrn/wm/snmp/engine/asn1.h>#include <stdio.h>#include <ctype.h>#include <wrn/wm/demo/snarklib.h>#include <snark.h>#include <wrn/wm/demo/snmpconf.h>#include <wrn/wm/demo/read_ini.h>#include <wrn/wm/demo/parse.h>#include <wrn/wm/demo/strdup.h>#include <wrn/wm/demo/nvutils.h>#include <wrn/wm/common/glue.h>#if INSTALL_ENVOY_SNMP_VERSION_2int SNMPTalk_SNMP_Version = 2;#elif INSTALL_ENVOY_SNMP_VERSION_1int SNMPTalk_SNMP_Version = 1;#elseint SNMPTalk_SNMP_Version = 3;#endifchar *read_community = "public";char *write_community = "public";char *mib_filename = "mib.rt";char *destination = 0;unsigned udp_port = 161;ipaddr_t dest_addr = { IPNONE, { 0 } };#if INSTALL_SNMP_DEMO_AGENT_IPV6int v6_scope = 0;#endifint snmp_timeout = 4;int retry_count = 2;int batch_mode = 0;int packet_dump = 0;/* Use alternate display mechanism */int alt_display = 0;/* defaults for version 3 stuff */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -