msg_in.c, msg_in.c: add snmp_get_community() and snmp_set_community() accessors

Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
Freddie Chopin 2014-02-03 13:05:17 +01:00 committed by sg
parent 2c9ceea3cf
commit 4ebeeaf1e0
2 changed files with 27 additions and 0 deletions

View File

@ -102,6 +102,30 @@ snmp_init(void)
snmp_coldstart_trap();
}
/**
* Returns current SNMP community string.
* @return current SNMP community string
*/
const char *
snmp_get_community(void)
{
return snmp_community;
}
/**
* Sets SNMP community string.
* The string itself (its storage) must be valid throughout the whole life of
* program (or until it is changed to sth else).
*
* @param community is a pointer to new community string
*/
void
snmp_set_community(const char * const community)
{
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_COMMUNITY_STR_LEN);
snmp_community = community;
}
static void
snmp_error_response(struct snmp_msg_pstat *msg_ps, u8_t error)
{

View File

@ -97,6 +97,9 @@ struct snmp_obj_id
s32_t id[LWIP_SNMP_OBJ_ID_LEN];
};
const char * snmp_get_community(void);
void snmp_set_community(const char *community);
/* system */
void snmp_set_sysdescr(const u8_t* str, const u8_t* len);
void snmp_set_sysobjid(const struct snmp_obj_id *oid);