📄 snmpvars.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/router/snmpvars.c,v 1.3 2003/01/15 14:04:50 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 1994-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: snmpvars.c,v $ * Revision 1.3 2003/01/15 14:04:50 josh * directory structure shifting * * Revision 1.2 2001/11/09 21:06:51 josh * demo router path modification * * Revision 1.1.1.1 2001/11/05 17:49:10 tneale * Tornado shuffle * * Revision 2.14 2001/01/19 22:24:38 paul * Update copyright. * * Revision 2.13 2000/03/17 00:14:19 meister * Update copyright message * * Revision 2.12 1998/10/28 18:51:12 josh * marging in courier-sep98 branch * * Revision 2.11 1998/09/18 19:55:13 meister * timer call renaming; tm_ --> etc_tm_ * * Revision 2.10.6.1 1998/09/12 19:27:36 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 2.10 1998/06/08 19:53:49 sar * Moved the validate and proxy code to the snark library this also * required adding the snark/lib into the library path for a second time * after the envoy libraries * * Revision 2.9 1998/02/25 15:21:52 sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 2.8 1998/02/25 04:57:47 sra * Update copyrights. * * Revision 2.7 1997/11/13 18:50:57 josh * adding Liaison call to rmon_new_snmp_command() to the * validate_community() function for now * * Revision 2.6 1997/03/20 06:53:27 sra * DFARS-safe copyright text. Zap! * * Revision 2.5 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 2.4 1996/10/30 16:25:57 sra * Fix pktcom_xxx warnings again, in yet another copy of this file. * Sigh. * * Revision 2.3 1996/10/16 20:20:31 sar * Declare all response pdus as valid. * * Revision 2.2 1996/10/16 16:40:35 sar * Added proxy and timer code. * * Revision 2.1 1996/03/22 10:05:39 sra * Update copyrights prior to Attache 3.2 release. * * Revision 2.0 1995/05/10 22:38:15 sra * Attache release 3.0. * * Revision 1.3 1995/01/06 00:52:48 sra * Update copyright notice for 2.1 release. * * Revision 1.2 1994/12/20 22:41:54 dab * Changed sysObjectId to identify the router. * * Revision 1.1 1994/11/23 18:31:00 dab * Initial revision * * *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*//* * SNMP variables and routines for snark. */#include <wrn/wm/attache/config.h>#include <wrn/wm/common/types.h>#include <wrn/wm/attache/mib.h>#include <wrn/wm/attache/timer.h>#include <wrn/wm/attache/packet.h>#include <wrn/wm/attache/net.h>#include <wrn/wm/attache/route.h>#include <wrn/wm/attache/ip.h>#include <wrn/wm/attache/mib.h>#include <wrn/wm/attache/glue.h>#include <wrn/wm/attache/arp.h>#include <wrn/wm/attache/udp.h>#if INSTALL_ATTACHE_DNS#include <wrn/wm/attache/dns.h>extern struct dns_config domain_config;#endif#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/mib.h>#include <wrn/wm/snmp/engine/localio.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/snmpstat.h>#include <wrn/wm/snmp/engine/proxy_tr.h>#include <wrn/wm/attache/snmpvars.h>#include <wrn/wm/demo/snmpfunc.h>#if (ENVOY_NEED_STATS)SNMP_STATS_T snmp_stats;#endifOIDC_T snmp_product_id[] = { 1, /* ( 0) iso */ 3, /* ( 1) org */ 6, /* ( 2) dod */ 1, /* ( 3) internet */ 4, /* ( 4) private */ 1, /* ( 5) enterprises */ 12, /* ( 6) Epilogue Technology */ 7, /* ( 7) products */ 6, /* ( 8) router package (may be changed at runtime) */ 1, /* ( 9) major version (may be changed at runtime) */ 0, /* (10) minor version (may be changed at runtime) */};void set_snmp_product_id(OIDC_T product, OIDC_T major, OIDC_T minor){ snmp_product_id[ 8] = product; snmp_product_id[ 9] = major; snmp_product_id[10] = minor;}OBJ_ID_T var_sysObjectID = { sizeof(snmp_product_id)/sizeof(*snmp_product_id), snmp_product_id};char snmp_auth_traps = 1;long var_sysServices = 4;#define DEFVAR(name, maxlen, value) \ static char name##_data[maxlen] = value; \ struct string_wlen name = { maxlen, sizeof(value) - 1, name##_data };DEFVAR(var_sysDescr, MAX_SYSDESCR, "Epilogue Technology demo Router");DEFVAR(var_sysContact, MAX_SYSCONTACT, "sysContact not set");DEFVAR(var_sysLocation, MAX_SYSLOCATION, "sysLocation not set");DEFVAR(var_sysName, MAX_SYSNAME, "sysName not set");#undef DEFVAR#if 0void snmpvars_init(){ MEMSET(&snmp_stats, 0, sizeof(snmp_stats)); /* Might do run-time config of system crufties here. */}#endifstruct timer main_envoy_tm;int first = 1;void envoy_glue_handler(struct timer *tm, void *cookiep){ (*((void (*) (void)) cookiep))();}void envoy_call_timer(bits32_t when, void (*what)(void)){ if (first) { etc_tm_init(&main_envoy_tm); first = 0; } main_envoy_tm.handler = envoy_glue_handler; main_envoy_tm.cookie =(void *)what; etc_tm_set(&main_envoy_tm, when); return;}/* Glue routine to connect up to the attache now routine elsewhere in snark/lib. We use this mechanism instead of envoy.h so we can compile most of the code without knowing what we are running on the top of */bits32_t envoy_now(void){return(glue_now());}#if (INSTALL_ENVOY_SNMP_PROXY)/****************************************************************************NAME: proxy_send_rtnPURPOSE: glue routine to connect up to the real send rtn in snark/libPARAMETERS: EBUFFER_T * The buffer to send ptr_t Information as to where to send the buffer.RETURNS: sbits32_t A reasonable timeout period for this transport ****************************************************************************/sbits32_t proxy_send_rtn(EBUFFER_T *ebuf, ptr_t cookie){return(attache_proxy_send_rtn(ebuf, cookie));}#endif /* #if (INSTALL_ENVOY_SNMP_PROXY) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -