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 <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2018-05-17 21:16:06 +02:00
parent 8f3df7c862
commit 0f165ff136
3 changed files with 10 additions and 10 deletions

View File

@ -482,7 +482,7 @@ static const struct snmp_oid_range ip_NetToMediaTable_oid_ranges[] = {
}; };
static snmp_err_t 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; ip4_addr_t *ip;
struct netif *netif; 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; ip4_addr_t ip_in;
u8_t netif_index; u8_t netif_index;
u8_t i; size_t i;
/* check if incoming OID length and if values are in plausible range */ /* 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))) { 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 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) 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; struct snmp_next_oid_state state;
u32_t result_temp[LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges)]; 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) { if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len); snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */ /* 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 */ /* not found */

View File

@ -396,7 +396,7 @@ etharp_find_entry(const ip4_addr_t *ipaddr, u8_t flags, struct netif *netif)
arp_table[i].ctime = 0; arp_table[i].ctime = 0;
#if ETHARP_TABLE_MATCH_NETIF #if ETHARP_TABLE_MATCH_NETIF
arp_table[i].netif = netif; arp_table[i].netif = netif;
#endif /* ETHARP_TABLE_MATCH_NETIF*/ #endif /* ETHARP_TABLE_MATCH_NETIF */
return (s8_t)i; return (s8_t)i;
} }
@ -579,7 +579,7 @@ etharp_cleanup_netif(struct netif *netif)
* @param ip_ret points to return pointer * @param ip_ret points to return pointer
* @return table index if found, -1 otherwise * @return table index if found, -1 otherwise
*/ */
s8_t ssize_t
etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr, etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr,
struct eth_addr **eth_ret, const ip4_addr_t **ip_ret) 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 * @param eth_ret return value: ETH address
* @return 1 on valid index, 0 otherwise * @return 1 on valid index, 0 otherwise
*/ */
u8_t int
etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret) 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("ipaddr != NULL", ipaddr != NULL);
LWIP_ASSERT("netif != NULL", netif != NULL); LWIP_ASSERT("netif != NULL", netif != NULL);

View File

@ -75,9 +75,9 @@ struct etharp_q_entry {
#define etharp_init() /* Compatibility define, no init needed. */ #define etharp_init() /* Compatibility define, no init needed. */
void etharp_tmr(void); 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); 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_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_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q);
err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr); err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr);