📄 rrsnmp.h
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2001/12/21 11:15:29 $* $Source: M:/psisrc/routing/incl/rcs/rrsnmp.h $* $Revision: 1.9 $************************************************************************** File Description:common snmp definitions for routing *************************************************************************/#ifndef _rrsnmp_h#define _rrsnmp_h#define IR_SNMP_PREFIX 1#define O_SNMP_PREFIX 1#define MAX_DESC_STR 32#define MAX_RROID_LEN 64 /* max len oid after prefix */#define MAX_BASE_RROID_LEN 16 /* without instance ID or prefix*/#define MAX_STRINGS 512/* object type definitions */#define T_BYTE 0xff#define T_BOOLEAN 0xfe#define T_WORD 0xfd#define T_LONG 0xfc#define T_METRIC 0xfb#define T_INTEGER 2#define T_OCTSTR 4#define T_OID 6#define T_IPADDRESS 0x40#define T_COUNTER 0x41#define T_GAUGE 0x42#define T_TICS 0x43#define T_OSINADDR 0x80#define T_LANADDR 0x81#define T_SNPAADDR 0x82#define T_OSIAREA 0x83#define T_STRIDLEN 0x84 /* octet string, IDLEN */#define T_STRIDLEN1 0x85 /* octet string, IDLEN +1 */#define T_STROID 0x86 /* object ID octet string */#define T_PREFIXAREA 0x87#define T_IPXSERVTYPEVALUE 0x88#define T_IPXSERVNAME 0X89#define T_NICADDR 0x8a#define T_IPXNETNUM 0x8b /* octet sting, 4 bytes ipx networ*/#define T_SIPXNETNUM 0x8c /* swapped octet string */#define T_SYSID 0X8d /* octet string, IDLEN +2 */#define T_NLSPID 0X8e /* SYSID + 1 *//* access definitions */#define A_GET 1#define A_SET 2/* flag definitions */#define F_INST 1 /* class has multiple instances */#define F_CREATE 2 /* no modify after create */#define F_CUST 4 /* no custom processing */#define F_SETPROC 8 /* special set processing */#define F_PS 0x10 /* protocol specific */#define F_CONST 0x20 /* constant int value *//* macro to determine structure member offset *//* 'x' is declared in ir_mib.c to be ptr to void with value 0.*/#define MOFF(type, mem) ((void *)( &((type)0)->mem) )/* object id is stored in len/ array atruct */typedef struct rrobject_id{ unsigned short o_len; unsigned short o_id[MAX_RROID_LEN];}RROID;typedef struct object_id_base{ unsigned short o_len; unsigned short o_id[MAX_BASE_RROID_LEN];}RROID_BASE;/* a type/len/value tuple */typedef struct type_len_value{ unsigned char t_type; unsigned char t_len; unsigned char *t_val;}TLV; /* a counted byte string */typedef struct cnt_byte_str{ unsigned char c_len; unsigned char c_dat[255];}CBS, *cbs_pt; typedef void *(*snmpfndr)(void);/* one per object class */typedef struct ir_mib{ unsigned short m_acc; /* access */ unsigned short m_type; /* object type */ unsigned long m_min; /* min legal */ unsigned long m_max; /* max legal */ unsigned short m_miscflags; /* misc flags */ void *(*m_fndobj)(void); /* obj finder */ void *m_offset; /* obj ptr or offset */ RROID_BASE m_oid; /* oid string */}IRMIB,IPXMIB,OMIB;#define SnmpOff 1#define SnmpOn 2#define SnmpValid 1#define SnmpInvalid 2#define SnmpTrue 1#define SnmpFalse 2#define SnmpEnabled 1#define SnmpDisabled 2/* an snmp command block used to pass a command to the engine */typedef struct snmp_cmd_blk{ struct snmp_cmd_blk *sc_fwd; int sc_type; /* get/set/getnxt */ int sc_res; /* result */ RROID sc_oid; /* ob id */ TLV sc_tlv; /* tlv struct */}SNMP_CB;#define GetReq 1#define GetNextReq 2#define GetResp 3#define SetReq 4#define SetTest 5#define noError 0#define tooBig 1#define noSuchName 2#define badValue 3#define readOnly 4#define genErr 5#define endChain 10/* traps use an array of snmp_cb */#define RR_MAX_TRAP_OBJS 10typedef struct{ SNMP_CB c[RR_MAX_TRAP_OBJS];}RRTRAP;/* for building tree of object classes *//* note that t_kids index is value of kid oid */#define MAX_KIDS 32typedef struct rrmib_tree{ int t_parent; /* index in array of parent */ int t_val; /* value of this sub-oid */ int t_kids[MAX_KIDS]; /* index of children */}RRMIB_TREE;/* indices defining which MIB we are talking about */#define IRMIB_OSI 0#define IRMIB_DECNET 1#define IRMIB_IP 2 /* mib2 */#define IRMIB_IPEXT 3 /* private extensions */#define IRMIB_ATALK 4#define IPXMIB_IPX 5 /* main mib, default */#define IPXMIB_RS 6 /* RipSap mib */#define IRMIB_IPV6 7 /* ip version six */#define IRMIB_BRIDGE 8 /* bridge (rfc 1493) */#define IRMIB_OSPF 9 #define IRMIB_IPEXP 10 /* Experimental */#define IRMIB_BGP 11/* row-status syntax definitions */#define snmpRSActive 1#define snmpRSNotInService 2#define snmpRSNotReady 3#define snmpRSCreateAndGo 4#define snmpRSCreateAndWait 5#define snmpRSDestroy 6#define MIB 1, 3, 6, 1, 2, 1#define ENTERPRISE 1,3,6,1,4,1#define PHASE2_ENTERPRISE ENTERPRISE,1752typedef void (*rrcmd_dispp)(int,SNMP_CB *);long rrSnmpDecode(TLV *);void rrSnmpStr(SNMP_CB *, unsigned char *,int);void rrSnmpOID(SNMP_CB *, unsigned short *,int);void rrSnmpInt(SNMP_CB *,int, int*,int);int rrSnmpValid(SNMP_CB *, IRMIB *);void rrSnmpCmdErr(SNMP_CB *,int);void rrSnmpTrap(RRTRAP *);void rrDoSnmp(SNMP_CB *,int,IRMIB *,rrcmd_dispp);#define RRSNMP_MAX_STR 1500typedef struct rrSnmpBlock{ int snmpOn; int snmpOff; unsigned char snmpRes_byte; unsigned short snmpRes_word; unsigned long snmpRes_dword; unsigned char snmpRes_str[RRSNMP_MAX_STR]; unsigned short StatOid[MAX_RROID_LEN];}rrSnmpBlk;extern rrSnmpBlk rrSnmpGlob;#define SNMP_ON rrSnmpGlob.snmpOn#define SNMP_OFF rrSnmpGlob.snmpOff#define snmp_res_byte rrSnmpGlob.snmpRes_byte#define snmp_res_word rrSnmpGlob.snmpRes_word#define snmp_res_dword rrSnmpGlob.snmpRes_dword#define snmp_res_str rrSnmpGlob.snmpRes_str#define rrSnmpStatOID rrSnmpGlob.StatOid#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -