Add API macros for netif client data handling and update documentation accordingly

This commit is contained in:
Dirk Ziegelmeier
2016-08-26 11:21:49 +02:00
parent 537bd836c9
commit 0d510dd66d
6 changed files with 24 additions and 9 deletions

View File

@@ -95,7 +95,7 @@
static err_t autoip_arp_announce(struct netif *netif);
static void autoip_start_probing(struct netif *netif);
#define netif_autoip_data(netif) ((struct autoip*)netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP])
#define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP))
/**
* @ingroup autoip
@@ -116,7 +116,7 @@ autoip_set_struct(struct netif *netif, struct autoip *autoip)
/* clear data structure */
memset(autoip, 0, sizeof(struct autoip));
/* autoip->state = AUTOIP_STATE_OFF; */
netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP] = autoip;
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, autoip);
}
/** Restart AutoIP client and check the next address (conflict detected)
@@ -281,7 +281,7 @@ autoip_start(struct netif *netif)
}
memset(autoip, 0, sizeof(struct autoip));
/* store this AutoIP client in the netif */
netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP] = autoip;
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, autoip);
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip"));
} else {
autoip->state = AUTOIP_STATE_OFF;

View File

@@ -193,7 +193,7 @@ static void dhcp_option_hostname(struct dhcp *dhcp, struct netif *netif);
/* always add the DHCP options trailer to end and pad */
static void dhcp_option_trailer(struct dhcp *dhcp);
#define netif_dhcp_data(netif) ((struct dhcp*)netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_DHCP])
#define netif_dhcp_data(netif) ((struct dhcp*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP))
/** Ensure DHCP PCB is allocated and bound */
static err_t
@@ -668,7 +668,7 @@ dhcp_set_struct(struct netif *netif, struct dhcp *dhcp)
/* clear data structure */
memset(dhcp, 0, sizeof(struct dhcp));
/* dhcp_set_state(&dhcp, DHCP_STATE_OFF); */
netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_DHCP] = dhcp;
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, dhcp);
}
/**
@@ -686,7 +686,7 @@ void dhcp_cleanup(struct netif *netif)
if (netif_dhcp_data(netif) != NULL) {
mem_free(netif_dhcp_data(netif));
netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_DHCP] = NULL;
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, NULL);
}
}
@@ -730,7 +730,7 @@ dhcp_start(struct netif *netif)
}
/* store this dhcp client in the netif */
netif->client_data[LWIP_NETIF_CLIENT_DATA_INDEX_DHCP] = dhcp;
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, dhcp);
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): allocated dhcp"));
/* already has DHCP client attached */
} else {