47 #define LOG_MODULE "SNMP [engine]" 48 #define LOG_LEVEL LOG_LEVEL_SNMP 77 resource->
handler(&varbinds[i], &resource->
oid);
112 resource->
handler(&varbinds[i], &resource->
oid);
126 uint32_t j, original_varbinds_length;
128 uint8_t i, varbinds_length;
134 original_varbinds_length = 0;
137 memcpy(&oids[original_varbinds_length], &varbinds[original_varbinds_length].
oid,
sizeof(
snmp_oid_t));
138 original_varbinds_length++;
142 for(i = 0; i < original_varbinds_length; i++) {
166 resource->
handler(&varbinds[varbinds_length], &resource->
oid);
176 for(j = header->
non_repeaters; j < original_varbinds_length; j++) {
190 memcpy(&varbinds[varbinds_length].
oid, &oids[j],
sizeof(
snmp_oid_t));
202 resource->
handler(&varbinds[varbinds_length], &resource->
oid);
225 memset(&header, 0,
sizeof(header));
226 memset(varbinds, 0,
sizeof(varbinds));
234 LOG_ERR(
"Request with invalid community\n");
244 if(snmp_engine_get(&header, varbinds) == -1) {
250 if(snmp_engine_get_next(&header, varbinds) == -1) {
256 if(snmp_engine_get_bulk(&header, varbinds) == -1) {
262 LOG_ERR(
"Invalid request type");
snmp_mib_resource_handler_t handler
The function handler that is called for this resource.
#define SNMP_COMMUNITY
Default SNMP Community.
#define SNMP_VERSION_1
SNMP Version 1 code.
SNMP Implementation of the BER encoding
#define BER_DATA_TYPE_NO_SUCH_INSTANCE
No Such Instance.
#define BER_DATA_TYPE_EOC
End-of-Content.
int snmp_message_decode(snmp_packet_t *snmp_packet, snmp_header_t *header, snmp_varbind_t *varbinds)
SNMP Implementation of the messages
#define BER_DATA_TYPE_PDU_GET_NEXT_REQUEST
PDU Get Next Request.
#define BER_DATA_TYPE_END_OF_MIB_VIEW
End of MIB View.
int snmp_message_encode(snmp_packet_t *snmp_packet, snmp_header_t *header, snmp_varbind_t *varbinds)
Encodes a SNMP message.
snmp_mib_resource_t * snmp_mib_find(snmp_oid_t *oid)
Finds the MIB Resource for this OID.
#define SNMP_STATUS_NO_SUCH_NAME
SNMP No Such Name error code.
#define SNMP_VERSION_2C
SNMP Version 2c code.
#define BER_DATA_TYPE_PDU_GET_REQUEST
PDU Get Request.
snmp_oid_t oid
A OID struct.
#define BER_DATA_TYPE_PDU_GET_RESPONSE
PDU Get Reponse.
#define SNMP_MAX_NR_VALUES
Default maximum number of OIDs in one response.
SNMP Implementation of the MIB
snmp_mib_resource_t * snmp_mib_find_next(snmp_oid_t *oid)
Finds the next MIB Resource after this OID.
SNMP Implementation of the protocol engine
#define BER_DATA_TYPE_PDU_GET_BULK
PDU Get Bulk.
int snmp_engine(snmp_packet_t *snmp_packet)
Process the SNMP packet and prepares the response.