31#ifndef _DHCPV6_CLIENT_H
32#define _DHCPV6_CLIENT_H
39#ifndef DHCPV6_CLIENT_SUPPORT
40 #define DHCPV6_CLIENT_SUPPORT DISABLED
41#elif (DHCPV6_CLIENT_SUPPORT != ENABLED && DHCPV6_CLIENT_SUPPORT != DISABLED)
42 #error DHCPV6_CLIENT_SUPPORT parameter is not valid
46#ifndef DHCPV6_CLIENT_TICK_INTERVAL
47 #define DHCPV6_CLIENT_TICK_INTERVAL 200
48#elif (DHCPV6_CLIENT_TICK_INTERVAL < 10)
49 #error DHCPV6_CLIENT_TICK_INTERVAL parameter is not valid
53#ifndef DHCPV6_CLIENT_ADDR_LIST_SIZE
54 #define DHCPV6_CLIENT_ADDR_LIST_SIZE 2
55#elif (DHCPV6_CLIENT_ADDR_LIST_SIZE < 1)
56 #error DHCPV6_CLIENT_ADDR_LIST_SIZE parameter is not valid
60#ifndef DHCPV6_CLIENT_SOL_MAX_DELAY
61 #define DHCPV6_CLIENT_SOL_MAX_DELAY 1000
62#elif (DHCPV6_CLIENT_SOL_MAX_DELAY < 100)
63 #error DHCPV6_CLIENT_SOL_MAX_DELAY parameter is not valid
67#ifndef DHCPV6_CLIENT_SOL_TIMEOUT
68 #define DHCPV6_CLIENT_SOL_TIMEOUT 1000
69#elif (DHCPV6_CLIENT_SOL_TIMEOUT < 100)
70 #error DHCPV6_CLIENT_SOL_TIMEOUT parameter is not valid
74#ifndef DHCPV6_CLIENT_SOL_MAX_RT
75 #define DHCPV6_CLIENT_SOL_MAX_RT 120000
76#elif (DHCPV6_CLIENT_SOL_MAX_RT < 100)
77 #error DHCPV6_CLIENT_SOL_MAX_RT parameter is not valid
81#ifndef DHCPV6_CLIENT_REQ_TIMEOUT
82 #define DHCPV6_CLIENT_REQ_TIMEOUT 1000
83#elif (DHCPV6_CLIENT_REQ_TIMEOUT < 100)
84 #error DHCPV6_CLIENT_REQ_TIMEOUT parameter is not valid
88#ifndef DHCPV6_CLIENT_REQ_MAX_RT
89 #define DHCPV6_CLIENT_REQ_MAX_RT 30000
90#elif (DHCPV6_CLIENT_REQ_MAX_RT < 100)
91 #error DHCPV6_CLIENT_REQ_MAX_RT parameter is not valid
95#ifndef DHCPV6_CLIENT_REQ_MAX_RC
96 #define DHCPV6_CLIENT_REQ_MAX_RC 10
97#elif (DHCPV6_CLIENT_REQ_MAX_RC < 1)
98 #error DHCPV6_CLIENT_REQ_MAX_RC parameter is not valid
102#ifndef DHCPV6_CLIENT_CNF_MAX_DELAY
103 #define DHCPV6_CLIENT_CNF_MAX_DELAY 1000
104#elif (DHCPV6_CLIENT_CNF_MAX_DELAY < 100)
105 #error DHCPV6_CLIENT_CNF_MAX_DELAY parameter is not valid
109#ifndef DHCPV6_CLIENT_CNF_TIMEOUT
110 #define DHCPV6_CLIENT_CNF_TIMEOUT 1000
111#elif (DHCPV6_CLIENT_CNF_TIMEOUT < 100)
112 #error DHCPV6_CLIENT_CNF_TIMEOUT parameter is not valid
116#ifndef DHCPV6_CLIENT_CNF_MAX_RT
117 #define DHCPV6_CLIENT_CNF_MAX_RT 4000
118#elif (DHCPV6_CLIENT_CNF_MAX_RT < 100)
119 #error DHCPV6_CLIENT_CNF_MAX_RT parameter is not valid
123#ifndef DHCPV6_CLIENT_CNF_MAX_RD
124 #define DHCPV6_CLIENT_CNF_MAX_RD 10000
125#elif (DHCPV6_CLIENT_CNF_MAX_RD < 100)
126 #error DHCPV6_CLIENT_CNF_MAX_RD parameter is not valid
130#ifndef DHCPV6_CLIENT_REN_TIMEOUT
131 #define DHCPV6_CLIENT_REN_TIMEOUT 10000
132#elif (DHCPV6_CLIENT_REN_TIMEOUT < 100)
133 #error DHCPV6_CLIENT_REN_TIMEOUT parameter is not valid
137#ifndef DHCPV6_CLIENT_REN_MAX_RT
138 #define DHCPV6_CLIENT_REN_MAX_RT 600000
139#elif (DHCPV6_CLIENT_REN_MAX_RT < 100)
140 #error DHCPV6_CLIENT_REN_MAX_RT parameter is not valid
144#ifndef DHCPV6_CLIENT_REB_TIMEOUT
145 #define DHCPV6_CLIENT_REB_TIMEOUT 10000
146#elif (DHCPV6_CLIENT_REB_TIMEOUT < 100)
147 #error DHCPV6_CLIENT_REB_TIMEOUT parameter is not valid
151#ifndef DHCPV6_CLIENT_REB_MAX_RT
152 #define DHCPV6_CLIENT_REB_MAX_RT 600000
153#elif (DHCPV6_CLIENT_REB_MAX_RT < 100)
154 #error DHCPV6_CLIENT_REB_MAX_RT parameter is not valid
158#ifndef DHCPV6_CLIENT_INF_MAX_DELAY
159 #define DHCPV6_CLIENT_INF_MAX_DELAY 1000
160#elif (DHCPV6_CLIENT_INF_MAX_DELAY < 100)
161 #error DHCPV6_CLIENT_INF_MAX_DELAY parameter is not valid
165#ifndef DHCPV6_CLIENT_INF_TIMEOUT
166 #define DHCPV6_CLIENT_INF_TIMEOUT 1000
167#elif (DHCPV6_CLIENT_INF_TIMEOUT < 100)
168 #error DHCPV6_CLIENT_INF_TIMEOUT parameter is not valid
172#ifndef DHCPV6_CLIENT_INF_MAX_RT
173 #define DHCPV6_CLIENT_INF_MAX_RT 120000
174#elif (DHCPV6_CLIENT_INF_MAX_RT < 1000)
175 #error DHCPV6_CLIENT_INF_MAX_RT parameter is not valid
179#ifndef DHCPV6_CLIENT_REL_TIMEOUT
180 #define DHCPV6_CLIENT_REL_TIMEOUT 1000
181#elif (DHCPV6_CLIENT_REL_TIMEOUT < 100)
182 #error DHCPV6_CLIENT_REL_TIMEOUT parameter is not valid
186#ifndef DHCPV6_CLIENT_REL_MAX_RC
187 #define DHCPV6_CLIENT_REL_MAX_RC 5
188#elif (DHCPV6_CLIENT_REL_MAX_RC < 1)
189 #error DHCPV6_CLIENT_REL_MAX_RC parameter is not valid
193#ifndef DHCPV6_CLIENT_DEC_TIMEOUT
194 #define DHCPV6_CLIENT_DEC_TIMEOUT 1000
195#elif (DHCPV6_CLIENT_DEC_TIMEOUT < 100)
196 #error DHCPV6_CLIENT_DEC_TIMEOUT parameter is not valid
200#ifndef DHCPV6_CLIENT_DEC_MAX_RC
201 #define DHCPV6_CLIENT_DEC_MAX_RC 5
202#elif (DHCPV6_CLIENT_DEC_MAX_RC < 1)
203 #error DHCPV6_CLIENT_DEC_MAX_RC parameter is not valid
207#ifndef DHCPV6_CLIENT_REC_TIMEOUT
208 #define DHCPV6_CLIENT_REC_TIMEOUT 2000
209#elif (DHCPV6_CLIENT_REC_TIMEOUT < 100)
210 #error DHCPV6_CLIENT_REC_TIMEOUT parameter is not valid
214#ifndef DHCPV6_CLIENT_REC_MAX_RC
215 #define DHCPV6_CLIENT_REC_MAX_RC 8
216#elif (DHCPV6_CLIENT_REC_MAX_RC < 1)
217 #error DHCPV6_CLIENT_REC_MAX_RC parameter is not valid
221#ifndef DHCPV6_CLIENT_PRIVATE_CONTEXT
222 #define DHCPV6_CLIENT_PRIVATE_CONTEXT
227#define Dhcpv6ClientContext struct _Dhcpv6ClientContext
241 DHCPV6_STATE_INIT = 0,
242 DHCPV6_STATE_SOLICIT = 1,
243 DHCPV6_STATE_REQUEST = 2,
244 DHCPV6_STATE_INIT_CONFIRM = 3,
245 DHCPV6_STATE_CONFIRM = 4,
246 DHCPV6_STATE_DAD = 5,
247 DHCPV6_STATE_BOUND = 6,
248 DHCPV6_STATE_RENEW = 7,
249 DHCPV6_STATE_REBIND = 8,
250 DHCPV6_STATE_RELEASE = 9,
251 DHCPV6_STATE_DECLINE = 10
260 NetInterface *interface);
268 NetInterface *interface, bool_t linkState);
284 Dhcpv6Message *message,
size_t *length);
292 const Dhcpv6Message *message,
size_t length);
360 DHCPV6_CLIENT_PRIVATE_CONTEXT
367error_t dhcpv6ClientInit(Dhcpv6ClientContext *context,
370error_t dhcpv6ClientStart(Dhcpv6ClientContext *context);
371error_t dhcpv6ClientStop(Dhcpv6ClientContext *context);
373error_t dhcpv6ClientRelease(Dhcpv6ClientContext *context);
374Dhcpv6State dhcpv6ClientGetState(Dhcpv6ClientContext *context);
void(* Dhcpv6StateChangeCallback)(Dhcpv6ClientContext *context, NetInterface *interface, Dhcpv6State state)
FSM state change callback.
Definition dhcpv6_client.h:275
Dhcpv6State
DHCPv6 client FSM states.
Definition dhcpv6_client.h:240
void(* Dhcpv6AddOptionsCallback)(Dhcpv6ClientContext *context, Dhcpv6Message *message, size_t *length)
Add DHCPv6 options callback.
Definition dhcpv6_client.h:283
void(* Dhcpv6ParseOptionsCallback)(Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
Parse DHCPv6 options callback.
Definition dhcpv6_client.h:291
void(* Dhcpv6LinkChangeCallback)(Dhcpv6ClientContext *context, NetInterface *interface, bool_t linkState)
Link state change callback.
Definition dhcpv6_client.h:267
void(* Dhcpv6TimeoutCallback)(Dhcpv6ClientContext *context, NetInterface *interface)
DHCPv6 configuration timeout callback.
Definition dhcpv6_client.h:259
Definitions common to DHCPv6 client, server and relay agent.
error_t
Error codes.
Definition error.h:43
uint32_t systime_t
System time.
Definition os_port_none.h:90
IA address entry.
Definition dhcpv6_client.h:318
uint32_t preferredLifetime
Preferred lifetime.
Definition dhcpv6_client.h:321
Ipv6Addr addr
IPv6 address.
Definition dhcpv6_client.h:319
uint32_t validLifetime
Valid lifetime.
Definition dhcpv6_client.h:320
Client's IA (Identity Association)
Definition dhcpv6_client.h:330
uint32_t t1
T1 parameter.
Definition dhcpv6_client.h:331
uint32_t t2
T2 parameter.
Definition dhcpv6_client.h:332
DHCPv6 client settings.
Definition dhcpv6_client.h:300
Dhcpv6AddOptionsCallback addOptionsCallback
Add DHCPv6 options callback.
Definition dhcpv6_client.h:308
bool_t manualDnsConfig
Force manual DNS configuration.
Definition dhcpv6_client.h:303
systime_t timeout
DHCPv6 configuration timeout.
Definition dhcpv6_client.h:304
Dhcpv6ParseOptionsCallback parseOptionsCallback
Parse DHCPv6 options callback.
Definition dhcpv6_client.h:309
Dhcpv6LinkChangeCallback linkChangeEvent
Link state change event.
Definition dhcpv6_client.h:306
Dhcpv6TimeoutCallback timeoutEvent
DHCPv6 configuration timeout event.
Definition dhcpv6_client.h:305
NetInterface * interface
Network interface to configure.
Definition dhcpv6_client.h:301
bool_t rapidCommit
Quick configuration using rapid commit.
Definition dhcpv6_client.h:302
Dhcpv6StateChangeCallback stateChangeEvent
FSM state change event.
Definition dhcpv6_client.h:307
DHCPv6 client context.
Definition dhcpv6_client.h:342
Dhcpv6State state
Current state of the FSM.
Definition dhcpv6_client.h:345
systime_t timestamp
Timestamp to manage retransmissions.
Definition dhcpv6_client.h:347
uint8_t serverId[DHCPV6_MAX_DUID_SIZE]
Server DUID.
Definition dhcpv6_client.h:352
size_t serverIdLen
Length of the server DUID.
Definition dhcpv6_client.h:353
size_t clientIdLen
Length of the client DUID.
Definition dhcpv6_client.h:351
bool_t timeoutEventDone
Timeout callback function has been called.
Definition dhcpv6_client.h:346
uint8_t clientId[DHCPV6_MAX_DUID_SIZE]
Client DUID.
Definition dhcpv6_client.h:350
Dhcpv6ClientIa ia
Identity association.
Definition dhcpv6_client.h:359
systime_t timeout
Timeout value.
Definition dhcpv6_client.h:348
systime_t leaseStartTime
Lease start time.
Definition dhcpv6_client.h:358
systime_t exchangeStartTime
Time at which the client sent the first message.
Definition dhcpv6_client.h:357
bool_t running
This flag tells whether the DHCP client is running or not.
Definition dhcpv6_client.h:344
Dhcpv6ClientSettings settings
DHCPv6 client settings.
Definition dhcpv6_client.h:343
uint_t retransmitCount
Retransmission counter.
Definition dhcpv6_client.h:349
int_t serverPreference
Preference value for the server.
Definition dhcpv6_client.h:354
uint32_t transactionId
Value to match requests with replies.
Definition dhcpv6_client.h:355
systime_t configStartTime
Address acquisition or renewal process start time.
Definition dhcpv6_client.h:356