Convert SNMP snmp_vb_enumerator_err_t to a typedef and fix resulting compile error

This commit is contained in:
Dirk Ziegelmeier 2016-08-12 22:59:21 +02:00
parent 6dcb2b2415
commit ce6ea0df15
2 changed files with 7 additions and 6 deletions

View File

@ -1547,7 +1547,7 @@ snmp_execute_write_callbacks(struct snmp_request *request)
snmp_vb_enumerator_init(&inbound_varbind_enumerator, request->inbound_pbuf, request->inbound_varbind_offset, request->inbound_varbind_len);
vb.value = NULL; /* do NOT decode value (we enumerate outbound buffer here, so all varbinds have values assigned, which we don't need here) */
while (snmp_vb_enumerator_get_next(&inbound_varbind_enumerator, &vb) == ERR_OK) {
while (snmp_vb_enumerator_get_next(&inbound_varbind_enumerator, &vb) == SNMP_VB_ENUMERATOR_ERR_OK) {
snmp_write_callback(vb.oid.id, vb.oid.len, snmp_write_callback_arg);
}
}

View File

@ -79,11 +79,12 @@ struct snmp_varbind_enumerator
u16_t varbind_count;
};
typedef u8_t snmp_vb_enumerator_err_t;
#define SNMP_VB_ENUMERATOR_ERR_OK 0
#define SNMP_VB_ENUMERATOR_ERR_EOVB 1
#define SNMP_VB_ENUMERATOR_ERR_ASN1ERROR 2
#define SNMP_VB_ENUMERATOR_ERR_INVALIDLENGTH 3
typedef enum {
SNMP_VB_ENUMERATOR_ERR_OK = 0,
SNMP_VB_ENUMERATOR_ERR_EOVB = 1,
SNMP_VB_ENUMERATOR_ERR_ASN1ERROR = 2,
SNMP_VB_ENUMERATOR_ERR_INVALIDLENGTH = 3
} snmp_vb_enumerator_err_t;
void snmp_vb_enumerator_init(struct snmp_varbind_enumerator* enumerator, struct pbuf* p, u16_t offset, u16_t length);
snmp_vb_enumerator_err_t snmp_vb_enumerator_get_next(struct snmp_varbind_enumerator* enumerator, struct snmp_varbind* varbind);