Introduce an API to store arbitrary data pointers in struct netif

Let MDNS to use the new API
TODO: AutoIP, DHCP
This commit is contained in:
Dirk Ziegelmeier
2016-08-17 16:37:15 +02:00
parent 93b286e508
commit c28fb298b7
4 changed files with 81 additions and 43 deletions

View File

@@ -38,7 +38,6 @@
#define LWIP_HDR_NETIF_H
#include "lwip/opt.h"
#include "lwip/apps/mdns_opts.h"
#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
@@ -59,9 +58,6 @@ struct autoip;
#if LWIP_IPV6_DHCP6
struct dhcp6;
#endif /* LWIP_IPV6_DHCP6 */
#if LWIP_MDNS_RESPONDER
struct mdns_host;
#endif
#ifdef __cplusplus
extern "C" {
@@ -259,10 +255,9 @@ struct netif {
/** the AutoIP client state information for this netif */
struct autoip *autoip;
#endif
#if LWIP_MDNS_RESPONDER
/** Interface-specific info for multicast DNS */
struct mdns_host *mdns;
#endif /* LWIP_MDNS_RESPONDER */
#if LWIP_NUM_NETIF_CLIENT_DATA > 0
void* client_data[LWIP_NUM_NETIF_CLIENT_DATA];
#endif
#if LWIP_IPV6_AUTOCONFIG
/** is this netif enabled for IPv6 autoconfiguration */
u8_t ip6_autoconfig_enabled;
@@ -431,6 +426,10 @@ void netif_poll_all(void);
err_t netif_input(struct pbuf *p, struct netif *inp);
#if LWIP_NUM_NETIF_CLIENT_DATA > 0
u8_t netif_alloc_client_data_id(void);
#endif
#if LWIP_IPV6
/** @ingroup netif */
#define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))

View File

@@ -1465,6 +1465,14 @@
#if !defined LWIP_NETIF_TX_SINGLE_PBUF || defined __DOXYGEN__
#define LWIP_NETIF_TX_SINGLE_PBUF 0
#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
/**
* LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store
* per data in client_data member array of struct netif.
*/
#if !defined LWIP_NUM_NETIF_CLIENT_DATA || defined __DOXYGEN__
#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_DHCP + LWIP_AUTOIP)
#endif
/**
* @}
*/