ndp_router_adv.h
Go to the documentation of this file.
1 /**
2  * @file ndp_router_adv.h
3  * @brief Router advertisement service
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2023 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.2.4
29  **/
30 
31 #ifndef _NDP_ROUTER_ADV_H
32 #define _NDP_ROUTER_ADV_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ipv6/ipv6.h"
37 
38 //RA service support
39 #ifndef NDP_ROUTER_ADV_SUPPORT
40  #define NDP_ROUTER_ADV_SUPPORT DISABLED
41 #elif (NDP_ROUTER_ADV_SUPPORT != ENABLED && NDP_ROUTER_ADV_SUPPORT != DISABLED)
42  #error NDP_ROUTER_ADV_SUPPORT parameter is not valid
43 #endif
44 
45 //RA service tick interval
46 #ifndef NDP_ROUTER_ADV_TICK_INTERVAL
47  #define NDP_ROUTER_ADV_TICK_INTERVAL 100
48 #elif (NDP_ROUTER_ADV_TICK_INTERVAL < 10)
49  #error NDP_ROUTER_ADV_TICK_INTERVAL parameter is not valid
50 #endif
51 
52 //C++ guard
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 
58 /**
59  * @brief IPv6 prefix information
60  **/
61 
62 typedef struct
63 {
65  uint8_t length;
68  uint32_t validLifetime;
71 
72 
73 /**
74  * @brief Route information
75  **/
76 
77 typedef struct
78 {
80  uint8_t length;
81  uint8_t preference;
82  uint32_t routeLifetime;
84 
85 
86 /**
87  * @brief Context information for 6LoWPAN header compression
88  **/
89 
90 typedef struct
91 {
92  uint8_t cid;
94  uint8_t length;
96  uint16_t validLifetime;
98 
99 
100 /**
101  * @brief RA service settings
102  **/
103 
104 typedef struct
105 {
109  uint8_t curHopLimit;
113  uint8_t preference;
115  uint16_t defaultLifetime;
116  uint32_t reachableTime;
117  uint32_t retransTimer;
118  uint32_t linkMtu;
126 
127 
128 /**
129  * @brief RA service context
130  **/
131 
132 typedef struct
133 {
134  NdpRouterAdvSettings settings; ///<RA service settings
135  bool_t running; ///<This flag tells whether the RA service is running
136  systime_t timestamp; ///<Timestamp to manage retransmissions
137  systime_t timeout; ///<Timeout value
138  uint_t routerAdvCount; ///<Router Advertisement message counter
140 
141 
142 //Tick counter to handle periodic operations
144 
145 //RA service related functions
147 
149  const NdpRouterAdvSettings *settings);
150 
153 
154 //C++ guard
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif
IPv6 (Internet Protocol Version 6)
int bool_t
Definition: compiler_port.h:53
NdpRouterAdvSettings settings
RA service settings.
systime_t timestamp
Timestamp to manage retransmissions.
bool_t running
This flag tells whether the RA service is running.
uint_t routerAdvCount
Router Advertisement message counter.
error_t ndpRouterAdvStop(NdpRouterAdvContext *context)
Stop RA service.
void ndpRouterAdvGetDefaultSettings(NdpRouterAdvSettings *settings)
Initialize settings with default values.
IPv6 prefix information.
NdpRouterAdvRouteInfo * routeList
Route information.
error_t
Error codes.
Definition: error.h:43
#define NetInterface
Definition: net.h:36
error_t ndpRouterAdvStart(NdpRouterAdvContext *context)
Start RA service.
NdpRouterAdvContextInfo * contextList
Context information for 6LoWPAN header compression.
uint32_t systime_t
System time.
RA service context.
RA service settings.
NetInterface * interface
error_t ndpRouterAdvInit(NdpRouterAdvContext *context, const NdpRouterAdvSettings *settings)
RA service initialization.
systime_t timeout
Timeout value.
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
__start_packed struct @0 Ipv6Addr
IPv6 network address.
systime_t ndpRouterAdvTickCounter
NdpRouterAdvPrefixInfo * prefixList