Options
Applications » SNMPv2c/v3 agent

## Macros

#define | LWIP_SNMP 0
#define | SNMP_USE_NETCONN 0
#define | SNMP_USE_RAW 1
#define | SNMP_STACK_SIZE DEFAULT_THREAD_STACKSIZE
#define | SNMP_THREAD_PRIO DEFAULT_THREAD_PRIO
#define | SNMP_TRAP_DESTINATIONS 1
#define | SNMP_SAFE_REQUESTS 1
#define | SNMP_MAX_OCTET_STRING_LEN 127
#define | SNMP_MAX_OBJ_ID_LEN 50
#define | SNMP_MIN_VALUE_SIZE (2 * sizeof(u32_t*)) /* size required to store the basic types (8 bytes for counter64) */
#define | SNMP_MAX_VALUE_SIZE LWIP_MAX(LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN), sizeof(u32_t)*(SNMP_MAX_OBJ_ID_LEN)), SNMP_MIN_VALUE_SIZE)
#define | SNMP_COMMUNITY "public"
#define | SNMP_COMMUNITY_WRITE "private"
#define | SNMP_COMMUNITY_TRAP "public"
#define | SNMP_MAX_COMMUNITY_STR_LEN LWIP_MAX(LWIP_MAX(sizeof(SNMP_COMMUNITY), sizeof(SNMP_COMMUNITY_WRITE)), sizeof(SNMP_COMMUNITY_TRAP))
#define | SNMP_LWIP_ENTERPRISE_OID 26381
#define | SNMP_DEVICE_ENTERPRISE_OID {1, 3, 6, 1, 4, 1, SNMP_LWIP_ENTERPRISE_OID}
#define | SNMP_DEVICE_ENTERPRISE_OID_LEN 7
#define | SNMP_DEBUG LWIP_DBG_OFF
#define | SNMP_MIB_DEBUG LWIP_DBG_OFF
#define | SNMP_LWIP_MIB2 LWIP_SNMP
#define | SNMP_LWIP_MIB2_SYSDESC "lwIP"
#define | SNMP_LWIP_MIB2_SYSNAME "FQDN-unk"
#define | SNMP_LWIP_MIB2_SYSCONTACT ""
#define | SNMP_LWIP_MIB2_SYSLOCATION ""
#define | SNMP_LWIP_GETBULK_MAX_REPETITIONS 0

## Detailed Description

## Macro Definition Documentation

## LWIP_SNMP

#define LWIP_SNMP 0

LWIP_SNMP==1: This enables the lwIP SNMP agent. UDP must be available for SNMP transport. If you want to use your own SNMP agent, leave this disabled. To integrate MIB2 of an external agent, you need to enable LWIP_MIB2_CALLBACKS and MIB2_STATS. This will give you the callbacks and statistics counters you need to get MIB2 working.

## SNMP_COMMUNITY

#define SNMP_COMMUNITY "public"

The snmp read-access community. Used for write-access and traps, too unless SNMP_COMMUNITY_WRITE or SNMP_COMMUNITY_TRAP are enabled, respectively.

## SNMP_COMMUNITY_TRAP

#define SNMP_COMMUNITY_TRAP "public"

The snmp community used for sending traps.

## SNMP_COMMUNITY_WRITE

#define SNMP_COMMUNITY_WRITE "private"

The snmp write-access community. Set this community to "" in order to disallow any write access.

## SNMP_DEBUG

#define SNMP_DEBUG LWIP_DBG_OFF

SNMP_DEBUG: Enable debugging for SNMP messages.

## SNMP_DEVICE_ENTERPRISE_OID

#define SNMP_DEVICE_ENTERPRISE_OID {1, 3, 6, 1, 4, 1, SNMP_LWIP_ENTERPRISE_OID}

IANA assigned enterprise ID for lwIP is 26381

See also
  http://www.iana.org/assignments/enterprise-numbers

Note
  this enterprise ID is assigned to the lwIP project, all object identifiers living under this ID are assigned by the lwIP maintainers!
  don't change this define, use snmp_set_device_enterprise_oid()

If you need to create your own private MIB you'll need to apply for your own enterprise ID with IANA: http://www.iana.org/numbers.html

## SNMP_DEVICE_ENTERPRISE_OID_LEN

#define SNMP_DEVICE_ENTERPRISE_OID_LEN 7

Length of SNMP_DEVICE_ENTERPRISE_OID

## SNMP_LWIP_ENTERPRISE_OID

#define SNMP_LWIP_ENTERPRISE_OID 26381

The OID identifiying the device. This may be the enterprise OID itself or any OID located below it in tree.

