📄 snmpdefs.h
字号:
* * Revision 2.103 91/10/30 20:45:46 dab * Used to be snmp.h. Now the config file is snmp.h and all the * SNMP definitions are here. * * Revision 2.102 91/09/12 13:50:51 dab * Re-ordered so SNMP_STATS_T is defined after snmpconf.h is included * so it gets the proper definition for SGRP. * * Revision 2.101 91/08/15 15:41:46 dab * Pulled configuration from asn1.h and snmp.h and put in * snmpconf.h and asn1conf.h. * * Revision 2.100 91/08/09 14:09:48 dab * Update version. * * Revision 1.1 91/07/30 02:24:31 romkey * Initial revision * * * Rev 2.3 17 Jun 1990 10:39:42 * Corrected erroneous definition of inc_gauge and dec_gauge macros. * * Rev 2.2 06 Jun 1990 5:32:40 * Added definition of RFC1157. * * Rev 2.1 24 May 1990 16:40:52 * Changed the authentication enable flag in snmp_stats from a long to a short. * * Rev 2.0 31 Mar 1990 15:11:24 * Release 2.00 * * Rev 1.9 24 Apr 1989 18:42:00 * Added definition of VERSION_RFC1098 as a synonym for VERSION_RFC1067. * * Rev 1.8 24 Mar 1989 17:25:30 * Removed reference to the variable named "etc_copyright". The in-core * copyright notice now comes in via module "snmp_d.c". * * Rev 1.7 17 Mar 1989 21:42:02 * Calls to memcpy/memset protected against zero lengths * * Rev 1.6 11 Jan 1989 13:23:32 * Added a reference to the copyright string to force it into memory. * * Rev 1.5 11 Jan 1989 12:46:44 * Moved Clean_Obj_ID() to objectid.c * * Rev 1.4 19 Sep 1988 17:27:12 * Made changes to make the Sun C compiler happy. * * Rev 1.3 17 Sep 1988 14:40:56 * Corrected the SNMP version number -- the format in RFC1067 is poorly * done!!!!!!! * * Rev 1.2 15 Sep 1988 20:04:22 * Added macro to convert VBL offset into an error index. * * Rev 1.1 14 Sep 1988 19:23:30 * Added definitions for the UDP port numbers assigned to SNMP. * * Rev 1.0 12 Sep 1988 10:46:22 * Initial revision.*//* [clearcase]modification history-------------------01b,19apr05,job update copyright notices01a,02jul04,job add getproc_got_octet_string() function*/#if (!defined(snmpdefs_inc))#define snmpdefs_inc#ifdef __cplusplusextern"C" {#endif#if (!defined(asn1_inc))#include <wrn/wm/snmp/engine/asn1.h>#endif#if (!defined(buffer_inc))#include <wrn/wm/snmp/engine/buffer.h>#endif#if (!defined(mib_inc))#include <wrn/wm/snmp/engine/mib.h>#endif#if (!defined(ui64_inc))#include <wrn/wm/snmp/engine/ui64.h>#endif#if (!defined(vb_inc))#include <wrn/wm/snmp/engine/vbdefs.h>#endif#if INSTALL_ENVOY_SNMP_VERSION_3#if (!defined(v3_auth_inc))#include <wrn/wm/snmp/engine/v3_auth.h>#endif#if (!defined(v3_priv_inc))#include <wrn/wm/snmp/engine/v3_priv.h>#endif#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */#define SNMP_VERSION_MIN 0 /* Lower bound for SNMP version */#define VERSION_RFC1067 0 /* Classic SNMP *//* RFC1067, RFC1098, and RFC1157 are equivalent */#define VERSION_RFC1098 0#define VERSION_RFC1157 0#define SNMP_VERSION_1 0 /* now being tagged as version 1 */#define SNMP_VERSION_2 1 /* SNMPV2 */#define SNMP_VERSION_USEC 2 /* User Security option */#define SNMP_VERSION_3 3 /* SNMPv3 */#define SNMP_VERSION_MAX 0x7fffffff /* Upper bound for SNMP version *//* Define the ports assigned to SNMP for the reception of various types *//* of packets. */#define SNMP_REQUEST_PORT 161#define SNMP_TRAP_PORT 162#ifdef WINDNET_STRUCT_ALIGN#pragma align 1#endif/* The following represents a source or destination address in a generalized form (which happens to be isomorphic to the familiar sockaddr structure found with the socket interface.) It is the default Envoy will use for an address structure, however it may be overridden by defining ENVOY_SNMPADDR_T. */struct SNMPADDR_S { unsigned short snmp_family; unsigned char snmp_data[20]; bits16_t snmp_port; bits32_t snmp_scope_id; };#ifdef ENVOY_SNMPADDR_Ttypedef ENVOY_SNMPADDR_T SNMPADDR_T;#elsetypedef struct SNMPADDR_S SNMPADDR_T;#endif/* We need to replace the community validation routine macro in such a way that it can still be redefined if desired, yet it doesn't interfere with people not using coexistence. */#if (INSTALL_ENVOY_SNMP_VERSION_3) && (INSTALL_ENVOY_SNMP_COEXISTENCE)#ifndef SNMP_community_coexistence_lookupextern int lookup_SNMP_community __((struct SNMP_PKT_S *, SNMPADDR_T *, SNMPADDR_T *));#define SNMP_community_coexistence_lookup(p, s, d) \lookup_SNMP_community(p, s, d)#endif #else #define SNMP_community_coexistence_lookup(p, s, d) \SNMP_validate_community(p, s, d)#endif/* Typedefs for io and error completion routines */typedef void IO_COMPLETE_T __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, ptr_t pktp, ALENGTH_T need, ptr_t cookie));typedef void ERR_COMPLETE_T __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, int error_code, ptr_t cookie));typedef void RETRANS_CLEANUP_T __((ptr_t cookie));/* The proxy routine really takes an argument of SNMP_PKT_T * but we can't use it as we haven't defined it */typedef sbits32_t PROXY_ROUTINE_T __(( ));typedef void AUTH_ROUTINE_T __((OCTET_T *, UINT_16_T, OCTET_T *, UINT_16_T, OCTET_T *));/* Define the internal representation of an SNMP packet */typedef struct SNMP_PKT_S { sbits32_t snmp_version; bits16_t lcl_ident; /* Local transaction identifer */ char * user_private; /* Anything one wants -- but */ /* remember, if you attach */ /* something here, you got to */ /* free it in release_private!! */ ptr_t async_cookie; /* cookie for use with completions */ IO_COMPLETE_T *io_complete; /* Routines to call when processing */ ERR_COMPLETE_T *error_complete; /* is complete */ void (*cont)(struct SNMP_PKT_S *); /* routine to call continue proc */ SNMPADDR_T pkt_src; /* Where this packet came from. */ SNMPADDR_T pkt_dst; /* Where this packet came to. */ MIBNODE_T *mib_root; bits32_t mib_view; /* Set of mib views which this */ /* request can see. Use 0xFFFFFFFF */ /* to participate in all views. */#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) bits16_t view_index; /* view index for use with rfc1445 */#endif#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) EBUFFER_T view_name; /* view name for use with rfc2275 */#endif#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) struct VIEWINDEX_S *view_family; /* pointer to view family to use */ #endif EBUFFER_T community; /* used for the community string or context name for v3 */ bits8_t flags; /* See below. */ bits8_t phase; /* what phase we are running, should be the same size as vb_flags */ ALENGTH_T maxpkt; /* the maximum packet we can build */ ALENGTH_T buffer_needed; /* Size of buffer needed */ ALENGTH_T overall_length; /* Message Sequence length */ ATVALUE_T pdu_type; ALENGTH_T pdu_length; union { /* For GetRequest, GetNextRequest, */ /* GetResponse, SetRequest, */ /* GetBulkRequest, InformRequest, */ /* and Trap2 PDUs. */ struct { sbits32_t request_id; sbits32_t error_status; sbits32_t error_index; VBL_T std_vbl; VBL_T saved_vbl; sbits32_t max_reps; int non_reps; } std_pdu;#if INSTALL_ENVOY_SNMP_VERSION_1 /* For Trap PDU */ struct { OBJ_ID_T enterprise_objid; unsigned char net_address[4]; sbits32_t generic_trap; sbits32_t specific_trap; bits32_t trap_time_ticks; VBL_T trap_vbl; } trap_pdu;#endif } pdu; bits8_t lockflags; bits8_t gate_decr;#if INSTALL_ENVOY_SNMP_VERSION_3 sbits32_t msg_id; sbits32_t msg_max_size; bits8_t msg_flags; sbits32_t msg_sec_model; EBUFFER_T msg_con_id; EBUFFER_T msg_sec_id; EBUFFER_T msg_sec_name; sbits32_t msg_sec_boots; sbits32_t msg_sec_time; bits8_t msg_sec_auth[20]; bits8_t msg_sec_priv[20]; ALENGTH_T scoped_pdu_length; ALENGTH_T encrypted_pdu_length; ALENGTH_T security_length; ALENGTH_T security_length_2; ALENGTH_T global_length; SNMP_AUTH_T *auth; SNMP_PRIV_T *priv;#endif#if INSTALL_ENVOY_SNMP_COEXISTENCE EBUFFER_T comm_entry;#endif#if INSTALL_ENVOY_SNMP_LOCK ENVOY_LOCK_T *coarse_lock;#endif#if INSTALL_ENVOY_AGENTX struct ENVOY_AX_PKT_S *ax_pkt; bits32_t ax_trans_id;#endif#if INSTALL_ENVOY_CONTINUE_REENTRANT ENVOY_LOCK_T continue_lock;#endif#if INSTALL_ENVOY_USE_SNMP_PROXY PROXY_ROUTINE_T *proxy_routine;#endif } SNMP_PKT_T;#ifdef WINDNET_STRUCT_ALIGN#pragma align 0#endif/* Values for pdu_type (class and form bits are not included) */#define GET_REQUEST_PDU 0#define GET_NEXT_REQUEST_PDU 1#define GET_RESPONSE_PDU 2#define SET_REQUEST_PDU 3#define TRAP_PDU 4#define GET_BULK_REQUEST_PDU 5#define INFORM_REQUEST_PDU 6#define TRAP2_PDU 7#define REPORT_PDU 8#define MAX_V1_PDU 4#define MAX_PDU 8#define NO_PDU 0xFF/* values for pdu classes in mgt communication class, this is equal to 2 to the value of the context tag for the pdu */#define GET_REQUEST_CLASS 1#define GET_NEXT_REQUEST_CLASS 2#define GET_RESPONSE_CLASS 4#define SET_REQUEST_CLASS 8#define TRAP_CLASS 16#define GET_BULK_REQUEST_CLASS 32#define INFORM_REQUEST_CLASS 64#define TRAP2_CLASS 128#define REPORT_CLASS 256#define ALL_CLASS 511/* Values for error_status */#define NO_ERROR 0#define TOO_BIG 1#define NO_SUCH_NAME 2#define BAD_VALUE 3#define READ_ONLY 4#define GEN_ERR 5#define NO_ACCESS 6#define WRONG_TYPE 7#define WRONG_LENGTH 8#define WRONG_ENCODING 9#define WRONG_VALUE 10#define NO_CREATION 11#define INCONSISTENT_VALUE 12#define RESOURCE_UNAVAILABLE 13#define COMMIT_FAILED 14#define UNDO_FAILED 15#define AUTHORIZATION_ERROR 16#define NOT_WRITABLE 17#define INCONSISTENT_NAME 18#define LAST_ERROR 19/* Values for generic_trap */#define COLD_START 0#define WARM_START 1#define LINK_DOWN 2#define LINK_UP 3#define AUTH_FAILURE 4#define EGP_NEIGHBOR_LOSS 5#define ENTERPRISE_SPECIFIC 6/* For lock flags in the packet structre */#define LOCK_NOLOCK 0x00#define LOCK_READ 0x01#define LOCK_WRITE 0x02/* Value for message flags in version 3 */#define ETC_V3_AUTH 0x01#define ETC_V3_PRIV 0x02#define ETC_V3_REPORT 0x04#define ETC_SEC_LEVEL_NONE 0x01#define ETC_SEC_LEVEL_AUTH 0x02#define ETC_SEC_LEVEL_PRIV 0x03/* values for security models */#define ETC_SEC_MODEL_ANY 0x00#define ETC_SEC_MODEL_V1 0x01#define ETC_SEC_MODEL_V2 0x02#define ETC_SEC_MODEL_USM 0x03#define ETC_SEC_MODEL_MAX 0x7fffffff/* values for msgid */#define ETC_MSGID_MIN 0x00#define ETC_MSGID_MAX 0x7fffffff /* values for mms */#define ETC_MMS_MIN 0x01e4#define ETC_MMS_MAX 0x7fffffff /* macros for getting values out of SNMP_PKT_T structure */#define SNMP_pkt_get_SNMP_version(PKTP) ((PKTP)->snmp_version)#define SNMP_pkt_get_SNMP_community(PKTP) (&(PKTP)->community)/* macro to translate a vbp into an index, this is included for backwards compatibility, the preferred method is to call vbp_to_index directly */#define VB_TO_INDEX(pkt, vbp) vbp_to_index(pkt, vbp)/* Macro to translate a vbp into an index, this is the preferred method for customers to do this. Internally Envoy should use the vbp_to_index_error() routine directly. */#define vbp_to_index(pkt, vbp) vbp_to_index_error(pkt, vbp, 0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -