Webserver+3d print
cyclone_tcp/ipv6/ndp.h@0:8918a71cdbe9, 2017-02-04 (annotated)
- Committer:
- Sergunb
- Date:
- Sat Feb 04 18:15:49 2017 +0000
- Revision:
- 0:8918a71cdbe9
nothing else
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sergunb | 0:8918a71cdbe9 | 1 | /** |
Sergunb | 0:8918a71cdbe9 | 2 | * @file ndp.h |
Sergunb | 0:8918a71cdbe9 | 3 | * @brief NDP (Neighbor Discovery Protocol) |
Sergunb | 0:8918a71cdbe9 | 4 | * |
Sergunb | 0:8918a71cdbe9 | 5 | * @section License |
Sergunb | 0:8918a71cdbe9 | 6 | * |
Sergunb | 0:8918a71cdbe9 | 7 | * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. |
Sergunb | 0:8918a71cdbe9 | 8 | * |
Sergunb | 0:8918a71cdbe9 | 9 | * This file is part of CycloneTCP Open. |
Sergunb | 0:8918a71cdbe9 | 10 | * |
Sergunb | 0:8918a71cdbe9 | 11 | * This program is free software; you can redistribute it and/or |
Sergunb | 0:8918a71cdbe9 | 12 | * modify it under the terms of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 13 | * as published by the Free Software Foundation; either version 2 |
Sergunb | 0:8918a71cdbe9 | 14 | * of the License, or (at your option) any later version. |
Sergunb | 0:8918a71cdbe9 | 15 | * |
Sergunb | 0:8918a71cdbe9 | 16 | * This program is distributed in the hope that it will be useful, |
Sergunb | 0:8918a71cdbe9 | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Sergunb | 0:8918a71cdbe9 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Sergunb | 0:8918a71cdbe9 | 19 | * GNU General Public License for more details. |
Sergunb | 0:8918a71cdbe9 | 20 | * |
Sergunb | 0:8918a71cdbe9 | 21 | * You should have received a copy of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 22 | * along with this program; if not, write to the Free Software Foundation, |
Sergunb | 0:8918a71cdbe9 | 23 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Sergunb | 0:8918a71cdbe9 | 24 | * |
Sergunb | 0:8918a71cdbe9 | 25 | * @author Oryx Embedded SARL (www.oryx-embedded.com) |
Sergunb | 0:8918a71cdbe9 | 26 | * @version 1.7.6 |
Sergunb | 0:8918a71cdbe9 | 27 | **/ |
Sergunb | 0:8918a71cdbe9 | 28 | |
Sergunb | 0:8918a71cdbe9 | 29 | #ifndef _NDP_H |
Sergunb | 0:8918a71cdbe9 | 30 | #define _NDP_H |
Sergunb | 0:8918a71cdbe9 | 31 | |
Sergunb | 0:8918a71cdbe9 | 32 | //Dependencies |
Sergunb | 0:8918a71cdbe9 | 33 | #include "core/net.h" |
Sergunb | 0:8918a71cdbe9 | 34 | |
Sergunb | 0:8918a71cdbe9 | 35 | //NDP support |
Sergunb | 0:8918a71cdbe9 | 36 | #ifndef NDP_SUPPORT |
Sergunb | 0:8918a71cdbe9 | 37 | #define NDP_SUPPORT ENABLED |
Sergunb | 0:8918a71cdbe9 | 38 | #elif (NDP_SUPPORT != ENABLED && NDP_SUPPORT != DISABLED) |
Sergunb | 0:8918a71cdbe9 | 39 | #error NDP_SUPPORT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 40 | #endif |
Sergunb | 0:8918a71cdbe9 | 41 | |
Sergunb | 0:8918a71cdbe9 | 42 | //NDP tick interval |
Sergunb | 0:8918a71cdbe9 | 43 | #ifndef NDP_TICK_INTERVAL |
Sergunb | 0:8918a71cdbe9 | 44 | #define NDP_TICK_INTERVAL 200 |
Sergunb | 0:8918a71cdbe9 | 45 | #elif (NDP_TICK_INTERVAL < 10) |
Sergunb | 0:8918a71cdbe9 | 46 | #error NDP_TICK_INTERVAL parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 47 | #endif |
Sergunb | 0:8918a71cdbe9 | 48 | |
Sergunb | 0:8918a71cdbe9 | 49 | //Neighbor cache size |
Sergunb | 0:8918a71cdbe9 | 50 | #ifndef NDP_NEIGHBOR_CACHE_SIZE |
Sergunb | 0:8918a71cdbe9 | 51 | #define NDP_NEIGHBOR_CACHE_SIZE 8 |
Sergunb | 0:8918a71cdbe9 | 52 | #elif (NDP_NEIGHBOR_CACHE_SIZE < 1) |
Sergunb | 0:8918a71cdbe9 | 53 | #error NDP_NEIGHBOR_CACHE_SIZE parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 54 | #endif |
Sergunb | 0:8918a71cdbe9 | 55 | |
Sergunb | 0:8918a71cdbe9 | 56 | //Destination cache size |
Sergunb | 0:8918a71cdbe9 | 57 | #ifndef NDP_DEST_CACHE_SIZE |
Sergunb | 0:8918a71cdbe9 | 58 | #define NDP_DEST_CACHE_SIZE 8 |
Sergunb | 0:8918a71cdbe9 | 59 | #elif (NDP_DEST_CACHE_SIZE < 1) |
Sergunb | 0:8918a71cdbe9 | 60 | #error NDP_DEST_CACHE_SIZE parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 61 | #endif |
Sergunb | 0:8918a71cdbe9 | 62 | |
Sergunb | 0:8918a71cdbe9 | 63 | //Maximum number of packets waiting for address resolution to complete |
Sergunb | 0:8918a71cdbe9 | 64 | #ifndef NDP_MAX_PENDING_PACKETS |
Sergunb | 0:8918a71cdbe9 | 65 | #define NDP_MAX_PENDING_PACKETS 2 |
Sergunb | 0:8918a71cdbe9 | 66 | #elif (NDP_MAX_PENDING_PACKETS < 1) |
Sergunb | 0:8918a71cdbe9 | 67 | #error NDP_MAX_PENDING_PACKETS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 68 | #endif |
Sergunb | 0:8918a71cdbe9 | 69 | |
Sergunb | 0:8918a71cdbe9 | 70 | //Maximum time interval between Router Advertisements |
Sergunb | 0:8918a71cdbe9 | 71 | #ifndef NDP_MAX_RTR_ADVERT_INTERVAL |
Sergunb | 0:8918a71cdbe9 | 72 | #define NDP_MAX_RTR_ADVERT_INTERVAL 600000 |
Sergunb | 0:8918a71cdbe9 | 73 | #elif (NDP_MAX_RTR_ADVERT_INTERVAL < 1000) |
Sergunb | 0:8918a71cdbe9 | 74 | #error NDP_MAX_RTR_ADVERT_INTERVAL parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 75 | #endif |
Sergunb | 0:8918a71cdbe9 | 76 | |
Sergunb | 0:8918a71cdbe9 | 77 | //Maximum time interval between initial Router Advertisements |
Sergunb | 0:8918a71cdbe9 | 78 | #ifndef NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL |
Sergunb | 0:8918a71cdbe9 | 79 | #define NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL 16000 |
Sergunb | 0:8918a71cdbe9 | 80 | #elif (NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL < 1000) |
Sergunb | 0:8918a71cdbe9 | 81 | #error NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 82 | #endif |
Sergunb | 0:8918a71cdbe9 | 83 | |
Sergunb | 0:8918a71cdbe9 | 84 | //Maximum number of initial Router Advertisements |
Sergunb | 0:8918a71cdbe9 | 85 | #ifndef NDP_MAX_INITIAL_RTR_ADVERTISEMENTS |
Sergunb | 0:8918a71cdbe9 | 86 | #define NDP_MAX_INITIAL_RTR_ADVERTISEMENTS 3 |
Sergunb | 0:8918a71cdbe9 | 87 | #elif (NDP_MAX_INITIAL_RTR_ADVERTISEMENTS < 1) |
Sergunb | 0:8918a71cdbe9 | 88 | #error NDP_MAX_INITIAL_RTR_ADVERTISEMENTS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 89 | #endif |
Sergunb | 0:8918a71cdbe9 | 90 | |
Sergunb | 0:8918a71cdbe9 | 91 | //Maximum number of final Router Advertisements |
Sergunb | 0:8918a71cdbe9 | 92 | #ifndef NDP_MAX_FINAL_RTR_ADVERTISEMENTS |
Sergunb | 0:8918a71cdbe9 | 93 | #define NDP_MAX_FINAL_RTR_ADVERTISEMENTS 3 |
Sergunb | 0:8918a71cdbe9 | 94 | #elif (NDP_MAX_FINAL_RTR_ADVERTISEMENTS < 1) |
Sergunb | 0:8918a71cdbe9 | 95 | #error NDP_MAX_FINAL_RTR_ADVERTISEMENTS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 96 | #endif |
Sergunb | 0:8918a71cdbe9 | 97 | |
Sergunb | 0:8918a71cdbe9 | 98 | //Minimum delay between Router Advertisements |
Sergunb | 0:8918a71cdbe9 | 99 | #ifndef NDP_MIN_DELAY_BETWEEN_RAS |
Sergunb | 0:8918a71cdbe9 | 100 | #define NDP_MIN_DELAY_BETWEEN_RAS 3000 |
Sergunb | 0:8918a71cdbe9 | 101 | #elif (NDP_MIN_DELAY_BETWEEN_RAS < 1000) |
Sergunb | 0:8918a71cdbe9 | 102 | #error NDP_MIN_DELAY_BETWEEN_RAS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 103 | #endif |
Sergunb | 0:8918a71cdbe9 | 104 | |
Sergunb | 0:8918a71cdbe9 | 105 | //Maximum delay for Router Advertisements sent in response to a Router Solicitation |
Sergunb | 0:8918a71cdbe9 | 106 | #ifndef NDP_MAX_RA_DELAY_TIME |
Sergunb | 0:8918a71cdbe9 | 107 | #define NDP_MAX_RA_DELAY_TIME 500 |
Sergunb | 0:8918a71cdbe9 | 108 | #elif (NDP_MAX_RA_DELAY_TIME < 100) |
Sergunb | 0:8918a71cdbe9 | 109 | #error NDP_MAX_RA_DELAY_TIME parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 110 | #endif |
Sergunb | 0:8918a71cdbe9 | 111 | |
Sergunb | 0:8918a71cdbe9 | 112 | //Minimum delay before transmitting the first Router Solicitation message |
Sergunb | 0:8918a71cdbe9 | 113 | #ifndef NDP_MIN_RTR_SOLICITATION_DELAY |
Sergunb | 0:8918a71cdbe9 | 114 | #define NDP_MIN_RTR_SOLICITATION_DELAY 0 |
Sergunb | 0:8918a71cdbe9 | 115 | #elif (NDP_MIN_RTR_SOLICITATION_DELAY < 0) |
Sergunb | 0:8918a71cdbe9 | 116 | #error NDP_MIN_RTR_SOLICITATION_DELAY parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 117 | #endif |
Sergunb | 0:8918a71cdbe9 | 118 | |
Sergunb | 0:8918a71cdbe9 | 119 | //Maximum delay before transmitting the first Router Solicitation message |
Sergunb | 0:8918a71cdbe9 | 120 | #ifndef NDP_MAX_RTR_SOLICITATION_DELAY |
Sergunb | 0:8918a71cdbe9 | 121 | #define NDP_MAX_RTR_SOLICITATION_DELAY 1000 |
Sergunb | 0:8918a71cdbe9 | 122 | #elif (NDP_MAX_RTR_SOLICITATION_DELAY < 0) |
Sergunb | 0:8918a71cdbe9 | 123 | #error NDP_MAX_RTR_SOLICITATION_DELAY parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 124 | #endif |
Sergunb | 0:8918a71cdbe9 | 125 | |
Sergunb | 0:8918a71cdbe9 | 126 | //The time between retransmissions of Router Solicitation messages |
Sergunb | 0:8918a71cdbe9 | 127 | #ifndef NDP_RTR_SOLICITATION_INTERVAL |
Sergunb | 0:8918a71cdbe9 | 128 | #define NDP_RTR_SOLICITATION_INTERVAL 4000 |
Sergunb | 0:8918a71cdbe9 | 129 | #elif (NDP_RTR_SOLICITATION_INTERVAL < 1000) |
Sergunb | 0:8918a71cdbe9 | 130 | #error NDP_RTR_SOLICITATION_INTERVAL parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 131 | #endif |
Sergunb | 0:8918a71cdbe9 | 132 | |
Sergunb | 0:8918a71cdbe9 | 133 | //Number of retransmissions for Router Solicitation messages |
Sergunb | 0:8918a71cdbe9 | 134 | #ifndef NDP_MAX_RTR_SOLICITATIONS |
Sergunb | 0:8918a71cdbe9 | 135 | #define NDP_MAX_RTR_SOLICITATIONS 3 |
Sergunb | 0:8918a71cdbe9 | 136 | #elif (NDP_MAX_RTR_SOLICITATIONS < 1) |
Sergunb | 0:8918a71cdbe9 | 137 | #error NDP_MAX_RTR_SOLICITATIONS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 138 | #endif |
Sergunb | 0:8918a71cdbe9 | 139 | |
Sergunb | 0:8918a71cdbe9 | 140 | //Number of retransmissions for multicast Neighbor Solicitation messages |
Sergunb | 0:8918a71cdbe9 | 141 | #ifndef NDP_MAX_MULTICAST_SOLICIT |
Sergunb | 0:8918a71cdbe9 | 142 | #define NDP_MAX_MULTICAST_SOLICIT 3 |
Sergunb | 0:8918a71cdbe9 | 143 | #elif (NDP_MAX_MULTICAST_SOLICIT < 1) |
Sergunb | 0:8918a71cdbe9 | 144 | #error NDP_MAX_MULTICAST_SOLICIT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 145 | #endif |
Sergunb | 0:8918a71cdbe9 | 146 | |
Sergunb | 0:8918a71cdbe9 | 147 | //Number of retransmissions for unicast Neighbor Solicitation messages |
Sergunb | 0:8918a71cdbe9 | 148 | #ifndef NDP_MAX_UNICAST_SOLICIT |
Sergunb | 0:8918a71cdbe9 | 149 | #define NDP_MAX_UNICAST_SOLICIT 3 |
Sergunb | 0:8918a71cdbe9 | 150 | #elif (NDP_MAX_UNICAST_SOLICIT < 1) |
Sergunb | 0:8918a71cdbe9 | 151 | #error NDP_MAX_UNICAST_SOLICIT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 152 | #endif |
Sergunb | 0:8918a71cdbe9 | 153 | |
Sergunb | 0:8918a71cdbe9 | 154 | //Maximum number of Neighbor Solicitation messages sent while performing DAD |
Sergunb | 0:8918a71cdbe9 | 155 | #ifndef NDP_DUP_ADDR_DETECT_TRANSMITS |
Sergunb | 0:8918a71cdbe9 | 156 | #define NDP_DUP_ADDR_DETECT_TRANSMITS 1 |
Sergunb | 0:8918a71cdbe9 | 157 | #elif (NDP_DUP_ADDR_DETECT_TRANSMITS < 0) |
Sergunb | 0:8918a71cdbe9 | 158 | #error NDP_DUP_ADDR_DETECT_TRANSMITS parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 159 | #endif |
Sergunb | 0:8918a71cdbe9 | 160 | |
Sergunb | 0:8918a71cdbe9 | 161 | //Delay before sending Neighbor Advertisements if the target address is an anycast address |
Sergunb | 0:8918a71cdbe9 | 162 | #ifndef NDP_MAX_ANYCAST_DELAY_TIME |
Sergunb | 0:8918a71cdbe9 | 163 | #define NDP_MAX_ANYCAST_DELAY_TIME 1000 |
Sergunb | 0:8918a71cdbe9 | 164 | #elif (NDP_MAX_ANYCAST_DELAY_TIME < 100) |
Sergunb | 0:8918a71cdbe9 | 165 | #error NDP_MAX_ANYCAST_DELAY_TIME parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 166 | #endif |
Sergunb | 0:8918a71cdbe9 | 167 | |
Sergunb | 0:8918a71cdbe9 | 168 | //Maximum number of unsolicited Neighbor Advertisements |
Sergunb | 0:8918a71cdbe9 | 169 | #ifndef NDP_MAX_NEIGHBOR_ADVERTISEMENT |
Sergunb | 0:8918a71cdbe9 | 170 | #define NDP_MAX_NEIGHBOR_ADVERTISEMENT 3 |
Sergunb | 0:8918a71cdbe9 | 171 | #elif (NDP_MAX_NEIGHBOR_ADVERTISEMENT < 0) |
Sergunb | 0:8918a71cdbe9 | 172 | #error NDP_MAX_NEIGHBOR_ADVERTISEMENT parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 173 | #endif |
Sergunb | 0:8918a71cdbe9 | 174 | |
Sergunb | 0:8918a71cdbe9 | 175 | //The time a neighbor is considered reachable after receiving a reachability confirmation |
Sergunb | 0:8918a71cdbe9 | 176 | #ifndef NDP_REACHABLE_TIME |
Sergunb | 0:8918a71cdbe9 | 177 | #define NDP_REACHABLE_TIME 30000 |
Sergunb | 0:8918a71cdbe9 | 178 | #elif (NDP_REACHABLE_TIME < 1000) |
Sergunb | 0:8918a71cdbe9 | 179 | #error NDP_REACHABLE_TIME parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 180 | #endif |
Sergunb | 0:8918a71cdbe9 | 181 | |
Sergunb | 0:8918a71cdbe9 | 182 | //The time between retransmissions of Neighbor Solicitation messages |
Sergunb | 0:8918a71cdbe9 | 183 | #ifndef NDP_RETRANS_TIMER |
Sergunb | 0:8918a71cdbe9 | 184 | #define NDP_RETRANS_TIMER 1000 |
Sergunb | 0:8918a71cdbe9 | 185 | #elif (NDP_RETRANS_TIMER < 100) |
Sergunb | 0:8918a71cdbe9 | 186 | #error NDP_RETRANS_TIMER parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 187 | #endif |
Sergunb | 0:8918a71cdbe9 | 188 | |
Sergunb | 0:8918a71cdbe9 | 189 | //Delay before sending the first probe |
Sergunb | 0:8918a71cdbe9 | 190 | #ifndef NDP_DELAY_FIRST_PROBE_TIME |
Sergunb | 0:8918a71cdbe9 | 191 | #define NDP_DELAY_FIRST_PROBE_TIME 5000 |
Sergunb | 0:8918a71cdbe9 | 192 | #elif (NDP_DELAY_FIRST_PROBE_TIME < 1000) |
Sergunb | 0:8918a71cdbe9 | 193 | #error NDP_DELAY_FIRST_PROBE_TIME parameter is not valid |
Sergunb | 0:8918a71cdbe9 | 194 | #endif |
Sergunb | 0:8918a71cdbe9 | 195 | |
Sergunb | 0:8918a71cdbe9 | 196 | //Hop Limit used by NDP messages |
Sergunb | 0:8918a71cdbe9 | 197 | #define NDP_HOP_LIMIT 255 |
Sergunb | 0:8918a71cdbe9 | 198 | |
Sergunb | 0:8918a71cdbe9 | 199 | //Infinite lifetime |
Sergunb | 0:8918a71cdbe9 | 200 | #define NDP_INFINITE_LIFETIME 0xFFFFFFFF |
Sergunb | 0:8918a71cdbe9 | 201 | |
Sergunb | 0:8918a71cdbe9 | 202 | |
Sergunb | 0:8918a71cdbe9 | 203 | /** |
Sergunb | 0:8918a71cdbe9 | 204 | * @brief Neighbor Discovery options |
Sergunb | 0:8918a71cdbe9 | 205 | **/ |
Sergunb | 0:8918a71cdbe9 | 206 | |
Sergunb | 0:8918a71cdbe9 | 207 | typedef enum |
Sergunb | 0:8918a71cdbe9 | 208 | { |
Sergunb | 0:8918a71cdbe9 | 209 | NDP_OPT_SOURCE_LINK_LAYER_ADDR = 1, |
Sergunb | 0:8918a71cdbe9 | 210 | NDP_OPT_TARGET_LINK_LAYER_ADDR = 2, |
Sergunb | 0:8918a71cdbe9 | 211 | NDP_OPT_PREFIX_INFORMATION = 3, |
Sergunb | 0:8918a71cdbe9 | 212 | NDP_OPT_REDIRECTED_HEADER = 4, |
Sergunb | 0:8918a71cdbe9 | 213 | NDP_OPT_MTU = 5, |
Sergunb | 0:8918a71cdbe9 | 214 | NDP_OPT_ROUTE_INFORMATION = 24, |
Sergunb | 0:8918a71cdbe9 | 215 | NDP_OPT_RECURSIVE_DNS_SERVER = 25, |
Sergunb | 0:8918a71cdbe9 | 216 | NDP_OPT_DNS_SEARCH_LIST = 31, |
Sergunb | 0:8918a71cdbe9 | 217 | NDP_OPT_6LOWPAN_CONTEXT = 34, |
Sergunb | 0:8918a71cdbe9 | 218 | NDP_OPT_ANY = 255 |
Sergunb | 0:8918a71cdbe9 | 219 | } NdpOptionType; |
Sergunb | 0:8918a71cdbe9 | 220 | |
Sergunb | 0:8918a71cdbe9 | 221 | |
Sergunb | 0:8918a71cdbe9 | 222 | /** |
Sergunb | 0:8918a71cdbe9 | 223 | * @brief Router selection preferences |
Sergunb | 0:8918a71cdbe9 | 224 | **/ |
Sergunb | 0:8918a71cdbe9 | 225 | |
Sergunb | 0:8918a71cdbe9 | 226 | typedef enum |
Sergunb | 0:8918a71cdbe9 | 227 | { |
Sergunb | 0:8918a71cdbe9 | 228 | NDP_ROUTER_SEL_PREFERENCE_MEDIUM = 0, |
Sergunb | 0:8918a71cdbe9 | 229 | NDP_ROUTER_SEL_PREFERENCE_HIGH = 1, |
Sergunb | 0:8918a71cdbe9 | 230 | NDP_ROUTER_SEL_PREFERENCE_RESERVED = 2, |
Sergunb | 0:8918a71cdbe9 | 231 | NDP_ROUTER_SEL_PREFERENCE_LOW = 3 |
Sergunb | 0:8918a71cdbe9 | 232 | } NdpRouterSelPreference; |
Sergunb | 0:8918a71cdbe9 | 233 | |
Sergunb | 0:8918a71cdbe9 | 234 | |
Sergunb | 0:8918a71cdbe9 | 235 | /** |
Sergunb | 0:8918a71cdbe9 | 236 | * @brief Neighbor cache entry states |
Sergunb | 0:8918a71cdbe9 | 237 | **/ |
Sergunb | 0:8918a71cdbe9 | 238 | |
Sergunb | 0:8918a71cdbe9 | 239 | typedef enum |
Sergunb | 0:8918a71cdbe9 | 240 | { |
Sergunb | 0:8918a71cdbe9 | 241 | NDP_STATE_NONE = 0, |
Sergunb | 0:8918a71cdbe9 | 242 | NDP_STATE_INCOMPLETE = 1, |
Sergunb | 0:8918a71cdbe9 | 243 | NDP_STATE_REACHABLE = 2, |
Sergunb | 0:8918a71cdbe9 | 244 | NDP_STATE_STALE = 3, |
Sergunb | 0:8918a71cdbe9 | 245 | NDP_STATE_DELAY = 4, |
Sergunb | 0:8918a71cdbe9 | 246 | NDP_STATE_PROBE = 5, |
Sergunb | 0:8918a71cdbe9 | 247 | NDP_STATE_PERMANENT = 6 |
Sergunb | 0:8918a71cdbe9 | 248 | } NdpState; |
Sergunb | 0:8918a71cdbe9 | 249 | |
Sergunb | 0:8918a71cdbe9 | 250 | |
Sergunb | 0:8918a71cdbe9 | 251 | //CodeWarrior or Win32 compiler? |
Sergunb | 0:8918a71cdbe9 | 252 | #if defined(__CWCC__) || defined(_WIN32) |
Sergunb | 0:8918a71cdbe9 | 253 | #pragma pack(push, 1) |
Sergunb | 0:8918a71cdbe9 | 254 | #endif |
Sergunb | 0:8918a71cdbe9 | 255 | |
Sergunb | 0:8918a71cdbe9 | 256 | |
Sergunb | 0:8918a71cdbe9 | 257 | /** |
Sergunb | 0:8918a71cdbe9 | 258 | * @brief Router Solicitation message |
Sergunb | 0:8918a71cdbe9 | 259 | **/ |
Sergunb | 0:8918a71cdbe9 | 260 | |
Sergunb | 0:8918a71cdbe9 | 261 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 262 | { |
Sergunb | 0:8918a71cdbe9 | 263 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 264 | uint8_t code; //1 |
Sergunb | 0:8918a71cdbe9 | 265 | uint16_t checksum; //2-3 |
Sergunb | 0:8918a71cdbe9 | 266 | uint32_t reserved; //4-7 |
Sergunb | 0:8918a71cdbe9 | 267 | uint8_t options[]; //8 |
Sergunb | 0:8918a71cdbe9 | 268 | } __end_packed NdpRouterSolMessage; |
Sergunb | 0:8918a71cdbe9 | 269 | |
Sergunb | 0:8918a71cdbe9 | 270 | |
Sergunb | 0:8918a71cdbe9 | 271 | /** |
Sergunb | 0:8918a71cdbe9 | 272 | * @brief Router Advertisement message |
Sergunb | 0:8918a71cdbe9 | 273 | **/ |
Sergunb | 0:8918a71cdbe9 | 274 | |
Sergunb | 0:8918a71cdbe9 | 275 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 276 | { |
Sergunb | 0:8918a71cdbe9 | 277 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 278 | uint8_t code; //1 |
Sergunb | 0:8918a71cdbe9 | 279 | uint16_t checksum; //2-3 |
Sergunb | 0:8918a71cdbe9 | 280 | uint8_t curHopLimit; //4 |
Sergunb | 0:8918a71cdbe9 | 281 | #ifdef _CPU_BIG_ENDIAN |
Sergunb | 0:8918a71cdbe9 | 282 | uint8_t m : 1; //5 |
Sergunb | 0:8918a71cdbe9 | 283 | uint8_t o : 1; |
Sergunb | 0:8918a71cdbe9 | 284 | uint8_t h : 1; |
Sergunb | 0:8918a71cdbe9 | 285 | uint8_t prf : 2; |
Sergunb | 0:8918a71cdbe9 | 286 | uint8_t p : 1; |
Sergunb | 0:8918a71cdbe9 | 287 | uint8_t reserved : 2; |
Sergunb | 0:8918a71cdbe9 | 288 | #else |
Sergunb | 0:8918a71cdbe9 | 289 | uint8_t reserved : 2; //5 |
Sergunb | 0:8918a71cdbe9 | 290 | uint8_t p : 1; |
Sergunb | 0:8918a71cdbe9 | 291 | uint8_t prf : 2; |
Sergunb | 0:8918a71cdbe9 | 292 | uint8_t h : 1; |
Sergunb | 0:8918a71cdbe9 | 293 | uint8_t o : 1; |
Sergunb | 0:8918a71cdbe9 | 294 | uint8_t m : 1; |
Sergunb | 0:8918a71cdbe9 | 295 | #endif |
Sergunb | 0:8918a71cdbe9 | 296 | uint16_t routerLifetime; //6-7 |
Sergunb | 0:8918a71cdbe9 | 297 | uint32_t reachableTime; //8-11 |
Sergunb | 0:8918a71cdbe9 | 298 | uint32_t retransTimer; //12-15 |
Sergunb | 0:8918a71cdbe9 | 299 | uint8_t options[]; //16 |
Sergunb | 0:8918a71cdbe9 | 300 | } __end_packed NdpRouterAdvMessage; |
Sergunb | 0:8918a71cdbe9 | 301 | |
Sergunb | 0:8918a71cdbe9 | 302 | |
Sergunb | 0:8918a71cdbe9 | 303 | /** |
Sergunb | 0:8918a71cdbe9 | 304 | * @brief Neighbor Solicitation message |
Sergunb | 0:8918a71cdbe9 | 305 | **/ |
Sergunb | 0:8918a71cdbe9 | 306 | |
Sergunb | 0:8918a71cdbe9 | 307 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 308 | { |
Sergunb | 0:8918a71cdbe9 | 309 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 310 | uint8_t code; //1 |
Sergunb | 0:8918a71cdbe9 | 311 | uint16_t checksum; //2-3 |
Sergunb | 0:8918a71cdbe9 | 312 | uint32_t reserved; //4-7 |
Sergunb | 0:8918a71cdbe9 | 313 | Ipv6Addr targetAddr; //8-23 |
Sergunb | 0:8918a71cdbe9 | 314 | uint8_t options[]; //24 |
Sergunb | 0:8918a71cdbe9 | 315 | } __end_packed NdpNeighborSolMessage; |
Sergunb | 0:8918a71cdbe9 | 316 | |
Sergunb | 0:8918a71cdbe9 | 317 | |
Sergunb | 0:8918a71cdbe9 | 318 | /** |
Sergunb | 0:8918a71cdbe9 | 319 | * @brief Neighbor Advertisement message |
Sergunb | 0:8918a71cdbe9 | 320 | **/ |
Sergunb | 0:8918a71cdbe9 | 321 | |
Sergunb | 0:8918a71cdbe9 | 322 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 323 | { |
Sergunb | 0:8918a71cdbe9 | 324 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 325 | uint8_t code; //1 |
Sergunb | 0:8918a71cdbe9 | 326 | uint16_t checksum; //2-3 |
Sergunb | 0:8918a71cdbe9 | 327 | #ifdef _CPU_BIG_ENDIAN |
Sergunb | 0:8918a71cdbe9 | 328 | uint32_t r : 1; //4 |
Sergunb | 0:8918a71cdbe9 | 329 | uint32_t s : 1; |
Sergunb | 0:8918a71cdbe9 | 330 | uint32_t o : 1; |
Sergunb | 0:8918a71cdbe9 | 331 | uint32_t reserved1 : 5; |
Sergunb | 0:8918a71cdbe9 | 332 | uint32_t reserved2 : 24; //5-7 |
Sergunb | 0:8918a71cdbe9 | 333 | #else |
Sergunb | 0:8918a71cdbe9 | 334 | uint32_t reserved1 : 5; //4 |
Sergunb | 0:8918a71cdbe9 | 335 | uint32_t o : 1; |
Sergunb | 0:8918a71cdbe9 | 336 | uint32_t s : 1; |
Sergunb | 0:8918a71cdbe9 | 337 | uint32_t r : 1; |
Sergunb | 0:8918a71cdbe9 | 338 | uint32_t reserved2 : 24; //5-7 |
Sergunb | 0:8918a71cdbe9 | 339 | #endif |
Sergunb | 0:8918a71cdbe9 | 340 | Ipv6Addr targetAddr; //8-23 |
Sergunb | 0:8918a71cdbe9 | 341 | uint8_t options[]; //24 |
Sergunb | 0:8918a71cdbe9 | 342 | } __end_packed NdpNeighborAdvMessage; |
Sergunb | 0:8918a71cdbe9 | 343 | |
Sergunb | 0:8918a71cdbe9 | 344 | |
Sergunb | 0:8918a71cdbe9 | 345 | /** |
Sergunb | 0:8918a71cdbe9 | 346 | * @brief Redirect message |
Sergunb | 0:8918a71cdbe9 | 347 | **/ |
Sergunb | 0:8918a71cdbe9 | 348 | |
Sergunb | 0:8918a71cdbe9 | 349 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 350 | { |
Sergunb | 0:8918a71cdbe9 | 351 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 352 | uint8_t code; //1 |
Sergunb | 0:8918a71cdbe9 | 353 | uint16_t checksum; //2-3 |
Sergunb | 0:8918a71cdbe9 | 354 | uint32_t reserved; //4-7 |
Sergunb | 0:8918a71cdbe9 | 355 | Ipv6Addr targetAddr; //8-23 |
Sergunb | 0:8918a71cdbe9 | 356 | Ipv6Addr destAddr; //24-39 |
Sergunb | 0:8918a71cdbe9 | 357 | uint8_t options[]; //40 |
Sergunb | 0:8918a71cdbe9 | 358 | } __end_packed NdpRedirectMessage; |
Sergunb | 0:8918a71cdbe9 | 359 | |
Sergunb | 0:8918a71cdbe9 | 360 | |
Sergunb | 0:8918a71cdbe9 | 361 | /** |
Sergunb | 0:8918a71cdbe9 | 362 | * @brief Neighbor Discovery option general format |
Sergunb | 0:8918a71cdbe9 | 363 | **/ |
Sergunb | 0:8918a71cdbe9 | 364 | |
Sergunb | 0:8918a71cdbe9 | 365 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 366 | { |
Sergunb | 0:8918a71cdbe9 | 367 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 368 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 369 | uint8_t value[]; //2 |
Sergunb | 0:8918a71cdbe9 | 370 | } __end_packed NdpOption; |
Sergunb | 0:8918a71cdbe9 | 371 | |
Sergunb | 0:8918a71cdbe9 | 372 | |
Sergunb | 0:8918a71cdbe9 | 373 | /** |
Sergunb | 0:8918a71cdbe9 | 374 | * @brief Source/Target Link-Layer Address option |
Sergunb | 0:8918a71cdbe9 | 375 | **/ |
Sergunb | 0:8918a71cdbe9 | 376 | |
Sergunb | 0:8918a71cdbe9 | 377 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 378 | { |
Sergunb | 0:8918a71cdbe9 | 379 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 380 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 381 | MacAddr linkLayerAddr; //2-7 |
Sergunb | 0:8918a71cdbe9 | 382 | } __end_packed NdpLinkLayerAddrOption; |
Sergunb | 0:8918a71cdbe9 | 383 | |
Sergunb | 0:8918a71cdbe9 | 384 | |
Sergunb | 0:8918a71cdbe9 | 385 | /** |
Sergunb | 0:8918a71cdbe9 | 386 | * @brief Prefix Information option (PIO) |
Sergunb | 0:8918a71cdbe9 | 387 | **/ |
Sergunb | 0:8918a71cdbe9 | 388 | |
Sergunb | 0:8918a71cdbe9 | 389 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 390 | { |
Sergunb | 0:8918a71cdbe9 | 391 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 392 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 393 | uint8_t prefixLength; //2 |
Sergunb | 0:8918a71cdbe9 | 394 | #ifdef _CPU_BIG_ENDIAN |
Sergunb | 0:8918a71cdbe9 | 395 | uint8_t l : 1; //3 |
Sergunb | 0:8918a71cdbe9 | 396 | uint8_t a : 1; |
Sergunb | 0:8918a71cdbe9 | 397 | uint8_t reserved1 : 6; |
Sergunb | 0:8918a71cdbe9 | 398 | #else |
Sergunb | 0:8918a71cdbe9 | 399 | uint8_t reserved1 : 6; //3 |
Sergunb | 0:8918a71cdbe9 | 400 | uint8_t a : 1; |
Sergunb | 0:8918a71cdbe9 | 401 | uint8_t l : 1; |
Sergunb | 0:8918a71cdbe9 | 402 | #endif |
Sergunb | 0:8918a71cdbe9 | 403 | uint32_t validLifetime; //4-7 |
Sergunb | 0:8918a71cdbe9 | 404 | uint32_t preferredLifetime; //8-11 |
Sergunb | 0:8918a71cdbe9 | 405 | uint32_t reserved2; //12-15 |
Sergunb | 0:8918a71cdbe9 | 406 | Ipv6Addr prefix; //16-31 |
Sergunb | 0:8918a71cdbe9 | 407 | } __end_packed NdpPrefixInfoOption; |
Sergunb | 0:8918a71cdbe9 | 408 | |
Sergunb | 0:8918a71cdbe9 | 409 | |
Sergunb | 0:8918a71cdbe9 | 410 | /** |
Sergunb | 0:8918a71cdbe9 | 411 | * @brief Redirected Header option (RHO) |
Sergunb | 0:8918a71cdbe9 | 412 | **/ |
Sergunb | 0:8918a71cdbe9 | 413 | |
Sergunb | 0:8918a71cdbe9 | 414 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 415 | { |
Sergunb | 0:8918a71cdbe9 | 416 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 417 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 418 | uint16_t reserved1; //2-3 |
Sergunb | 0:8918a71cdbe9 | 419 | uint32_t reserved2; //4-7 |
Sergunb | 0:8918a71cdbe9 | 420 | uint8_t ipPacket[]; //8 |
Sergunb | 0:8918a71cdbe9 | 421 | } __end_packed NdpRedirectedHeaderOption; |
Sergunb | 0:8918a71cdbe9 | 422 | |
Sergunb | 0:8918a71cdbe9 | 423 | |
Sergunb | 0:8918a71cdbe9 | 424 | /** |
Sergunb | 0:8918a71cdbe9 | 425 | * @brief MTU option |
Sergunb | 0:8918a71cdbe9 | 426 | **/ |
Sergunb | 0:8918a71cdbe9 | 427 | |
Sergunb | 0:8918a71cdbe9 | 428 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 429 | { |
Sergunb | 0:8918a71cdbe9 | 430 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 431 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 432 | uint16_t reserved; //2-3 |
Sergunb | 0:8918a71cdbe9 | 433 | uint32_t mtu; //4-7 |
Sergunb | 0:8918a71cdbe9 | 434 | } __end_packed NdpMtuOption; |
Sergunb | 0:8918a71cdbe9 | 435 | |
Sergunb | 0:8918a71cdbe9 | 436 | |
Sergunb | 0:8918a71cdbe9 | 437 | /** |
Sergunb | 0:8918a71cdbe9 | 438 | * @brief Route Information option (RIO) |
Sergunb | 0:8918a71cdbe9 | 439 | **/ |
Sergunb | 0:8918a71cdbe9 | 440 | |
Sergunb | 0:8918a71cdbe9 | 441 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 442 | { |
Sergunb | 0:8918a71cdbe9 | 443 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 444 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 445 | uint8_t prefixLength; //2 |
Sergunb | 0:8918a71cdbe9 | 446 | #ifdef _CPU_BIG_ENDIAN |
Sergunb | 0:8918a71cdbe9 | 447 | uint8_t reserved1 : 3; //3 |
Sergunb | 0:8918a71cdbe9 | 448 | uint8_t prf : 2; |
Sergunb | 0:8918a71cdbe9 | 449 | uint8_t reserved2 : 3; |
Sergunb | 0:8918a71cdbe9 | 450 | #else |
Sergunb | 0:8918a71cdbe9 | 451 | uint8_t reserved2 : 3; //3 |
Sergunb | 0:8918a71cdbe9 | 452 | uint8_t prf : 2; |
Sergunb | 0:8918a71cdbe9 | 453 | uint8_t reserved1 : 3; |
Sergunb | 0:8918a71cdbe9 | 454 | #endif |
Sergunb | 0:8918a71cdbe9 | 455 | uint32_t routeLifetime; //4-7 |
Sergunb | 0:8918a71cdbe9 | 456 | Ipv6Addr prefix; //8 |
Sergunb | 0:8918a71cdbe9 | 457 | } __end_packed NdpRouteInfoOption; |
Sergunb | 0:8918a71cdbe9 | 458 | |
Sergunb | 0:8918a71cdbe9 | 459 | |
Sergunb | 0:8918a71cdbe9 | 460 | /** |
Sergunb | 0:8918a71cdbe9 | 461 | * @brief Recursive DNS Server option (RDNSS) |
Sergunb | 0:8918a71cdbe9 | 462 | **/ |
Sergunb | 0:8918a71cdbe9 | 463 | |
Sergunb | 0:8918a71cdbe9 | 464 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 465 | { |
Sergunb | 0:8918a71cdbe9 | 466 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 467 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 468 | uint16_t reserved; //2-3 |
Sergunb | 0:8918a71cdbe9 | 469 | uint32_t lifetime; //4-7 |
Sergunb | 0:8918a71cdbe9 | 470 | Ipv6Addr address[]; //8 |
Sergunb | 0:8918a71cdbe9 | 471 | } __end_packed NdpRdnssOption; |
Sergunb | 0:8918a71cdbe9 | 472 | |
Sergunb | 0:8918a71cdbe9 | 473 | |
Sergunb | 0:8918a71cdbe9 | 474 | /** |
Sergunb | 0:8918a71cdbe9 | 475 | * @brief DNS Search List option (DNSSL) |
Sergunb | 0:8918a71cdbe9 | 476 | **/ |
Sergunb | 0:8918a71cdbe9 | 477 | |
Sergunb | 0:8918a71cdbe9 | 478 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 479 | { |
Sergunb | 0:8918a71cdbe9 | 480 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 481 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 482 | uint16_t reserved; //2-3 |
Sergunb | 0:8918a71cdbe9 | 483 | uint32_t lifetime; //4-7 |
Sergunb | 0:8918a71cdbe9 | 484 | uint8_t domainNames[]; //8 |
Sergunb | 0:8918a71cdbe9 | 485 | } __end_packed NdpDnsslOption; |
Sergunb | 0:8918a71cdbe9 | 486 | |
Sergunb | 0:8918a71cdbe9 | 487 | |
Sergunb | 0:8918a71cdbe9 | 488 | /** |
Sergunb | 0:8918a71cdbe9 | 489 | * @brief 6LoWPAN Context option (6CO) |
Sergunb | 0:8918a71cdbe9 | 490 | **/ |
Sergunb | 0:8918a71cdbe9 | 491 | |
Sergunb | 0:8918a71cdbe9 | 492 | typedef __start_packed struct |
Sergunb | 0:8918a71cdbe9 | 493 | { |
Sergunb | 0:8918a71cdbe9 | 494 | uint8_t type; //0 |
Sergunb | 0:8918a71cdbe9 | 495 | uint8_t length; //1 |
Sergunb | 0:8918a71cdbe9 | 496 | uint8_t contextLength; //2 |
Sergunb | 0:8918a71cdbe9 | 497 | #ifdef _CPU_BIG_ENDIAN |
Sergunb | 0:8918a71cdbe9 | 498 | uint8_t reserved1 : 3; //3 |
Sergunb | 0:8918a71cdbe9 | 499 | uint8_t c : 1; |
Sergunb | 0:8918a71cdbe9 | 500 | uint8_t cid : 4; |
Sergunb | 0:8918a71cdbe9 | 501 | #else |
Sergunb | 0:8918a71cdbe9 | 502 | uint8_t cid : 4; //3 |
Sergunb | 0:8918a71cdbe9 | 503 | uint8_t c : 1; |
Sergunb | 0:8918a71cdbe9 | 504 | uint8_t reserved1 : 3; |
Sergunb | 0:8918a71cdbe9 | 505 | #endif |
Sergunb | 0:8918a71cdbe9 | 506 | uint16_t reserved2; //4-5 |
Sergunb | 0:8918a71cdbe9 | 507 | uint16_t validLifetime; //6-7 |
Sergunb | 0:8918a71cdbe9 | 508 | Ipv6Addr contextPrefix; //8 |
Sergunb | 0:8918a71cdbe9 | 509 | } __end_packed NdpContextOption; |
Sergunb | 0:8918a71cdbe9 | 510 | |
Sergunb | 0:8918a71cdbe9 | 511 | |
Sergunb | 0:8918a71cdbe9 | 512 | //CodeWarrior or Win32 compiler? |
Sergunb | 0:8918a71cdbe9 | 513 | #if defined(__CWCC__) || defined(_WIN32) |
Sergunb | 0:8918a71cdbe9 | 514 | #pragma pack(pop) |
Sergunb | 0:8918a71cdbe9 | 515 | #endif |
Sergunb | 0:8918a71cdbe9 | 516 | |
Sergunb | 0:8918a71cdbe9 | 517 | |
Sergunb | 0:8918a71cdbe9 | 518 | /** |
Sergunb | 0:8918a71cdbe9 | 519 | * @brief NDP queue item |
Sergunb | 0:8918a71cdbe9 | 520 | **/ |
Sergunb | 0:8918a71cdbe9 | 521 | |
Sergunb | 0:8918a71cdbe9 | 522 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 523 | { |
Sergunb | 0:8918a71cdbe9 | 524 | NetInterface *srcInterface; //<Interface from which the packet has been received |
Sergunb | 0:8918a71cdbe9 | 525 | NetBuffer *buffer; ///<Packet waiting for address resolution |
Sergunb | 0:8918a71cdbe9 | 526 | size_t offset; ///<Offset to the first byte of the packet |
Sergunb | 0:8918a71cdbe9 | 527 | } NdpQueueItem; |
Sergunb | 0:8918a71cdbe9 | 528 | |
Sergunb | 0:8918a71cdbe9 | 529 | |
Sergunb | 0:8918a71cdbe9 | 530 | /** |
Sergunb | 0:8918a71cdbe9 | 531 | * @brief Neighbor cache entry |
Sergunb | 0:8918a71cdbe9 | 532 | **/ |
Sergunb | 0:8918a71cdbe9 | 533 | |
Sergunb | 0:8918a71cdbe9 | 534 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 535 | { |
Sergunb | 0:8918a71cdbe9 | 536 | NdpState state; ///<Reachability state |
Sergunb | 0:8918a71cdbe9 | 537 | Ipv6Addr ipAddr; ///<Unicast IPv6 address |
Sergunb | 0:8918a71cdbe9 | 538 | MacAddr macAddr; ///<Link layer address associated with the IPv6 address |
Sergunb | 0:8918a71cdbe9 | 539 | bool_t isRouter; ///<A flag indicating whether the neighbor is a router or a host |
Sergunb | 0:8918a71cdbe9 | 540 | systime_t timestamp; ///<Timestamp to manage entry lifetime |
Sergunb | 0:8918a71cdbe9 | 541 | systime_t timeout; ///<Timeout value |
Sergunb | 0:8918a71cdbe9 | 542 | uint_t retransmitCount; ///<Retransmission counter |
Sergunb | 0:8918a71cdbe9 | 543 | NdpQueueItem queue[NDP_MAX_PENDING_PACKETS]; ///<Packets waiting for address resolution to complete |
Sergunb | 0:8918a71cdbe9 | 544 | uint_t queueSize; ///<Number of queued packets |
Sergunb | 0:8918a71cdbe9 | 545 | } NdpNeighborCacheEntry; |
Sergunb | 0:8918a71cdbe9 | 546 | |
Sergunb | 0:8918a71cdbe9 | 547 | |
Sergunb | 0:8918a71cdbe9 | 548 | /** |
Sergunb | 0:8918a71cdbe9 | 549 | * @brief Destination cache entry |
Sergunb | 0:8918a71cdbe9 | 550 | **/ |
Sergunb | 0:8918a71cdbe9 | 551 | |
Sergunb | 0:8918a71cdbe9 | 552 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 553 | { |
Sergunb | 0:8918a71cdbe9 | 554 | Ipv6Addr destAddr; ///<Destination IPv6 address |
Sergunb | 0:8918a71cdbe9 | 555 | Ipv6Addr nextHop; ///<IPv6 address of the next-hop neighbor |
Sergunb | 0:8918a71cdbe9 | 556 | size_t pathMtu; ///<Path MTU |
Sergunb | 0:8918a71cdbe9 | 557 | systime_t timestamp; ///<Timestamp to manage entry lifetime |
Sergunb | 0:8918a71cdbe9 | 558 | } NdpDestCacheEntry; |
Sergunb | 0:8918a71cdbe9 | 559 | |
Sergunb | 0:8918a71cdbe9 | 560 | |
Sergunb | 0:8918a71cdbe9 | 561 | /** |
Sergunb | 0:8918a71cdbe9 | 562 | * @brief NDP context |
Sergunb | 0:8918a71cdbe9 | 563 | **/ |
Sergunb | 0:8918a71cdbe9 | 564 | |
Sergunb | 0:8918a71cdbe9 | 565 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 566 | { |
Sergunb | 0:8918a71cdbe9 | 567 | uint32_t reachableTime; ///<The time a node assumes a neighbor is reachable |
Sergunb | 0:8918a71cdbe9 | 568 | uint32_t retransTimer; ///<The time between retransmissions of NS messages |
Sergunb | 0:8918a71cdbe9 | 569 | uint_t dupAddrDetectTransmits; ///<Maximum number of NS messages sent while performing DAD |
Sergunb | 0:8918a71cdbe9 | 570 | systime_t minRtrSolicitationDelay; ///<Minimum delay before transmitting the first RS message |
Sergunb | 0:8918a71cdbe9 | 571 | systime_t maxRtrSolicitationDelay; ///<Maximum delay before transmitting the first RS message |
Sergunb | 0:8918a71cdbe9 | 572 | systime_t rtrSolicitationInterval; ///<Time interval between retransmissions of RS messages |
Sergunb | 0:8918a71cdbe9 | 573 | uint_t maxRtrSolicitations; ///<Number of retransmissions for RS messages |
Sergunb | 0:8918a71cdbe9 | 574 | uint_t rtrSolicitationCount; ///<Retransmission counter for RS messages |
Sergunb | 0:8918a71cdbe9 | 575 | bool_t rtrAdvReceived; ///<Valid RA message received |
Sergunb | 0:8918a71cdbe9 | 576 | systime_t timestamp; ///<Timestamp to manage retransmissions |
Sergunb | 0:8918a71cdbe9 | 577 | systime_t timeout; ///<Timeout value |
Sergunb | 0:8918a71cdbe9 | 578 | NdpNeighborCacheEntry neighborCache[NDP_NEIGHBOR_CACHE_SIZE]; ///<Neighbor cache |
Sergunb | 0:8918a71cdbe9 | 579 | NdpDestCacheEntry destCache[NDP_DEST_CACHE_SIZE]; ///<Destination cache |
Sergunb | 0:8918a71cdbe9 | 580 | } NdpContext; |
Sergunb | 0:8918a71cdbe9 | 581 | |
Sergunb | 0:8918a71cdbe9 | 582 | |
Sergunb | 0:8918a71cdbe9 | 583 | //Tick counter to handle periodic operations |
Sergunb | 0:8918a71cdbe9 | 584 | extern systime_t ndpTickCounter; |
Sergunb | 0:8918a71cdbe9 | 585 | |
Sergunb | 0:8918a71cdbe9 | 586 | //NDP related functions |
Sergunb | 0:8918a71cdbe9 | 587 | error_t ndpInit(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 588 | |
Sergunb | 0:8918a71cdbe9 | 589 | error_t ndpResolve(NetInterface *interface, const Ipv6Addr *ipAddr, MacAddr *macAddr); |
Sergunb | 0:8918a71cdbe9 | 590 | |
Sergunb | 0:8918a71cdbe9 | 591 | error_t ndpEnqueuePacket(NetInterface *srcInterface, NetInterface *destInterface, |
Sergunb | 0:8918a71cdbe9 | 592 | const Ipv6Addr *ipAddr, NetBuffer *buffer, size_t offset); |
Sergunb | 0:8918a71cdbe9 | 593 | |
Sergunb | 0:8918a71cdbe9 | 594 | void ndpTick(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 595 | void ndpLinkChangeEvent(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 596 | |
Sergunb | 0:8918a71cdbe9 | 597 | void ndpProcessRouterAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, |
Sergunb | 0:8918a71cdbe9 | 598 | const NetBuffer *buffer, size_t offset, uint8_t hopLimit); |
Sergunb | 0:8918a71cdbe9 | 599 | |
Sergunb | 0:8918a71cdbe9 | 600 | void ndpProcessNeighborSol(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, |
Sergunb | 0:8918a71cdbe9 | 601 | const NetBuffer *buffer, size_t offset, uint8_t hopLimit); |
Sergunb | 0:8918a71cdbe9 | 602 | |
Sergunb | 0:8918a71cdbe9 | 603 | void ndpProcessNeighborAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, |
Sergunb | 0:8918a71cdbe9 | 604 | const NetBuffer *buffer, size_t offset, uint8_t hopLimit); |
Sergunb | 0:8918a71cdbe9 | 605 | |
Sergunb | 0:8918a71cdbe9 | 606 | void ndpProcessRedirect(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, |
Sergunb | 0:8918a71cdbe9 | 607 | const NetBuffer *buffer, size_t offset, uint8_t hopLimit); |
Sergunb | 0:8918a71cdbe9 | 608 | |
Sergunb | 0:8918a71cdbe9 | 609 | error_t ndpSendRouterSol(NetInterface *interface); |
Sergunb | 0:8918a71cdbe9 | 610 | |
Sergunb | 0:8918a71cdbe9 | 611 | error_t ndpSendNeighborSol(NetInterface *interface, |
Sergunb | 0:8918a71cdbe9 | 612 | const Ipv6Addr *targetIpAddr, bool_t multicast); |
Sergunb | 0:8918a71cdbe9 | 613 | |
Sergunb | 0:8918a71cdbe9 | 614 | error_t ndpSendNeighborAdv(NetInterface *interface, |
Sergunb | 0:8918a71cdbe9 | 615 | const Ipv6Addr *targetIpAddr, const Ipv6Addr *destIpAddr); |
Sergunb | 0:8918a71cdbe9 | 616 | |
Sergunb | 0:8918a71cdbe9 | 617 | error_t ndpSendRedirect(NetInterface *interface, const Ipv6Addr *targetAddr, |
Sergunb | 0:8918a71cdbe9 | 618 | const NetBuffer *ipPacket, size_t ipPacketOffset); |
Sergunb | 0:8918a71cdbe9 | 619 | |
Sergunb | 0:8918a71cdbe9 | 620 | void ndpDumpRouterSolMessage(const NdpRouterSolMessage *message); |
Sergunb | 0:8918a71cdbe9 | 621 | void ndpDumpRouterAdvMessage(const NdpRouterAdvMessage *message); |
Sergunb | 0:8918a71cdbe9 | 622 | void ndpDumpNeighborSolMessage(const NdpNeighborSolMessage *message); |
Sergunb | 0:8918a71cdbe9 | 623 | void ndpDumpNeighborAdvMessage(const NdpNeighborAdvMessage *message); |
Sergunb | 0:8918a71cdbe9 | 624 | void ndpDumpRedirectMessage(const NdpRedirectMessage *message); |
Sergunb | 0:8918a71cdbe9 | 625 | |
Sergunb | 0:8918a71cdbe9 | 626 | #endif |
Sergunb | 0:8918a71cdbe9 | 627 |