## SNMP_LWIP_GETBULK_MAX_REPETITIONS

#define SNMP_LWIP_GETBULK_MAX_REPETITIONS 0

This value is used to limit the repetitions processed in GetBulk requests (value == 0 means no limitation). This may be useful to limit the load for a single request. According to SNMP RFC 1905 it is allowed to not return all requested variables from a GetBulk request if system load would be too high. so the effect is that the client will do more requests to gather all data. For the stack this could be useful in case that SNMP processing is done in TCP/IP thread. In this situation a request with many repetitions could block the thread for a longer time. Setting limit here will keep the stack more responsive.

## SNMP_LWIP_MIB2

#define SNMP_LWIP_MIB2 LWIP_SNMP

Indicates if the MIB2 implementation of LWIP SNMP stack is used.

## SNMP_LWIP_MIB2_SYSCONTACT

#define SNMP_LWIP_MIB2_SYSCONTACT ""

Value return for sysContact field of MIB2. To make sysContact field settable, call snmp_mib2_set_syscontact() to provide the necessary buffers.

## SNMP_LWIP_MIB2_SYSDESC

#define SNMP_LWIP_MIB2_SYSDESC "lwIP"

Value return for sysDesc field of MIB2.

## SNMP_LWIP_MIB2_SYSLOCATION

#define SNMP_LWIP_MIB2_SYSLOCATION ""

Value return for sysLocation field of MIB2. To make sysLocation field settable, call snmp_mib2_set_syslocation() to provide the necessary buffers.

## SNMP_LWIP_MIB2_SYSNAME

#define SNMP_LWIP_MIB2_SYSNAME "FQDN-unk"

Value return for sysName field of MIB2. To make sysName field settable, call snmp_mib2_set_sysname() to provide the necessary buffers.

## SNMP_MAX_COMMUNITY_STR_LEN

#define SNMP_MAX_COMMUNITY_STR_LEN LWIP_MAX(LWIP_MAX(sizeof(SNMP_COMMUNITY), sizeof(SNMP_COMMUNITY_WRITE)), sizeof(SNMP_COMMUNITY_TRAP))

The maximum length of community string. If community names shall be adjusted at runtime via snmp_set_community() calls, enter here the possible maximum length (+1 for terminating null character).

## SNMP_MAX_OBJ_ID_LEN

#define SNMP_MAX_OBJ_ID_LEN 50

The maximum number of Sub ID's inside an object identifier. Indirectly this also limits the maximum depth of SNMP tree.

## SNMP_MAX_OCTET_STRING_LEN

#define SNMP_MAX_OCTET_STRING_LEN 127

The maximum length of strings used.

## SNMP_MAX_VALUE_SIZE

#define SNMP_MAX_VALUE_SIZE LWIP_MAX(LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN), sizeof(u32_t)*(SNMP_MAX_OBJ_ID_LEN)), SNMP_MIN_VALUE_SIZE)

The maximum size of a value.

## SNMP_MIB_DEBUG

#define SNMP_MIB_DEBUG LWIP_DBG_OFF

SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs.

## SNMP_MIN_VALUE_SIZE

#define SNMP_MIN_VALUE_SIZE (2 * sizeof(u32_t*)) /* size required to store the basic types (8 bytes for counter64) */

The minimum size of a value.

## SNMP_SAFE_REQUESTS

#define SNMP_SAFE_REQUESTS 1

Only allow SNMP write actions that are 'safe' (e.g. disabling netifs is not a safe action and disabled when SNMP_SAFE_REQUESTS = 1). Unsafe requests are disabled by default!

## SNMP_STACK_SIZE

#define SNMP_STACK_SIZE DEFAULT_THREAD_STACKSIZE

SNMP_STACK_SIZE: Stack size of SNMP netconn worker thread

## SNMP_THREAD_PRIO

#define SNMP_THREAD_PRIO DEFAULT_THREAD_PRIO

SNMP_THREAD_PRIO: SNMP netconn worker thread priority

## SNMP_TRAP_DESTINATIONS

#define SNMP_TRAP_DESTINATIONS 1

SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap destination is required

## SNMP_USE_NETCONN

#define SNMP_USE_NETCONN 0

SNMP_USE_NETCONN: Use netconn API instead of raw API. Makes SNMP agent run in a worker thread, so blocking operations can be done in MIB calls.

## SNMP_USE_RAW

#define SNMP_USE_RAW 1

SNMP_USE_RAW: Use raw API. SNMP agent does not run in a worker thread, so blocking operations should not be done in MIB calls.