From 0f165ff136624ef504f9a8ec113810cf1aec0cf4 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Thu, 17 May 2018 21:16:06 +0200 Subject: [PATCH] etharp: use generic types in external access to ARP table This should hide the internal type used for access to the ARP table which currently is s8_t or u8_t, depending on the use case. Signed-off-by: Simon Goldschmidt --- src/apps/snmp/snmp_mib2_ip.c | 8 ++++---- src/core/ipv4/etharp.c | 8 ++++---- src/include/lwip/etharp.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/apps/snmp/snmp_mib2_ip.c b/src/apps/snmp/snmp_mib2_ip.c index 64c2d8ea..6931049e 100644 --- a/src/apps/snmp/snmp_mib2_ip.c +++ b/src/apps/snmp/snmp_mib2_ip.c @@ -482,7 +482,7 @@ static const struct snmp_oid_range ip_NetToMediaTable_oid_ranges[] = { }; static snmp_err_t -ip_NetToMediaTable_get_cell_value_core(u8_t arp_table_index, const u32_t *column, union snmp_variant_value *value, u32_t *value_len) +ip_NetToMediaTable_get_cell_value_core(size_t arp_table_index, const u32_t *column, union snmp_variant_value *value, u32_t *value_len) { ip4_addr_t *ip; struct netif *netif; @@ -517,7 +517,7 @@ ip_NetToMediaTable_get_cell_value(const u32_t *column, const u32_t *row_oid, u8_ { ip4_addr_t ip_in; u8_t netif_index; - u8_t i; + size_t i; /* check if incoming OID length and if values are in plausible range */ if (!snmp_oid_in_range(row_oid, row_oid_len, ip_NetToMediaTable_oid_ranges, LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges))) { @@ -549,7 +549,7 @@ ip_NetToMediaTable_get_cell_value(const u32_t *column, const u32_t *row_oid, u8_ static snmp_err_t ip_NetToMediaTable_get_next_cell_instance_and_value(const u32_t *column, struct snmp_obj_id *row_oid, union snmp_variant_value *value, u32_t *value_len) { - u8_t i; + size_t i; struct snmp_next_oid_state state; u32_t result_temp[LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges)]; @@ -577,7 +577,7 @@ ip_NetToMediaTable_get_next_cell_instance_and_value(const u32_t *column, struct if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) { snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len); /* fill in object properties */ - return ip_NetToMediaTable_get_cell_value_core(LWIP_PTR_NUMERIC_CAST(u8_t, state.reference), column, value, value_len); + return ip_NetToMediaTable_get_cell_value_core(LWIP_PTR_NUMERIC_CAST(size_t, state.reference), column, value, value_len); } /* not found */ diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index f8e05598..732be864 100644 --- a/src/core/ipv4/etharp.c +++ b/src/core/ipv4/etharp.c @@ -396,7 +396,7 @@ etharp_find_entry(const ip4_addr_t *ipaddr, u8_t flags, struct netif *netif) arp_table[i].ctime = 0; #if ETHARP_TABLE_MATCH_NETIF arp_table[i].netif = netif; -#endif /* ETHARP_TABLE_MATCH_NETIF*/ +#endif /* ETHARP_TABLE_MATCH_NETIF */ return (s8_t)i; } @@ -579,7 +579,7 @@ etharp_cleanup_netif(struct netif *netif) * @param ip_ret points to return pointer * @return table index if found, -1 otherwise */ -s8_t +ssize_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr, struct eth_addr **eth_ret, const ip4_addr_t **ip_ret) { @@ -608,8 +608,8 @@ etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr, * @param eth_ret return value: ETH address * @return 1 on valid index, 0 otherwise */ -u8_t -etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret) +int +etharp_get_entry(size_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret) { LWIP_ASSERT("ipaddr != NULL", ipaddr != NULL); LWIP_ASSERT("netif != NULL", netif != NULL); diff --git a/src/include/lwip/etharp.h b/src/include/lwip/etharp.h index b0a0a373..2036b246 100644 --- a/src/include/lwip/etharp.h +++ b/src/include/lwip/etharp.h @@ -75,9 +75,9 @@ struct etharp_q_entry { #define etharp_init() /* Compatibility define, no init needed. */ void etharp_tmr(void); -s8_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr, +ssize_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr, struct eth_addr **eth_ret, const ip4_addr_t **ip_ret); -u8_t etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret); +int etharp_get_entry(size_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret); err_t etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr); err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q); err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr);