added support for write-access community and dedicated community for sending traps

This commit is contained in:
sg
2015-02-14 15:44:32 +01:00
parent e22c815444
commit 0d18516af8
6 changed files with 132 additions and 11 deletions

View File

@@ -872,6 +872,37 @@
#define SNMP_MAX_VALUE_SIZE LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN)+1, sizeof(s32_t)*(SNMP_MAX_TREE_DEPTH))
#endif
/**
* The snmp read-access community. Used for write-access and traps, too
* unless SNMP_COMMUNITY_WRITE or SNMP_COMMUNITY_TRAP are enabled, respectively.
*/
#ifndef SNMP_COMMUNITY
#define SNMP_COMMUNITY "public"
#endif
/**
* Set this to 1 to enable support for dedicated write-access and trap communities.
*/
#ifndef SNMP_COMMUNITY_EXT
#define SNMP_COMMUNITY_EXT
#endif
#if SNMP_COMMUNITY_EXT
/**
* The snmp write-access community.
*/
#ifndef SNMP_COMMUNITY_WRITE
#define SNMP_COMMUNITY_WRITE "private"
#endif
/**
* The snmp community used for sending traps.
*/
#ifndef SNMP_COMMUNITY_TRAP
#define SNMP_COMMUNITY_TRAP "public"
#endif
#endif /* SNMP_COMMUNITY_EXT */
/*
----------------------------------
---------- IGMP options ----------

View File

@@ -99,6 +99,12 @@ struct snmp_obj_id
const char * snmp_get_community(void);
void snmp_set_community(const char * const community);
#if SNMP_COMMUNITY_EXT
const char * snmp_get_community_write(void);
const char * snmp_get_community_trap(void);
void snmp_set_community_write(const char * const community);
void snmp_set_community_trap(const char * const community);
#endif /* SNMP_COMMUNITY_EXT
/* system */
void snmp_set_sysdescr(const u8_t* str, const u8_t* len);

View File

@@ -284,6 +284,12 @@ struct snmp_msg_trap
extern const s32_t snmp_version;
/** Agent community string */
extern const char *snmp_community;
#if SNMP_COMMUNITY_EXT
/** Agent community string for write access */
extern const char *snmp_community_write;
/** Agent community string for sending traps */
extern const char *snmp_community_trap;
#endif /* SNMP_COMMUNITY_EXT */
extern struct snmp_msg_trap trap_msg;