www.pudn.com > SNMP·¶ÀýÔ´´úÂë.zip > authen.h



#ifndef _AUTHEN_H_
#define _AUTHEN_H_

/* new auth/trap stuff for TMS */

/* change the following if Oem/Snmp MIB change */
#define AUTH_MAX_HOSTS          1     /* max hosts allowed for snmp authentication       */
#define AUTH_MAX_COMMS          2     /* max communities allowed for snmp authentication */
#define TRAP_MAX_HOSTS          1     /* max hosts allowed in trap table                 */
#define TRAP_MAX_COMMS          1     /* max communities recognized by trap table        */

#define COMM_NAME_SIZE          10   
#define HOST_NAME_SIZE          10

#define AGENT_VAL_ENABLE        1
#define AGENT_VAL_DISABLE       2
#define AGENT_VAL_DELETE        3
#define AGENT_VAL_INVALID       4

/* use these defines for turning on/off snmp security */
#define AGENT_AUTH_ENABLE       AGENT_VAL_ENABLE  /* enable snmp authentication                      */
#define AGENT_AUTH_DISABLE      AGENT_VAL_DISABLE /* disable snmp authentication (means no security) */

#define AGENT_READ_ONLY         1
#define AGENT_READ_WRITE        2

/* Type defines to be used by idbSnmp() module when it needs to access a host/community/trap item */

/* Traps that can be turned on/off in the trap table for different communities */
#define AGENT_COLD_START        1
#define AGENT_LINK_DOWN         2
#define AGENT_LINK_UP           4
#define AGENT_AUTHEN            8
#define AGENT_BRIDGE            16
#define AGENT_RMON              32
#define AGENT_OEM_SPEC          64

/* Communities */
#define AGENT_COMM_NAME         200
#define AGENT_COMM_PERM         201
#define AGENT_COMM_STATE        202

/* Hosts */
#define AGENT_HOST_NAME         203
#define AGENT_HOST_COMM_NAME    204
#define AGENT_HOST_IP_ADDR      205
#define AGENT_HOST_IP_MASK      206
#define AGENT_HOST_STATE        207


/* New structures for SNMP authentication and Traps */
struct snmpComm_t {
    u32             index;
	u8				name[COMM_NAME_SIZE+1];
	u32				access;	        /* 1=read-only, 2=read-write                   */
	u32				traps;			/* 1=coldstart, 2=linkdown, 4=linkup, 8=auth, 
                                       16=Bridge, 32=RMON, 64=ent-spec             */
    u32             state;          /* 1=enable, 2=disable                         */
};

struct snmpHost_t {
    u32             index;
	u8				name[HOST_NAME_SIZE+1];
	u8				commName[COMM_NAME_SIZE+1];
	//ul32			addr;
	unsigned long	addr;
	ul32            mask;
    u32             state;
};

/* function prototypes to be used by idbSnmp() module */

/* NOTE:  idbSnmp() must use the above defines starting with AGENT_ to get/set items */
/*        The meanings of the defines should be obvious hopefully */

STATUS setAuthEnable(u32 val);      /* enable/disable snmp authentication */
STATUS getAuthEnable(u32* val);     /* get snmp authentication status     */



#endif