mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-09 00:53:37 +08:00
Add API macros for netif client data handling and update documentation accordingly
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user