From 60cd25c6a15ae0c3f3e1240fe08a138e8c7958ba Mon Sep 17 00:00:00 2001 From: sg Date: Wed, 14 Dec 2016 21:04:53 +0100 Subject: [PATCH] Moved nd6 implementation details to new file nd6_priv.h (possible after David's cleanups) --- src/core/ipv6/nd6.c | 1 + src/core/memp.c | 2 +- src/include/lwip/nd6.h | 84 ++----------------------------------- src/include/lwip/prot/nd6.h | 1 + 4 files changed, 6 insertions(+), 82 deletions(-) diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 689e1324..298b0ea0 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -46,6 +46,7 @@ #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ #include "lwip/nd6.h" +#include "lwip/priv/nd6_priv.h" #include "lwip/prot/nd6.h" #include "lwip/prot/icmp6.h" #include "lwip/pbuf.h" diff --git a/src/core/memp.c b/src/core/memp.c index d3f10a94..31624492 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -71,7 +71,7 @@ #include "netif/ppp/ppp_opts.h" #include "lwip/netdb.h" #include "lwip/dns.h" -#include "lwip/nd6.h" +#include "lwip/priv/nd6_priv.h" #include "lwip/ip6_frag.h" #include "lwip/mld6.h" diff --git a/src/include/lwip/nd6.h b/src/include/lwip/nd6.h index 69a059b1..817dfb9e 100644 --- a/src/include/lwip/nd6.h +++ b/src/include/lwip/nd6.h @@ -48,96 +48,18 @@ #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ -#include "lwip/pbuf.h" -#include "lwip/ip6.h" #include "lwip/ip6_addr.h" -#include "lwip/netif.h" - +#include "lwip/err.h" #ifdef __cplusplus extern "C" { #endif -/** Struct for tables. */ -struct nd6_neighbor_cache_entry { - ip6_addr_t next_hop_address; - struct netif *netif; - u8_t lladdr[NETIF_MAX_HWADDR_LEN]; - /*u32_t pmtu;*/ -#if LWIP_ND6_QUEUEING - /** Pointer to queue of pending outgoing packets on this entry. */ - struct nd6_q_entry *q; -#else /* LWIP_ND6_QUEUEING */ - /** Pointer to a single pending outgoing packet on this entry. */ - struct pbuf *q; -#endif /* LWIP_ND6_QUEUEING */ - u8_t state; - u8_t isrouter; - union { - u32_t reachable_time; /* in ms since value may originate from network packet */ - u32_t delay_time; /* ticks (ND6_TMR_INTERVAL) */ - u32_t probes_sent; - u32_t stale_time; /* ticks (ND6_TMR_INTERVAL) */ - } counter; -}; - -struct nd6_destination_cache_entry { - ip6_addr_t destination_addr; - ip6_addr_t next_hop_addr; - u16_t pmtu; - u32_t age; -}; - -struct nd6_prefix_list_entry { - ip6_addr_t prefix; - struct netif *netif; - u32_t invalidation_timer; /* in ms since value may originate from network packet */ -#if LWIP_IPV6_AUTOCONFIG - u8_t flags; -#define ND6_PREFIX_AUTOCONFIG_AUTONOMOUS 0x01 -#define ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED 0x02 -#define ND6_PREFIX_AUTOCONFIG_ADDRESS_DUPLICATE 0x04 -#endif /* LWIP_IPV6_AUTOCONFIG */ -}; - -struct nd6_router_list_entry { - struct nd6_neighbor_cache_entry *neighbor_entry; - u32_t invalidation_timer; /* in ms since value may originate from network packet */ - u8_t flags; -}; - -enum nd6_neighbor_cache_entry_state { - ND6_NO_ENTRY = 0, - ND6_INCOMPLETE, - ND6_REACHABLE, - ND6_STALE, - ND6_DELAY, - ND6_PROBE -}; - -#if LWIP_ND6_QUEUEING -/** struct for queueing outgoing packets for unknown address - * defined here to be accessed by memp.h - */ -struct nd6_q_entry { - struct nd6_q_entry *next; - struct pbuf *p; -}; -#endif /* LWIP_ND6_QUEUEING */ - /** 1 second period */ #define ND6_TMR_INTERVAL 1000 -/* Router tables. */ -/* @todo make these static? and entries accessible through API? */ -extern struct nd6_neighbor_cache_entry neighbor_cache[]; -extern struct nd6_destination_cache_entry destination_cache[]; -extern struct nd6_prefix_list_entry prefix_list[]; -extern struct nd6_router_list_entry default_router_list[]; - -/* Default values, can be updated by a RA message. */ -extern u32_t reachable_time; -extern u32_t retrans_timer; +struct pbuf; +struct netif; void nd6_tmr(void); void nd6_input(struct pbuf *p, struct netif *inp); diff --git a/src/include/lwip/prot/nd6.h b/src/include/lwip/prot/nd6.h index eae3d28e..7f46c535 100644 --- a/src/include/lwip/prot/nd6.h +++ b/src/include/lwip/prot/nd6.h @@ -39,6 +39,7 @@ #include "lwip/arch.h" #include "lwip/ip6_addr.h" +#include "lwip/prot/ip6.h" #ifdef __cplusplus extern "C" {