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

📄 snmp_d.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 3 页
字号:
/* snmp_d.c - snmp_d.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 1988-1997 Epilogue Technology Corporation. *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: snmp_d.c,v $ * Revision 1.6  2003/01/15 14:05:08  josh * directory structure shifting * * Revision 1.5  2002/07/09 19:14:27  josh * remove a namespace collision by renaming SNMP_community_lookup() * to SNMP_community_coexistence_lookup() * * Revision 1.4  2001/12/11 18:19:58  meister * A_DecodeInteger64Data doesn't really need to be DYNCFG'd. * * Revision 1.3  2001/11/06 21:50:50  josh * second (and hopefully final) pass of new path hacking * * Revision 1.2  2001/11/06 21:20:28  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:43  tneale * Tornado shuffle * * Revision 9.4.4.4  2001/09/27 01:12:52  meister * dynamic config rototill * * Revision 9.4.4.3  2001/09/18 21:23:02  meister * DYNCFG_VBL(snmp_use_v2_types) should be DYNCFG_VBL(envoy_use_v2_types) * * Revision 9.4.4.2  2001/08/06 20:05:40  meister * Added dynamic component configuration macros to V3 conditional code * * Revision 9.4.4.1  2001/07/20 20:34:37  josh * a community table based validation routine that can * supercede existing community validation routines * * Revision 9.4  2001/04/19 18:21:40  josh * changes to do bounds-checking on maxMsgSize, snmpVersion, * msgID, and snmpSecurityModel * * Revision 9.3  2001/01/19 22:22:27  paul * Update copyright. * * Revision 9.2  2000/03/17 00:19:24  meister * Update copyright message * * Revision 9.1  1999/04/09 20:37:10  josh * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT * * Revision 9.0  1998/10/16 22:12:17  sar * Update version stamp to match release * * Revision 8.8  1998/09/04 14:33:12  sar * Added some casts to try and keep compilers happy * * Revision 8.7  1998/06/28 21:51:19  sar * Added some installation options to avoid buidling unneeded code * * Revision 8.6  1998/06/22 03:11:13  sar * Changed the type used for lengths in localio.  We now use ALENGTH_Ts * to make it match the rest of the code and keep compilers happy * * Revision 8.5  1998/06/05 18:53:22  sra * "#include <foo.h>" => "#include <envoy/h/foo.h>". * * Revision 8.4  1998/05/29 04:31:12  sar * Add and use defines for v2 types and v2 protocol pieces.  This allows * us to include the types and pieces for other versions, such as v3, * without having to touch all of the seperate files that use the * types or pieces. * * Revision 8.3  1998/05/24 04:39:16  sar * Add code to make calls to process (size, encode, decode) SNMPv3 packets. * Also moved code around to make it clearer. * * Revision 8.2  1998/02/25 15:21:36  sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 8.1  1998/02/25 04:52:39  sra * Update copyrights. * * Revision 8.0  1997/11/18 00:57:03  sar * Updated revision to 8.0 * * Revision 7.5  1997/11/01 01:25:39  sar * In the packet we are processing save a pointer to the coarse lock we * are using so that we can free it later without needing to know which * lock it was. * * Revision 7.4  1997/10/22 03:10:28  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. * * Revision 7.3  1997/10/16 00:46:07  sar * Updated for agentx support, with most of the work in mibutils.c to deal * with interior leaves and the pdu processors to deal with agentx leaves, * especially their reference counts. * * Add a bug macro into the get_{read write}_lock calls to give the user * a chance if things start going wrong. * * Fixed a potential problem int the proxy code where we were trying to * stuff a 32 bit quantity into a pointer which may or may not work depending * on the platform. * * Revision 7.2  1997/03/20 06:49:18  sra * DFARS-safe copyright text.  Zap! * * Revision 7.1  1997/02/25 10:49:26  sra * Update copyright notice, dust under the bed. * * Revision 7.0  1996/03/18 20:01:11  sar * Updated revision to 7.0 and copyright to 96 * * Revision 6.7  1996/01/23  16:27:24  sar * Added send report pdu option for unknown agent id * * Revision 6.6  1996/01/10  16:34:47  sar * usec updates * * Revision 6.5  1995/11/16  22:04:38  sar * modified snmp_decode_packet to be cleaner with only one packet format * * Revision 6.4  1995/11/01  00:46:48  sar * added ifdefs to the version switch for pdu types * arranged to leave out the v1 trap code if we aren't compiling v1 * * Revision 6.3  1995/10/20  23:02:48  sar * remvoed bitstring, nsapaddress, and uintger32 from decode & cleanup * routines * removed init/cleanup of party stuff from packet structure * remved the v2 party code * * Revision 6.2  1995/09/18  19:23:58  sar * Moved the endif for what gets compiled if we aren't compiling a * subagent only library. * Removed the NO_PP stuff. * * Revision 6.1  1995/06/05  20:58:44  sar * Moved the cleaning of the data area from clean_vb into clean_vb_data * so it can be used elsewhere (nextpdu.c for example). * * Revision 6.0  1995/05/31  21:48:12  sra * Release 6.0. * * Revision 5.10  1995/05/22  19:43:54  sar * Init per packet lock if continue_reentrant is installed. * * Revision 5.9  1995/05/20  02:37:57  sar * Corrected misspelling of INSTALL_ENVOY_SNMP_SERIALIZE * * Revision 5.8  1995/04/28  23:22:26  sar * Added a GateDecrement call in the cleanup routines * added a test of the serialization flag before compilinig in the call * to clean up inactive objects. * * Revision 5.7  1995/04/18  21:13:44  sar * Use new lock macros, some format changes and added group cleanup. * * Revision 5.6  1995/03/21  00:30:26  sar * Removed the definitions for the stats macros, they are now in snmpstat.h * Removed some fo the ifdefs associated with the lock code as * the defaults for the lock macros are now "successful" * Switch to using MEMSET and MEMCPY macros * Switch to using for & loc to name parties (instead of src & dst) * Updated the packet cleanup rotuines to deal with the saved_vbl struct * in the std_pdu struct. * * Revision 5.5  1994/10/12  20:25:37  sar * Moved the code to do vb_free_priv to be earlier in the clean_vb routine * so that the vb_free_priv routine can access the vb. * modified trap_time_ticks to be a uint32. * * Revision 5.4  1994/09/29  18:37:21  sar * If we aren't using the v2 types remove the code to handle them mostly * this means ifdef the code.  In mibutils.c and snmp_d.c we need to * examine the version of the packet in some cases to reject v2 types for * a v1 packet when both v1 and v2 are installed. * * Revision 5.3  1994/07/29  18:07:11  sar * Added a type check on a v1 pdu, any non-v1 pdus are flushed as ans1 errors. * * Revision 5.2  1994/07/26  21:59:37  sar * Moved the acquistion of the generic read lock from the packet allocation * routine to the decode block, after we allocate the packet.  This will * allow the packet allocation routine to be used more liberally. * * Revision 5.1  1994/05/17  20:37:37  sar * Added some break statements around the lock switch * * Revision 5.0  1994/05/16  15:42:42  sar * Updated revision to 5.0 and copyright to include 1994 * * Revision 4.10  1994/05/10  20:16:03  sar * moved VarBindList_Allocate so it will be available to sub agents. * * Revision 4.9  1994/05/06  20:31:27  sar * removed the ifdef v1 for the community string as we now use it for * the localentity string in v2. * * Revision 4.8  1994/05/04  23:48:43  sar * Made VBPRIVPROC's always take an argument of PTR_T (dropped the VB_T *) * possibility). * * Revision 4.7  1994/05/02  21:20:43  sar * fill in the localtimeobj after finding the context so that method * routines can use it. * * Revision 4.6  1994/05/02  17:02:30  sar * Added new decode routines *WTC (with type check) to type check the string * as it is being decoded.  Mostly these will be used in snmp_d.c * * Revision 4.5  1994/04/29  21:13:03  sar * added a typecast for SA_freeproc to make the compiler happy. * * Revision 4.4  1994/04/29  21:09:32  sar * Well, 4.3 was the wrong version so this time let's check in the correct * version. * * Revision 4.3  1994/04/29  20:54:59  sar * Moved the oids for src and dest party and context into the snmp_pkt struct. * Sub agent scheme modifications: moved code around to ifdef it more easily * set the view_index field while decoding a v2 packet, added the VB_FREE * compat option. * * Revision 4.2  1994/01/25  20:49:11  sar * Added a check of the pdu type during the header check for v2. * Previously a packet with an unknow pdu would make it through to the * acl check and fail with an auth error instead of causing a parse error. * * Revision 4.1  1993/09/30  19:54:41  sar * Several Fixes: * Stopped incrementing snmpInGenErrs as we were doing due to gen errs in * our code instead of incoming packets that had the InGenErr tag. * Removed a useless increment of snmpInASNParseErrs and made several * increments that were only counting if v1 was installed count if eith * v1 or v2 are installed. * Realigned some # statements to be in the first column to make some * preprocessors happy. * Added a incrementer for the UnknownDst in the case that the party is * known but not local. * Modified the code to deal with cleaning up a VBLP so that we clean up * the chain that a GetBulk may produce. * Finally corrected one comment. * * Revision 4.0  1993/06/24  15:45:46  sar * Updated revision to 4.0 and copyright to 93 * * Revision 3.26  1993/06/09  21:15:25  sar * Changed the initialization of a vbl, we now 0 the whole thing and * initialize only what isn't 0. * * Revision 3.25  1993/06/07  18:26:04  sar * Modifed SNMP_Decode_Packet to be SNMP_Deocde_Packet_WER to allow * the decode routines to return an error (with error return) that * indicates the caller should send the packet back as a response. * * Revision 3.24  1993/06/02  23:09:24  dab * Changed #ifdef's to #if's for things from install.h * * Revision 3.23  1993/05/22  01:04:31  sar * Cleaned up use of stats so we can compile if they aren't included. * * Revision 3.22  1993/05/19  21:00:49  sar * removed the unused vars authinfo_flags and authinfo_type * * Revision 3.21  1993/05/14  15:13:00  sar * renamed private field in packet structure to be user_private * * Revision 3.20  1993/05/05  15:00:30  sar * checked that the priv mechanism would work. * * Revision 3.19  1993/05/03  17:16:12  sar * Added routines for local time, removed {party context} oids from packet * structure, added asn1len to {party context} structures and * SNMP_{Party Context}_Name where needed to lookup the name for a given * {Party Context}. * * Revision 3.18  1993/04/30  22:54:08  sar * Added mechanism for minimial proxies and coarse grained locks.  The * latter required the addition of routines to get the name of a leaf given * a pointer to the leaf. * * Revision 3.17  1993/04/27  21:10:00  sar * Made clean_vb_list call clean_vb so there is only one piece of code to * maintain. * * Revision 3.16  1993/04/26  20:37:09  sar * Added ifdefs to allow clean makes of version 1 and 2, added bit strings, * arrange for deletion of acls with the party or context they refer to * is deleted. * * Revision 3.15  1993/04/22  20:06:36  sar * Much updating of macros and install options, mostly we now use * ISNTALL_ENVOY_SNMP_VERSION_1 or _2, VERSION_RFCXXXX is now SNMP_VERSION_2 * and other similiar items. * * Revision 3.14  1993/04/17  01:06:51  sar * added a packet argument to the auth violation macro, check for private * routines to free data on the vbs while cleaning them. * * Revision 3.13  1993/03/26  17:49:25  sar * added test for proxyness and call to SNMP_PROXY_HOOK to handle the packet * if we are doing proxy. * * Revision 3.12  1993/03/25  21:18:09  sar * Added routines to encode/decode 64 bit integers/counter64s * * Revision 3.11  1993/03/24  01:01:40  sar * changed the silly marketing macro to be something more reasonable. * * Revision 3.10  1993/03/20  00:25:43  sar * Changed class to be a UINT_16_T and removed the use of mib_view for * version two packets. * * Revision 3.9  1993/03/07  01:19:39  sar * In snmp version 2 we now get the rp->mib_view from the context view index. * This lets us simulate views.  It will change when the view table is * defined. * * Revision 3.8  1993/03/05  03:58:02  dab * fixed up types * * Revision 3.6  1993/03/03  03:17:00  sar * Updated to deal with shadow rows.  I have defined a new enumeration for * row status (RS_RSNE = 0) which means that row status doesn't exist yet. * Most routines now check to see if the row is active before using it. * Also added SNMP_SILLY_MARKETING_MACRO as per Rob's request. * * Revision 3.5  1993/02/24  01:02:41  sar * Changed many call to use OIDC_T/lenght pairs instead of OBJ_ID_T as now * we don't need to specifically allocate the OBJ_ID_T. * Removed the name objid from the PARTYLEAF_T as the name may be determined from * the tree itself.  For efficiency purposes put the dest/src party names into * the pkt so we don't have to look them up frequently. * * Revision 3.4  1993/02/22  18:53:36  sar * Moved acl structures to their own tree * Added context structrues with attendent routines * * Revision 3.3  1993/02/17  21:10:39  sar * Added no_pp stuff. * Updated stats to deal with v1 and v2 (or both or neither). * Added ifdef compile flags for v1 or v2 or both. * Added code and routines to handle v2 (SNMP_Decode_Secure_Packet * acl_check). * Updated decode_pkt_to_vb to use new data types VT_UINTEGER32, * VT_NOSUCHOBJ, VT_NOSUCHINS and VT_ENDOFMIB. * Added Clean_vb to clean up as we may have chained some vbs to the * packet (for get bulk). * Added VBlist_Allocate to allocate a new vb for get bulk purposes. * * Revision 3.2  92/07/31  12:57:17  dab * Fixed up some compile errors. *  * Revision 3.1  92/07/31  11:53:29  dab * Added decode path for Secure SNMP.  Not yet tested. *  * Revision 3.0  92/04/03  19:52:37  dab * Release 3.0 *  * Revision 2.107  92/02/05  18:46:32  dab * More casting to keep MSC happy.

⌨️ 快捷键说明

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