worked on task #13480: added LWIP_IPV4 define - IPv4 can be disabled, leaving an IPv6-only stack (SNMP is still missing)

This commit is contained in:
sg
2015-04-12 10:43:46 +02:00
parent 89d666155d
commit c1c65777b6
11 changed files with 98 additions and 58 deletions

View File

@@ -61,8 +61,8 @@ struct in_addr {
struct in6_addr {
union {
u8_t u8_addr[16];
u32_t u32_addr[4];
u8_t u8_addr[16];
} un;
#define s6_addr un.u8_addr
};
@@ -83,7 +83,7 @@ struct in6_addr {
to the IPv6 loopback address. */
#define IN6ADDR_LOOPBACK_INIT {0,0,0,PP_HTONL(1)}
/** This variable is initialized by the system to contain the wildcard IPv6 address. */
extern const struct ip6_addr in6addr_any;
extern const struct in6_addr in6addr_any;
/* Definitions of the bits in an (IPv4) Internet address integer.

View File

@@ -250,6 +250,11 @@ extern const ip_addr_t ip6_addr_any;
*/
#define IP6_ADDR_ANY6 ((ip6_addr_t*)ip_2_ip6(&ip6_addr_any))
#if !LWIP_IPV4
/** Just a little upgrade-helper for IPv6-only configurations: */
#define IP_ADDR_ANY IP6_ADDR_ANY
#endif /* !LWIP_IPV4 */
#endif
#ifdef __cplusplus

View File

@@ -322,17 +322,14 @@ extern struct netif *netif_default;
void netif_init(void);
struct netif *netif_add(struct netif *netif,
#if LWIP_IPV4
struct netif *
netif_add(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
const ip4_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input);
void
netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
const ip4_addr_t *gw);
#else /* LWIP_IPV4 */
struct netif *
netif_add(struct netif *netif, const void *ipaddr, const void *netmask,
const void *gw, void *state, netif_init_fn init, netif_input_fn input);
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
#endif /* LWIP_IPV4 */
void *state, netif_init_fn init, netif_input_fn input);
#if LWIP_IPV4
void netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
const ip4_addr_t *gw);
#endif /* LWIP_IPV4 */
void netif_remove(struct netif * netif);

View File

@@ -58,9 +58,11 @@ struct netifapi_msg_msg {
struct netif *netif;
union {
struct {
#if LWIP_IPV4
NETIFAPI_IPADDR_DEF(ip4_addr_t, ipaddr);
NETIFAPI_IPADDR_DEF(ip4_addr_t, netmask);
NETIFAPI_IPADDR_DEF(ip4_addr_t, gw);
#endif /* LWIP_IPV4 */
void *state;
netif_init_fn init;
netif_input_fn input;
@@ -79,22 +81,19 @@ struct netifapi_msg {
/* API for application */
err_t netifapi_netif_add ( struct netif *netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
void *state,
netif_init_fn init,
netif_input_fn input);
err_t netifapi_netif_add(struct netif *netif,
#if LWIP_IPV4
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
#endif /* LWIP_IPV4 */
void *state, netif_init_fn init, netif_input_fn input);
err_t netifapi_netif_set_addr ( struct netif *netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw );
#if LWIP_IPV4
err_t netifapi_netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask, const ip4_addr_t *gw);
#endif /* LWIP_IPV4*/
err_t netifapi_netif_common ( struct netif *netif,
netifapi_void_fn voidfunc,
netifapi_errt_fn errtfunc);
err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
netifapi_errt_fn errtfunc);
#define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
#define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)