Introduction
Definitions
SNMP_DEFAULT_PORT
Sets the agent's default port for incoming requests (161).
SNMP_MIN_OID_LEN
Sets the minimum object-identifier length (2).
SNMP_MAX_OID_LEN
Sets the maximum object-identifier length (64).
SNMP_MAX_NAME_LEN
Sets the maximum community get/set name length (20).
SNMP_MAX_VALUE_LEN
Sets the maximum PDU value length (64).
SNMP_MAX_PACKET_LEN
Sets the maximum object-identifier length (SNMP_MAX_VALUE_LEN + SNMP_MAX_OID_LEN + 25).
Enumerators
ASN_BER_BASE_TYPES
Enumerated PDU BER base types supported.
SNMP_PDU_TYPES
Enumerated PDU types supported.
SNMP_TRAP_TYPES
Enumerated Trap types supported.
SNMP_ERR_CODES
Enumerated SNMP related error codes.
SNMP_API_STAT_CODES
Enumerated library Application Programmer Interface status codes.
SNMP_SYNTAXES
Enumerated PDU syntaxes supported.
Structures
SNMP_OID
Properties
byte data[SNMP_MAX_OID_LEN]
Object-Identifier's data byte array.
size_t size
Size of the Object-Identifier's data byte array.
Functions & Subroutines
void toString(char *buffer)
The toString subroutine converts the Object-Identifier contained in the data byte array , should it's size be greater than zero, and stores it into the supplied buffer argument.
See Arguments section for argument definitions.
Arguments
buffer
Buffer where the Object-Identifier is stored.
SNMP_VALUE
Properties
byte data[SNMP_MAX_VALUE_LEN]
SNMP value byte array.
size_t size
SNMP value's size.
SNMP_SYNTAXES syntax
SNMP value's syntax type.
See SNMP_SYNTAXES enumerator for additional information.
byte i
Used internally for encoding/decoding functions and should not be used in implementation code.
Functions & Subroutines
void clear(void)
The clear subroutine clear's the value byte array and sets the size to 0.
SNMP_ERR_CODES decode(char *value, size_t max_size)
Arguments
value
max_size
Returns
See SNMP_ERR_CODES enumerator for additional information.
SNMP_ERR_CODES decode(int32_t *value)
Arguments
value
Returns
See SNMP_ERR_CODES enumerator for additional information.
SNMP_ERR_CODES decode(uint32_t *value)
Arguments
value
Returns
See SNMP_ERR_CODES enumerator for additional information.
SNMP_ERR_CODES encode(SNMP_SYNTAXES syn, const char *value)
Arguments
syn
value
Returns
See SNMP_ERR_CODES enumerator for additional information.
SNMP_ERR_CODES encode(SNMP_SYNTAXES syn, const int32_t value)
Arguments
syn
value
Returns
See SNMP_ERR_CODES enumerator for additional information.
SNMP_ERR_CODES encode(SNMP_SYNTAXES syn, const uint32_t value)
Arguments
syn
value
Returns
See SNMP_ERR_CODES enumerator for additional information.
Class Constructors
None.
Class Functions & Subroutines
SNMP_API_STAT_CODES begin()
The begin function initializes the Agent and should be placed in the "setup()" function of the implementation sketch file. This function sets the Agent to default values for the Get (public) and Set (private) Community Names, and 161 for the port to process incoming requests.
See Returns section for function return information.
Returns
See SNMP_API_STAT_CODES enumerator for additional information.
SNMP_API_STAT_CODES begin(char *getCommName, char *setCommName, uint16_t port)
The begin function initializes the Agent based on supplied arguments and should be placed in the "setup()" subroutine of the implementation sketch file.
See Arguments section for argument definitions.
See Returns section for function return information.
Arguments
getCommName
Get community name.
setCommName
Set community name.
port
Agent's port to accept incoming requests.
Returns
See SNMP_API_STAT_CODES enumerator for additional information.
void listen(void)
The listen subroutine executes a delegate subroutine (pointer to a subroutine) when the Ethernet detects a byte in the receive buffer. The listen subroutine should be placed in the "loop()" subroutine of the implementation sketch file.
See onPduReceive subroutine for additional information on delegate subroutine implementation.
SNMP_API_STAT_CODES requestPdu(SNMP_PDU *pdu)
Arguments
pdu
Returns
See SNMP_API_STAT_CODES enumerator for additional information.
SNMP_API_STAT_CODES responsePdu(SNMP_PDU *pdu)
Arguments
pdu
Returns
See SNMP_API_STAT_CODES enumerator for additional information.
void onPduReceive(onPduReceiveCallback pduReceived)
Arguments
pduReceived
void freePdu(SNMP_PDU *pdu)
Arguments
pdu