Core
Applications » SNMPv2c/v3 agent

## Functions

void | snmp_set_mibs (const struct snmp_mib **mibs, u8_t num_mibs)
void | snmp_set_device_enterprise_oid (const struct snmp_obj_id *device_enterprise_oid)
const struct snmp_obj_id * | snmp_get_device_enterprise_oid (void)
const char * | snmp_get_community (void)
void | snmp_set_community (const char *const community)
const char * | snmp_get_community_write (void)
void | snmp_set_community_write (const char *const community)
void | snmp_set_write_callback (snmp_write_callback_fct write_callback, void *callback_arg)
void | snmp_set_inform_callback (snmp_inform_callback_fct inform_callback, void *callback_arg)
void | snmp_init (void)

## Detailed Description

## Function Documentation

## snmp_get_community()

const char* snmp_get_community | ( | void |  | ) |

Returns current SNMP community string.

Returns
  current SNMP community string

## snmp_get_community_write()

const char* snmp_get_community_write | ( | void |  | ) |

Returns current SNMP write-access community string.

Returns
  current SNMP write-access community string

## snmp_get_device_enterprise_oid()

const struct snmp_obj_id* snmp_get_device_enterprise_oid | ( | void |  | ) |

Get 'device enterprise oid'

## snmp_init()

void snmp_init | ( | void |  | ) |

Starts SNMP Agent. Allocates UDP pcb and binds it to IP_ANY_TYPE port 161.

Agent setup, start listening to port 161.

## snmp_set_community()

void snmp_set_community | ( | const char *const | 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).

Parameters

  community | is a pointer to new community string

## snmp_set_community_write()

void snmp_set_community_write | ( | const char *const | community | ) |

Sets SNMP community string for write-access. The string itself (its storage) must be valid throughout the whole life of program (or until it is changed to sth else).

Parameters

  community | is a pointer to new write-access community string

## snmp_set_device_enterprise_oid()

void snmp_set_device_enterprise_oid | ( | const struct snmp_obj_id * | device_enterprise_oid | ) |

'device enterprise oid' is used for 'device OID' field in trap PDU's (for identification of generating device) as well as for value returned by MIB-2 'sysObjectID' field (if internal MIB2 implementation is used). The 'device enterprise oid' shall point to an OID located under 'private-enterprises' branch (1.3.6.1.4.1.XXX). If a vendor wants to provide a custom object there, he has to get its own enterprise oid from IANA (http://www.iana.org). It is not allowed to use LWIP enterprise ID! In order to identify a specific device it is recommended to create a dedicated OID for each device type under its own enterprise oid. e.g. device a > 1.3.6.1.4.1.XXX(ent-oid).1(devices).1(device a) device b > 1.3.6.1.4.1.XXX(ent-oid).1(devices).2(device b) for more details see description of 'sysObjectID' field in RFC1213-MIB

## snmp_set_inform_callback()

void snmp_set_inform_callback | ( | snmp_inform_callback_fct | inform_callback,
|  | void * | callback_arg
| ) |  |

Callback fired on every received INFORM confirmation (get-response)

## snmp_set_mibs()

void snmp_set_mibs | ( | const struct snmp_mib ** | mibs,
|  | u8_t | num_mibs
| ) |  |

Sets the MIBs to use. Example: call snmp_set_mibs() as follows: static const struct snmp_mib *my_snmp_mibs[] = { &mib2, &private_mib }; snmp_set_mibs(my_snmp_mibs, LWIP_ARRAYSIZE(my_snmp_mibs));

## snmp_set_write_callback()

void snmp_set_write_callback | ( | snmp_write_callback_fct | write_callback,
|  | void * | callback_arg
| ) |  |

Callback fired on every successful write access