The Pedigree Project  0.1
nd6_priv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
28 /*
29  * Copyright (c) 2010 Inico Technologies Ltd.
30  * All rights reserved.
31  *
32  * Redistribution and use in source and binary forms, with or without modification,
33  * are permitted provided that the following conditions are met:
34  *
35  * 1. Redistributions of source code must retain the above copyright notice,
36  * this list of conditions and the following disclaimer.
37  * 2. Redistributions in binary form must reproduce the above copyright notice,
38  * this list of conditions and the following disclaimer in the documentation
39  * and/or other materials provided with the distribution.
40  * 3. The name of the author may not be used to endorse or promote products
41  * derived from this software without specific prior written permission.
42  *
43  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
44  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
45  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
46  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
47  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
48  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
49  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
51  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
52  * OF SUCH DAMAGE.
53  *
54  * This file is part of the lwIP TCP/IP stack.
55  *
56  * Author: Ivan Delamer <delamer@inicotech.com>
57  *
58  *
59  * Please coordinate changes and requests with Ivan Delamer
60  * <delamer@inicotech.com>
61  */
62 
63 #ifndef LWIP_HDR_ND6_PRIV_H
64 #define LWIP_HDR_ND6_PRIV_H
65 
66 #include "lwip/opt.h"
67 
68 #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */
69 
70 #include "lwip/pbuf.h"
71 #include "lwip/ip6_addr.h"
72 #include "lwip/netif.h"
73 
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 #if LWIP_ND6_QUEUEING
80 
83 struct nd6_q_entry {
84  struct nd6_q_entry *next;
85  struct pbuf *p;
86 };
87 #endif /* LWIP_ND6_QUEUEING */
88 
90 struct nd6_neighbor_cache_entry {
91  ip6_addr_t next_hop_address;
92  struct netif *netif;
93  u8_t lladdr[NETIF_MAX_HWADDR_LEN];
94  /*u32_t pmtu;*/
95 #if LWIP_ND6_QUEUEING
96 
97  struct nd6_q_entry *q;
98 #else /* LWIP_ND6_QUEUEING */
99 
100  struct pbuf *q;
101 #endif /* LWIP_ND6_QUEUEING */
102  u8_t state;
103  u8_t isrouter;
104  union {
105  u32_t reachable_time; /* in ms since value may originate from network packet */
106  u32_t delay_time; /* ticks (ND6_TMR_INTERVAL) */
107  u32_t probes_sent;
108  u32_t stale_time; /* ticks (ND6_TMR_INTERVAL) */
109  } counter;
110 };
111 
112 struct nd6_destination_cache_entry {
113  ip6_addr_t destination_addr;
114  ip6_addr_t next_hop_addr;
115  u16_t pmtu;
116  u32_t age;
117 };
118 
119 struct nd6_prefix_list_entry {
120  ip6_addr_t prefix;
121  struct netif *netif;
122  u32_t invalidation_timer; /* in ms since value may originate from network packet */
123 #if LWIP_IPV6_AUTOCONFIG
124  u8_t flags;
125 #define ND6_PREFIX_AUTOCONFIG_AUTONOMOUS 0x01
126 #define ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED 0x02
127 #define ND6_PREFIX_AUTOCONFIG_ADDRESS_DUPLICATE 0x04
128 #endif /* LWIP_IPV6_AUTOCONFIG */
129 };
130 
131 struct nd6_router_list_entry {
132  struct nd6_neighbor_cache_entry *neighbor_entry;
133  u32_t invalidation_timer; /* in ms since value may originate from network packet */
134  u8_t flags;
135 };
136 
137 enum nd6_neighbor_cache_entry_state {
138  ND6_NO_ENTRY = 0,
139  ND6_INCOMPLETE,
140  ND6_REACHABLE,
141  ND6_STALE,
142  ND6_DELAY,
143  ND6_PROBE
144 };
145 
146 /* Router tables. */
147 /* @todo make these static? and entries accessible through API? */
148 extern struct nd6_neighbor_cache_entry neighbor_cache[];
149 extern struct nd6_destination_cache_entry destination_cache[];
150 extern struct nd6_prefix_list_entry prefix_list[];
151 extern struct nd6_router_list_entry default_router_list[];
152 
153 /* Default values, can be updated by a RA message. */
154 extern u32_t reachable_time;
155 extern u32_t retrans_timer;
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif /* LWIP_IPV6 */
162 
163 #endif /* LWIP_HDR_ND6_PRIV_H */
#define NETIF_MAX_HWADDR_LEN
Definition: netif.h:82
Definition: pbuf.h:161
u8_t flags
Definition: netif.h:324
Definition: netif.h:244