From ce6ea0df1557571ad418b03fd61a83952bc6d4e3 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Fri, 12 Aug 2016 22:59:21 +0200 Subject: [PATCH] Convert SNMP snmp_vb_enumerator_err_t to a typedef and fix resulting compile error --- src/apps/snmp/snmp_msg.c | 2 +- src/apps/snmp/snmp_msg.h | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/apps/snmp/snmp_msg.c b/src/apps/snmp/snmp_msg.c index 48c08d5b..912f55aa 100644 --- a/src/apps/snmp/snmp_msg.c +++ b/src/apps/snmp/snmp_msg.c @@ -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); } } diff --git a/src/apps/snmp/snmp_msg.h b/src/apps/snmp/snmp_msg.h index a14b05a6..2d01ef36 100644 --- a/src/apps/snmp/snmp_msg.h +++ b/src/apps/snmp/snmp_msg.h @@ -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);