📄 snmpvars.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/unxagent/sun/snmpvars.c,v 1.3 2002/03/06 20:02:38 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 1988-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: snmpvars.c,v $ * Revision 1.3 2002/03/06 20:02:38 josh * the unxagent will now listen on an IPv6 socket, if IPv6 is * available * * Revision 1.2 2001/11/09 21:49:03 josh * unxagent demo path adjustment, first pass * * Revision 1.1.1.1 2001/11/05 17:49:17 tneale * Tornado shuffle * * Revision 7.9 2001/01/19 22:25:03 paul * Update copyright. * * Revision 7.8 2000/07/10 15:55:17 mrf * Add configuration for Cygnus NT environment with associated changes. * * Revision 7.7 2000/03/17 00:15:32 meister * Update copyright message * * Revision 7.6 1998/06/08 19:46:50 sar * Changed the installation option we check on for the snmp stats * to envoy_need_stats, to make it easier to change in the future. * * Revision 7.5 1998/06/07 03:04:42 sar * Moved the global variables for the non-volatile configuration stuff * and the community strings to the snark library. * Also changed the names of the configuration variables * * Revision 7.4 1998/02/25 04:58:23 sra * Update copyrights. * * Revision 7.3 1997/03/20 06:54:14 sra * DFARS-safe copyright text. Zap! * * Revision 7.2 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 7.1 1997/01/08 23:01:49 sar * Updated copyright and modified include files to use envoy/h as * appropriate * * Revision 7.0 1996/03/15 22:07:57 sar * Updated revision to 7.0 and copyright to 96 * * Revision 6.3 1995/11/14 22:46:31 sar * Added SetSerialNo * * Revision 6.2 1995/11/11 00:12:33 sar * added a new command option to decide whre the viewtree comes from - * the config.txt file or nvviews.c * * Revision 6.1 1995/11/01 01:03:00 sar * redefined the config stuff to install on rfc1445_view_routines * * Revision 6.0 1995/05/31 21:49:49 sra * Release 6.0. * * Revision 5.3 1995/03/21 19:37:43 sar * Defined snp_use_async to allow us to switch between sync and async * processing on the fly. * * Revision 5.2 1994/09/29 20:34:40 sar * Modified the allocation of the SNMP_Talk_NV strings we now have * a pointer for use in nvutils.c and a array for use in read_con.c * for each of the the three names. * * Revision 5.1 1994/09/23 19:32:44 sar * Changed the non volatile scheme, and added some new options to the * config file. * * Revision 5.0 1994/05/16 16:20:43 sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.0 1993/06/24 17:31:48 sar * Updated rev to 4.0 copyright to 93 * and made the if defined(install..) checks be if install * * Revision 3.2 1993/04/22 20:23:42 sar * Updated macros and defines to use the naming scheme. * For example we now use INSTALL_ENVOY_SNMP_VERSION_1 or _2. * * Revision 3.1 1993/02/18 20:29:44 sar * Updated check on SGRP to be either a check on SGRPv1 or (SGRPv1 || SGRPv2) * * Revision 3.0 1992/04/03 19:53:44 dab * Release 3.0 * * Revision 2.102 92/02/04 11:25:54 dab * Changed product ID to be something from the Epilogue MIB. * * Revision 2.101 92/02/04 10:47:31 dab * Updated for release 3.0 of SNMP. * * Revision 2.100 92/02/03 16:46:17 dab * Generic unix SNMP agent. * * * Rev 2.0 31 Mar 1990 15:34:16 * Initial revision. * * Rev 1.0 10 Oct 1988 21:48:48 * Initial revision.*//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*/#include <wrn/wm/snmp/engine/asn1conf.h>#if (!defined(asn1_inc))#include <wrn/wm/snmp/engine/asn1.h>#endif#if (!defined(snmp_inc))#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/snmpstat.h>#endif#include <sys/types.h>#include "snmpvars.h"#include <stdio.h>#include <string.h>#include <memory.h>#include <sys/socket.h>#include <ctype.h>#include <netinet/in.h>#include <net/if.h>#if !INSTALL_on_ntgcc#include <netinet/if_ether.h>#endif#include <netdb.h>#if !INSTALL_on_ntgcc#include <arpa/inet.h>#endif#include <fcntl.h>#include <sys/time.h>#include "general.h"#include "../agent.h"/********************************************************************** * * Define the various SNMP management variables used in this system. * * This file should closely match snmpvars.h * **********************************************************************/char snmp_auth_traps = 1;OIDC_T snmp_product_id[] = { /* ISO */ 1, /* ORG */ 3, /* DOD */ 6, /* INTERNET */ 1, /* PRIVATE */ 4, /* ENTERPRISES */ 1, /* Epilogue Technology */ 12, /* Products */ 7, /* Unix Agent */ 1, /* Version 3 */ 3, /* Subversion */ 0 };int snmp_product_id_count = sizeof(snmp_product_id)/sizeof(OIDC_T);unsigned char snmp_local_ip_address[4] = {128, 224, 0, 0};/* WARNING: The following strings should be in NVT form, i.e. any embedded *//* newlines whould be carriage-return followed by linefeed (newline) */char snmp_sysDescr[MAX_SYSDESCR] = "Epilogue Technology SNMP agent for Sun OS 4";char snmp_sysContact[MAX_SYSCONTACT] = "sysContact not set";char snmp_sysLocation[MAX_SYSLOCATION] = "sysLocation not set";char snmp_sysName[MAX_SYSNAME] = "sysName not set";char kernel_file[MAX_KERN_FILE] = "/vmunix";OBJ_ID_T snmp_sysObjectID = {sizeof(snmp_product_id)/sizeof(OIDC_T), snmp_product_id };struct timeval boot_at = {0L, 0L};char config_file[MAX_CONFIG_FILE] = CONFIG_FILE;int trap_2_cnt; /* How many entries follow */u_long traplist[MAX_TRAPS_TO]; /* IP addresses where to send traps */int trace_level = 0; /* Execution trace level */int snmp_socket; /* Socket used to send traps and */ /* send/receive SNMP queries, usually */ /* UDP port 161 */#if INSTALL_SNMP_DEMO_AGENT_IPV6int snmp_ipv6_socket; /* Socket for SNMP queries over IPV6 */#endifint snmp_use_async = 1; /* 0 use the old sync style call 1 use the new async style call */INT_32_T snmpSetSerialNo; /* space for the serial no */#if (ENVOY_NEED_STATS)SNMP_STATS_T snmp_stats;#endif int snmpvars_init(){#if (ENVOY_NEED_STATS)MEMSET(&snmp_stats, 0, sizeof(snmp_stats));#endif /* Leave setting of the trap socket desciptor for agent_body() */return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -