Daiki Kato / mbed-os-lychee

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nd6_priv.h Source File

nd6_priv.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * Neighbor discovery and stateless address autoconfiguration for IPv6.
00005  * Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862
00006  * (Address autoconfiguration).
00007  */
00008 
00009 /*
00010  * Copyright (c) 2010 Inico Technologies Ltd.
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without modification,
00014  * are permitted provided that the following conditions are met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright notice,
00017  *    this list of conditions and the following disclaimer.
00018  * 2. Redistributions in binary form must reproduce the above copyright notice,
00019  *    this list of conditions and the following disclaimer in the documentation
00020  *    and/or other materials provided with the distribution.
00021  * 3. The name of the author may not be used to endorse or promote products
00022  *    derived from this software without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00025  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00026  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00027  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00028  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00029  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00032  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00033  * OF SUCH DAMAGE.
00034  *
00035  * This file is part of the lwIP TCP/IP stack.
00036  *
00037  * Author: Ivan Delamer <delamer@inicotech.com>
00038  *
00039  *
00040  * Please coordinate changes and requests with Ivan Delamer
00041  * <delamer@inicotech.com>
00042  */
00043 
00044 #ifndef LWIP_HDR_ND6_PRIV_H
00045 #define LWIP_HDR_ND6_PRIV_H
00046 
00047 #include "lwip/opt.h"
00048 
00049 #if LWIP_IPV6  /* don't build if not configured for use in lwipopts.h */
00050 
00051 #include "lwip/pbuf.h"
00052 #include "lwip/ip6_addr.h"
00053 #include "lwip/netif.h"
00054 
00055 
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif
00059 
00060 #if LWIP_ND6_QUEUEING
00061 /** struct for queueing outgoing packets for unknown address
00062   * defined here to be accessed by memp.h
00063   */
00064 struct nd6_q_entry {
00065   struct nd6_q_entry *next;
00066   struct pbuf *p;
00067 };
00068 #endif /* LWIP_ND6_QUEUEING */
00069 
00070 /** Struct for tables. */
00071 struct nd6_neighbor_cache_entry {
00072   ip6_addr_t next_hop_address;
00073   struct netif *netif;
00074   u8_t lladdr[NETIF_MAX_HWADDR_LEN];
00075   /*u32_t pmtu;*/
00076 #if LWIP_ND6_QUEUEING
00077   /** Pointer to queue of pending outgoing packets on this entry. */
00078   struct nd6_q_entry *q;
00079 #else /* LWIP_ND6_QUEUEING */
00080   /** Pointer to a single pending outgoing packet on this entry. */
00081   struct pbuf *q;
00082 #endif /* LWIP_ND6_QUEUEING */
00083   u8_t state;
00084   u8_t isrouter;
00085   union {
00086     u32_t reachable_time; /* in ms since value may originate from network packet */
00087     u32_t delay_time;     /* ticks (ND6_TMR_INTERVAL) */
00088     u32_t probes_sent;
00089     u32_t stale_time;     /* ticks (ND6_TMR_INTERVAL) */
00090   } counter;
00091 };
00092 
00093 struct nd6_destination_cache_entry {
00094   ip6_addr_t destination_addr;
00095   ip6_addr_t next_hop_addr;
00096   u16_t pmtu;
00097   u32_t age;
00098 };
00099 
00100 struct nd6_prefix_list_entry {
00101   ip6_addr_t prefix;
00102   struct netif *netif;
00103   u32_t invalidation_timer; /* in ms since value may originate from network packet */
00104 #if LWIP_IPV6_AUTOCONFIG
00105   u8_t flags;
00106 #define ND6_PREFIX_AUTOCONFIG_AUTONOMOUS 0x01
00107 #define ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED 0x02
00108 #define ND6_PREFIX_AUTOCONFIG_ADDRESS_DUPLICATE 0x04
00109 #endif /* LWIP_IPV6_AUTOCONFIG */
00110 };
00111 
00112 struct nd6_router_list_entry {
00113   struct nd6_neighbor_cache_entry *neighbor_entry;
00114   u32_t invalidation_timer; /* in ms since value may originate from network packet */
00115   u8_t flags;
00116 };
00117 
00118 enum nd6_neighbor_cache_entry_state {
00119   ND6_NO_ENTRY = 0,
00120   ND6_INCOMPLETE,
00121   ND6_REACHABLE,
00122   ND6_STALE,
00123   ND6_DELAY,
00124   ND6_PROBE
00125 };
00126 
00127 /* Router tables. */
00128 /* @todo make these static? and entries accessible through API? */
00129 extern struct nd6_neighbor_cache_entry neighbor_cache[];
00130 extern struct nd6_destination_cache_entry destination_cache[];
00131 extern struct nd6_prefix_list_entry prefix_list[];
00132 extern struct nd6_router_list_entry default_router_list[];
00133 
00134 /* Default values, can be updated by a RA message. */
00135 extern u32_t reachable_time;
00136 extern u32_t retrans_timer;
00137 
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141 
00142 #endif /* LWIP_IPV6 */
00143 
00144 #endif /* LWIP_HDR_ND6_PRIV_H */