1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** NetX Component                                                        */
17 /**                                                                       */
18 /**   Dynamic Host Configuration Protocol over IPv6 (DHCPv6)              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
27 /*                                                                        */
28 /*    nxd_dhcpv6_client.h                                 PORTABLE C      */
29 /*                                                           6.1.12       */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Yuxin Zhou, Microsoft Corporation                                   */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the NetX Dynamic Host Configuration Protocol over */
37 /*    IPv6 (DHCPv6) component, including all data types and external      */
38 /*    references. It is assumed that nx_api.h and nx_port.h have already  */
39 /*    been included.                                                      */
40 /*                                                                        */
41 /*  RELEASE HISTORY                                                       */
42 /*                                                                        */
43 /*    DATE              NAME                      DESCRIPTION             */
44 /*                                                                        */
45 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
46 /*  09-30-2020     Yuxin Zhou               Modified comment(s), improved */
47 /*                                            packet length verification, */
48 /*                                            resulting in version 6.1    */
49 /*  10-15-2021     Yuxin Zhou               Modified comment(s), included */
50 /*                                            necessary header file,      */
51 /*                                            resulting in version 6.1.9  */
52 /*  07-29-2022     Yuxin Zhou               Modified comment(s), supported*/
53 /*                                            adding user options,        */
54 /*                                            resulting in version 6.1.12 */
55 /*                                                                        */
56 /**************************************************************************/
57 
58 #ifndef NXD_DHCPV6_CLIENT_H
59 #define NXD_DHCPV6_CLIENT_H
60 
61 /* Determine if a C++ compiler is being used.  If so, ensure that standard
62    C is used to process the API information.  */
63 
64 #ifdef   __cplusplus
65 
66 /* Yes, C++ compiler is present.  Use standard C.  */
67 extern   "C" {
68 
69 #endif
70 
71 #include "nx_api.h"
72 
73 /*  Enable support for DHCPv6 client state preserved between reboots  */
74 /*
75 #define NX_DHCPV6_CLIENT_RESTORE_STATE
76 */
77 
78 
79 /* Define the DHCPv6 ID "DHCPV6" that is used to mark the DHCPv6 structure as created.  */
80 
81 #define NX_DHCPV6_ID                                    0x44484336UL
82 
83 
84 /* Set the Client lease time. An infinate lease time is not recommended by the RFC
85    unless the Client requires a permanent IP address.  Most servers will likely not
86    grant an infinite IP address lease. */
87 
88 #define NX_DHCPV6_INFINITE_LEASE                        0xffffffffUL
89 #define NX_DHCPV6_MULTICAST_MASK                        0xff000000UL
90 
91 typedef enum
92 {
93     NX_DHCPV6_DUID_TYPE_LINK_TIME =                     1,
94     NX_DHCPV6_DUID_TYPE_VENDOR_ASSIGNED,
95     NX_DHCPV6_DUID_TYPE_LINK_ONLY
96 
97 } NX_DHCPV6_DUID_TYPE;
98 
99 
100 /* Define the Hardware types.  */
101 #define NX_DHCPV6_CLIENT_HARDWARE_TYPE_ETHERNET         1
102 #define NX_DHCPV6_CLIENT_HARDWARE_TYPE_EUI_64           27
103 
104 /* NX_DHCPV6_HW_TYPE_IEEE_802 is defined as 1 to indicate Ethernet hardware type in old releases, for backward compatibility.
105 
106    Note: NX_DHCPV6_HW_TYPE_IEEE_802 will be deprecated by NX_DHCPV6_CLIENT_HARDWARE_TYPE_ETHERNET
107          in future releases, should use above symbols to define hardware types.
108 */
109 #define NX_DHCPV6_HW_TYPE_IEEE_802                      1
110 
111 
112 /* Define approximate time since Jan 1, 2000 for computing DUID time. This will form the
113    basis for the DUID time ID field.  */
114 
115 #define SECONDS_SINCE_JAN_1_2000_MOD_32                 2563729999UL
116 
117 /* Define the value for IA address.  */
118 
119 #define NX_DHCPV6_REMOVE_ALL_IA_ADDRESS                 0xFFFFFFFF
120 
121 /* Define the DHCPv6 Message Types.  */
122 
123 #define NX_DHCPV6_MESSAGE_TYPE_SOLICIT                  1
124 #define NX_DHCPV6_MESSAGE_TYPE_ADVERTISE                2
125 #define NX_DHCPV6_MESSAGE_TYPE_REQUEST                  3
126 #define NX_DHCPV6_MESSAGE_TYPE_CONFIRM                  4
127 #define NX_DHCPV6_MESSAGE_TYPE_RENEW                    5
128 #define NX_DHCPV6_MESSAGE_TYPE_REBIND                   6
129 #define NX_DHCPV6_MESSAGE_TYPE_REPLY                    7
130 #define NX_DHCPV6_MESSAGE_TYPE_RELEASE                  8
131 #define NX_DHCPV6_MESSAGE_TYPE_DECLINE                  9
132 #define NX_DHCPV6_MESSAGE_TYPE_RECONFIGURE              10
133 #define NX_DHCPV6_MESSAGE_TYPE_INFORM_REQUEST           11
134 
135 /* Define the DHCPv6 Options, RFC3315, RFC 3646 and RFC 4242,etc.  */
136 
137 #define NX_DHCPV6_OP_CLIENT_ID                          1         /* Client DUID (DHCP unique identifier) */
138 #define NX_DHCPV6_OP_SERVER_ID                          2         /* Server DUID (DHCP unique identifier) */
139 #define NX_DHCPV6_OP_IA_NA                              3         /* Identity association for non temporary addresses */
140 #define NX_DHCPV6_OP_IA_TA                              4         /* Identity association for temporary addresses */
141 #define NX_DHCPV6_OP_IA_ADDRESS                         5         /* Address associated with IA_NA or IA_TA */
142 #define NX_DHCPV6_OP_OPTION_REQUEST                     6         /* Identifies a list of options */
143 #define NX_DHCPV6_OP_PREFERENCE                         7         /* Server's means of affecting Client choice of servers. */
144 #define NX_DHCPV6_OP_ELAPSED_TIME                       8         /* Duration of Client exchange with DHCPv6 server  */
145 #define NX_DHCPV6_OP_RELAY_MESSAGE                      9         /* Not in use in NetX DHCPV6 */
146 #define NX_DHCPV6_OP_AUTHENTICATION                     11        /* Not in use in NetX DHCPV6 */
147 #define NX_DHCPV6_OP_SERVER_UNICAST                     12        /* Server ok's allowing the client to address it in Unicast */
148 #define NX_DHCPV6_OP_STATUS_CODE                        13        /* Status option.  */
149 #define NX_DHCPV6_OP_RAPID_COMMIT                       14        /* Rapid commit option.  */
150 #define NX_DHCPV6_OP_USER_CLASS                         15        /* User calss option.  */
151 #define NX_DHCPV6_OP_VENDOR_CLASS                       16        /* Vendor Class option.  */
152 #define NX_DHCPV6_OP_VENDOR_SPEC_INFO                   17        /* Vendor specific information option.  */
153 #define NX_DHCPV6_OP_INTERFACE_ID                       18        /* Interface ID option.  */
154 #define NX_DHCPV6_OP_RCONF_MESSAGE                      19        /* Reconfigure message option.  */
155 #define NX_DHCPV6_OP_RCONF_ACCEPT                       20        /* Reconfigure accept option.  */
156 
157 #define NX_DHCPV6_OP_DNS_SERVER                         23        /* Dns servers option.  */
158 #define NX_DHCPV6_OP_DOMAIN_NAME                        24        /* Domain names list option.  */
159 
160 #define NX_DHCPV6_OP_SNTP_SERVER                        31        /* Network time protocol servers option.  */
161 #define NX_DHCPV6_OP_CLIENT_FQDN                        39        /* Client Fully Qualified Domain Name Option.  */
162 #define NX_DHCPV6_OP_NEW_POSIX_TIMEZONE                 41        /* New timezone POSIX string index option.  */
163 #define NX_DHCPV6_OP_NEW_TZDB_TIMEZONE                  42        /* New timezone database string option.  */
164 
165 /* Define the Error Status Code Location.  */
166 #define NX_DHCPV6_ERROR_STATUS_CODE_IN_OPTION_FIELD     0         /* An Error Status Code option appears in options field of DHCP message.  */
167 #define NX_DHCPV6_ERROR_STATUS_CODE_IN_IA_NA            1         /* An Error Status Code option appears in options field of IA_NA option.  */
168 #define NX_DHCPV6_ERROR_STATUS_CODE_IN_IA_ADDRESS       2         /* An Error Status Code option appears in options field of IA_ADDRESS option .  */
169 
170 /* Define the options included in the reply message.  */
171 
172 #define NX_DHCPV6_INCLUDE_CLIENT_ID_OPTION              0x00000001    /* The reply message includes a Client Identifier option. */
173 #define NX_DHCPV6_INCLUDE_SERVER_ID_OPTION              0x00000002    /* The reply message includes a Server Identifier option. */
174 #define NX_DHCPV6_INCLUDE_IA_NA_OPTION                  0x00000004    /* The reply message includes a IA_NA option. */
175 #define NX_DHCPV6_INCLUDE_IA_ADDRESS_OPTION             0x00000008    /* The reply message includes a IA address option. */
176 #define NX_DHCPV6_INCLUDE_OPTION_REQUEST_OPTION         0x00000010    /* The reply message includes a option request option. */
177 #define NX_DHCPV6_INCLUDE_PREFERENCE_OPTION             0x00000020    /* The reply message includes a preference option. */
178 #define NX_DHCPV6_INCLUDE_ELAPSED_TIME_OPTION           0x00000040    /* The reply message includes a elapsed time option. */
179 #define NX_DHCPV6_INCLUDE_RELAY_MESSAGE_OPTION          0x00000080    /* The reply message includes a relay message option. */
180 #define NX_DHCPV6_INCLUDE_AUTHENTICATION_OPTION         0x00000100    /* The reply message includes a authentication option. */
181 #define NX_DHCPV6_INCLUDE_SERVER_UNICAST_OPTION         0x00000200    /* The reply message includes a server unicast option. */
182 #define NX_DHCPV6_INCLUDE_STATUS_SUCCESS_OPTION         0x00000400    /* The reply message includes a status code option with success. */
183 #define NX_DHCPV6_INCLUDE_STATUS_UNSPEC_FAIL_OPTION     0x00000800    /* The reply message includes a status code option with failure. */
184 #define NX_DHCPV6_INCLUDE_STATUS_NO_ADDR_AVAIL_OPTION   0x00001000    /* The reply message includes a status code option with no addresses available. */
185 #define NX_DHCPV6_INCLUDE_STATUS_NO_BIND_OPTION         0x00002000    /* The reply message includes a status code option with unavailable. */
186 #define NX_DHCPV6_INCLUDE_STATUS_NOT_ONLINK_OPTION      0x00004000    /* The reply message includes a status code option with not onlink. */
187 #define NX_DHCPV6_INCLUDE_STATUS_USE_MULTICAST_OPTION   0x00008000    /* The reply message includes a status code option with use multicast. */
188 #define NX_DHCPV6_INCLUDE_RAPID_COMMIT_OPTION           0x00010000    /* The reply message includes a rapid commit option. */
189 #define NX_DHCPV6_INCLUDE_USER_CLASS_OPTION             0x00020000    /* The reply message includes a user class option. */
190 #define NX_DHCPV6_INCLUDE_VENDOR_CLASS_OPTION           0x00040000    /* The reply message includes a vendor class option. */
191 #define NX_DHCPV6_INCLUDE_VENDOR_SPEC_INFO_OPTION       0x00080000    /* The reply message includes a vendor specifc information option. */
192 #define NX_DHCPV6_INCLUDE_INTERFACE_ID_OPTION           0x00100000    /* The reply message includes a interface Id option. */
193 #define NX_DHCPV6_INCLUDE_RECONF_MESSAGE_OPTION         0x00200000    /* The reply message includes a reconfigure message option. */
194 #define NX_DHCPV6_INCLUDE_RECONF_ACCEPT_OPTION          0x00400000    /* The reply message includes a reconfigure accept option. */
195 #define NX_DHCPV6_INCLUDE_DNS_SERVER_OPTION             0x00800000    /* The reply message includes a dns server option. */
196 #define NX_DHCPV6_INCLUDE_DOMAIN_NAME_OPTION            0x01000000    /* The reply message includes a domain name option. */
197 #define NX_DHCPV6_INCLUDE_SNTP_SERVER_OPTION            0x02000000    /* The reply message includes a network time protocol servers option. */
198 #define NX_DHCPV6_INCLUDE_NEW_POSIX_TIIMEZONE_OPTION    0x04000000    /* The reply message includes a new timezone POSIX string index option. */
199 #define NX_DHCPV6_INCLUDE_CLIENT_FQDN_OPTION            0x08000000    /* The reply message includes a client FQDN option. */
200 
201 
202 /* Define internal DHCPv6 option flags. */
203 
204 #define NX_DHCPV6_DNS_SERVER_OPTION                     0x00000001UL    /* Option code for requesting DNS server IP address  */
205 #define NX_DHCPV6_DOMAIN_NAME_OPTION                    0x00000002UL    /* Option code for requesting domain name. */
206 #define NX_DHCPV6_SNTP_SERVER_OPTION                    0x00000004UL    /* Option code for requesting time server IP address. */
207 #define NX_DHCPV6_NEW_POSIX_TIMEZONE_OPTION             0x00000008UL    /* Option code for requesting Time zone. */
208 #define NX_DHCPV6_CLIENT_FQDN_OPTION                    0x00000010UL    /* Option code for requesting FQDN.  */
209 
210 
211 /* RFC defined DHCPv6 server status codes */
212 
213 #define NX_DHCPV6_SUCCESS                               0           /* Server indicates Client DHCPv6 request is granted. */
214 #define NX_DHCPV6_UNSPECIFIED_FAILURE                   1           /* Unspecified reason e.g. not found in RFC 3315 */
215 #define NX_DHCPV6_NO_ADDRESS_AVAILABLE                  2           /* Server unable to assign IP address because none are available. */
216 #define NX_DHCPV6_NO_BINDING                            3           /* Client record (binding) unavailable */
217 #define NX_DHCPV6_NOT_ON_LINK                           4           /* Client's IPv6 address is not on the Server link */
218 #define NX_DHCPV6_USE_MULTICAST                         5           /* Server indicates Client must use multicast ALL_SERVERS address to get IP address */
219 
220 /* Internal DHCPv6 Client status codes */
221 
222 #define NX_DHCPV6_STATE_INIT                            1           /* Client state with no bound IP address */
223 #define NX_DHCPV6_STATE_SENDING_SOLICIT                 2           /* Client sends Sollicit to identify a DHCP server */
224 #define NX_DHCPV6_STATE_SENDING_REQUEST                 3           /* Address requested, Client initiating a request after receiving server advertisement */
225 #define NX_DHCPV6_STATE_SENDING_RENEW                   4           /* Address established, Client is initiating a renew request */
226 #define NX_DHCPV6_STATE_SENDING_REBIND                  5           /* Address established, Client is initiating a rebind request */
227 #define NX_DHCPV6_STATE_SENDING_DECLINE                 6           /* Address was established but Client can't use it e.g. duplicate address check failed. */
228 #define NX_DHCPV6_STATE_SENDING_CONFIRM                 7           /* Client IP Address is established but Client requires confirmation its still ok */
229 #define NX_DHCPV6_STATE_SENDING_INFORM_REQUEST          8           /* Client IP Address is established but Client requests information other than IP address */
230 #define NX_DHCPV6_STATE_SENDING_RELEASE                 9           /* Requesting an IP address release of a recently assigned IP address. */
231 #define NX_DHCPV6_STATE_BOUND_TO_ADDRESS                15          /* Client is bound to an assigned address; DHCP Client task is basically idle. */
232 
233 /* Internal DHCPv6 Client address status codes. */
234 
235 #define NX_DHCPV6_IA_ADDRESS_STATE_INVALID              0           /* The IA does not inlcude IPv6 address. */
236 #define NX_DHCPV6_IA_ADDRESS_STATE_INITIAL              1           /* The IA inlcude one IPv6 address,but the DHCPv6 interactive is not complete. */
237 #define NX_DHCPV6_IA_ADDRESS_STATE_DAD_TENTATIVE        2           /* After DHCPv6 interactive, NetX pefrome the DAD to check this IPv6 address.  */
238 #define NX_DHCPV6_IA_ADDRESS_STATE_DAD_FAILURE          3           /* DAD process failure,the DHCPv6 Client should send DECLINE message.*/
239 #define NX_DHCPV6_IA_ADDRESS_STATE_VALID                4           /* The global IP address is valid and set it to the IP instance. */
240 
241 /* Internal DHCPv6 event flags.  These events are processed by the Client DHCPv6 thread. */
242 
243 #define NX_DHCPV6_ALL_EVENTS                            0xFFFFFFFFUL    /* All Client DHCPv6 event flags */
244 #define NX_DHCPV6_DAD_FAILURE_EVENT                     0x00000001UL    /* The DHCPv6 Client perform DAD failure.  */
245 #define NX_DHCPV6_DAD_SUCCESSFUL_EVENT                  0x00000002UL    /* The DHCPv6 Client perform DAD failure.  */
246 
247 /* The behavior of a DHCPv6 client that implements the Client FQDN option. RFC4704, Section5, Page7.  */
248 
249 #define NX_DHCPV6_CLIENT_DESIRES_UPDATE_AAAA_RR         0           /* DHCPv6 Client choose to updating the FQDN-to-IPv6 address mapping for FQDN and address(es) used by the client.  */
250 #define NX_DHCPV6_CLIENT_DESIRES_SERVER_DO_DNS_UPDATE   1           /* DHCPv6 Client choose to updating the FQDN-to-IPv6 address mapping for FQDN and address(es) used by the client to the server.  */
251 #define NX_DHCPV6_CLIENT_DESIRES_NO_SERVER_DNS_UPDATE   2           /* DHCPv6 Client choose to request that the server perform no DNS updatest on its behalf.  */
252 
253 
254 /* RFC mandated DHCPv6 client and server ports.  */
255 
256 #define NX_DHCPV6_SERVER_UDP_PORT                       547
257 #define NX_DHCPV6_CLIENT_UDP_PORT                       546
258 
259 
260 /* The solicit mode.  */
261 
262 #define NX_DHCPV6_SOLICIT_NORMAL                        1
263 #define NX_DHCPV6_SOLICIT_RAPID                         2
264 
265 
266 /* Define name compression masks.  */
267 
268 #define NX_DHCPV6_LABEL_MAX                             63       /* Maximum Label (between to dots) size.  */
269 #define NX_DHCPV6_COMPRESS_MASK                         0xc0
270 #define NX_DHCPV6_COMPRESS_VALUE                        0xc0
271 #define NX_DHCPV6_POINTER_MASK                          0xc000
272 
273 
274 /* Internal error codes for DHCPv6 Client services.  */
275 
276 #define NX_DHCPV6_TASK_SUSPENDED                        0xE90    /* DHCPv6 task suspended by host application. */
277 #define NX_DHCPV6_ALREADY_STARTED                       0xE91    /* DHCPv6 already started when API called to start it. */
278 #define NX_DHCPV6_NOT_STARTED                           0xE92    /* DHCPv6 was not started when API was called  */
279 #define NX_DHCPV6_PARAM_ERROR                           0xE93    /* Invalid non pointer input to API */
280 #define NX_DHCPV6_NOT_BOUND                             0xE94    /* DHCPv6 was not bound when API was called.  */
281 
282 #define NX_DHCPV6_INVALID_CLIENT_DUID                   0xE95    /* Client DUID received from Server with invalid data or mismatches Client server DUID on record. */
283 #define NX_DHCPV6_INVALID_SERVER_DUID                   0xE96    /* Server DUID received by Client has bad syntax or missing data*/
284 #define NX_DHCPV6_MESSAGE_MISSING_DUID                  0xE97    /* Client receives a message type missing server or client DUID. */
285 #define NX_DHCPV6_UNSUPPORTED_DUID_TYPE                 0xE98    /* Client configuration involves a DUID type not supported by this API. */
286 #define NX_DHCPV6_UNSUPPORTED_DUID_HW_TYPE              0xE99    /* Client configuration involves a network hardware type not supported by this API. */
287 #define NX_DHCPV6_NO_DUID_OPTION                        0xE9A    /* The reply message does not include server or client identifier option. */
288 #define NX_DHCPV6_NO_RAPID_COMMIT_OPTION                0xE9B    /* The reply message does not iclude rapid commit option. */
289 #define NX_DHCPV6_EQUAL_OR_LESS_PREF_VALUE              0xE9C    /* The current preference value is equal to or less than the recorded preference valude. */
290 
291 #define NX_DHCPV6_INVALID_IANA_TIME                     0xEA0    /* Server IA-NA option T1 vs T2 address lease time is invalid. */
292 #define NX_DHCPV6_MISSING_IANA_OPTION                   0xEA1    /* Client received IA address option not belonging to an IA block */
293 #define NX_DHCPV6_BAD_IANA_ID                           0xEA2    /* Server IA-NA option does not contain the Client's original IA-NA ID. */
294 #define NX_DHCPV6_INVALID_IANA_DATA                     0xEA3    /* Server IA-NA option block has bad syntax or missing data */
295 #define NX_DHCPV6_INVALID_IA_ADDRESS                    0xEA4    /* Client inquiring about an unknown IA address */
296 #define NX_DHCPV6_INVALID_IA_DATA                       0xEA5    /* Server IA address option block has bad syntax or missing data */
297 #define NX_DHCPV6_INVALID_IA_TIME                       0xEA6    /* Server IA option preferred vs valid lease time is invalid. */
298 #define NX_DHCPV6_INVALID_PREF_DATA                     0xEA7    /* Client received Preference block with missing data or bad syntax */
299 #define NX_DHCPV6_INCOMPLETE_OPTION_BLOCK               0xEA8    /* Empty option block data; either zero length or zero option parsed. */
300 #define NX_DHCPV6_MISSING_REQUIRED_OPTIONS              0xEA9    /* Cannot start the DHCPv6 Client because required options are missing e.g. IANA, DUID etc */
301 #define NX_DHCPV6_INVALID_OPTION_DATA                   0xEAA    /* Client received option data with missing data or bad syntax */
302 #define NX_DHCPV6_UNKNOWN_OPTION                        0xEAB    /* Client received an unknown or unsupported option from server */
303 #define NX_DHCPV6_INVALID_SERVER_PACKET                 0xEAC    /* Server reply invalid e.g. bad port, invalid DHCP header or invalid reply message.  */
304 #define NX_DHCPV6_IA_ADDRESS_NOT_VALID                  0xEAD    /* Client not assigned an IP address from the DHCPv6 Server */
305 #define NX_DHCPV6_REACHED_MAX_IA_ADDRESS                0xEAE    /* IA address exceeds the maximum IAs specified by NX_DHCPV6_MAX_IA_ADDRESS.  */
306 #define NX_DHCPV6_IA_ADDRESS_ALREADY_EXIST              0xEAF    /* The IA address already added to the Client.  */
307 
308 #define NX_DHCPV6_UNKNOWN_PROCESS_STATE                 0xEB0    /* Internal DHCPv6 state machine in an unknown state */
309 #define NX_DHCPV6_ILLEGAL_MESSAGE_TYPE                  0xEB1    /* Client receives a message type intended for a DHCPv6 server e.g. REQUEST or CONFIRM */
310 #define NX_DHCPV6_UNKNOWN_MSG_TYPE                      0xEB2    /* NetX DHCPv6 receives an unknown message type  */
311 #define NX_DHCPV6_BAD_TRANSACTION_ID                    0xEB3    /* Client received message with bad transaction ID */
312 #define NX_DHCPV6_BAD_IPADDRESS_ERROR                   0xEB4    /* Unable to parse a valid IPv6 address from specified data buffer  */
313 #define NX_DHCPV6_PROCESSING_ERROR                      0xEB5    /* Server packet size received out of synch with NetX packet length - no assignment of blame */
314 #define NX_DHCPV6_INSUFFICIENT_PACKET_PAYLOAD           0xEB6    /* Client DHCPv6 message will not fit in Client packet pool packet buffer. */
315 #define NX_DHCPV6_INVALID_DATA_SIZE                     0xEB7    /* Attempting to parse too large a data object to/from DHCPv6 request. */
316 #define NX_DHCPV6_ADDRESS_MISMATCH                      0xEB8    /* Client IPv6 address index into the IP table is incorrect (addresses do not match). */
317 
318 #define NX_DHCPV6_REACHED_MAX_RETRANSMISSION_COUNT      0xEC0    /* No response from server after maximum number of retries. */
319 #define NX_DHCPV6_REACHED_MAX_RETRANSMISSION_TIMEOUT    0xEC1    /* No response from server after maximum retry timeout. */
320 
321 
322 /* Define DHCPv6 timeout for checking DHCPv6 flag status. */
323 #define NX_DHCPV6_TIME_INTERVAL                         (NX_IP_PERIODIC_RATE)
324 
325 
326 /* Define the conversion between timer ticks and seconds (processor dependent). */
327 #define NX_DHCPV6_TICKS_PER_SECOND                      (NX_IP_PERIODIC_RATE)
328 
329 
330 /* Define the max name size. RFC1035, Section 3.1.  */
331 #define NX_DHCPV6_MAX_NAME_SIZE                         255
332 
333 
334 /* Define the DHCP stack priority.  */
335 
336 #ifndef NX_DHCPV6_THREAD_PRIORITY
337 #define NX_DHCPV6_THREAD_PRIORITY                       2
338 #endif
339 
340 
341 /* Define the time out option to obtain a DHCPv6 Client mutex lock. If the
342    the Client appears to be locking up, this can be set to a finite value
343    for debugging as well as restore responsiveness to the Client */
344 
345 #ifndef NX_DHCPV6_MUTEX_WAIT
346 #define NX_DHCPV6_MUTEX_WAIT                            TX_WAIT_FOREVER
347 #endif
348 
349 
350 /* Define DHCPv6 Client record parameters */
351 
352 /* Define the timer interval for the IP lifetime timer in seconds.  */
353 
354 #ifndef NX_DHCPV6_IP_LIFETIME_TIMER_INTERVAL
355 #define NX_DHCPV6_IP_LIFETIME_TIMER_INTERVAL            1
356 #endif
357 
358 
359 /* Define the timer interval for the session duration timer in seconds.  */
360 
361 #ifndef NX_DHCPV6_SESSION_TIMER_INTERVAL
362 #define NX_DHCPV6_SESSION_TIMER_INTERVAL                1
363 #endif
364 
365 
366 /* Define the number of DNS name servers the Client will store. */
367 
368 #ifndef NX_DHCPV6_NUM_DNS_SERVERS
369 #define NX_DHCPV6_NUM_DNS_SERVERS                       2
370 #endif
371 
372 
373 /* Define the number of time servers the Client will store. */
374 
375 #ifndef NX_DHCPV6_NUM_TIME_SERVERS
376 #define NX_DHCPV6_NUM_TIME_SERVERS                      1
377 #endif
378 
379 
380 /* Define the buffer size for storing the DHCPv6 Client domain name. */
381 
382 #ifndef NX_DHCPV6_DOMAIN_NAME_BUFFER_SIZE
383 #define NX_DHCPV6_DOMAIN_NAME_BUFFER_SIZE               32
384 #endif
385 
386 
387 /* Define the buffer size for storing the DHCPv6 Client time zone e.g. CET, PST etc. */
388 
389 #ifndef NX_DHCPV6_TIME_ZONE_BUFFER_SIZE
390 #define NX_DHCPV6_TIME_ZONE_BUFFER_SIZE                 16
391 #endif
392 
393 /* Define the amount of packet payload to store DHCPv6 server messages. */
394 
395 #ifndef NX_DHCPV6_MAX_MESSAGE_SIZE
396 #define NX_DHCPV6_MAX_MESSAGE_SIZE                      100
397 #endif
398 
399 /* Define the amount of IA addresses to store IPv6 addresses. */
400 
401 #ifndef NX_DHCPV6_MAX_IA_ADDRESS
402 #define NX_DHCPV6_MAX_IA_ADDRESS                        1
403 #endif
404 
405 
406 /* DHCPv6 Client Network Configuration */
407 
408 /* Define the generic time out option for NetX operations (packet allocate, packet send.  */
409 
410 #ifndef NX_DHCPV6_PACKET_TIME_OUT
411 #define NX_DHCPV6_PACKET_TIME_OUT                       (3 * NX_DHCPV6_TICKS_PER_SECOND)
412 #endif
413 
414 
415 /* Define UDP socket type of service.  */
416 
417 #ifndef NX_DHCPV6_TYPE_OF_SERVICE
418 #define NX_DHCPV6_TYPE_OF_SERVICE                       NX_IP_NORMAL
419 #endif
420 
421 
422 /* Define the number of routers a UDP packet passes before it is discarded. */
423 
424 #ifndef NX_DHCPV6_TIME_TO_LIVE
425 #define NX_DHCPV6_TIME_TO_LIVE                          0x80
426 #endif
427 
428 /* Define the stored packets in the UDP socket queue. */
429 
430 #ifndef NX_DHCPV6_QUEUE_DEPTH
431 #define NX_DHCPV6_QUEUE_DEPTH                           5
432 #endif
433 
434 
435 /* Define the initial retransmission timeout in timer ticks for DHCPv6 messages.
436    For no limit on the retransmission timeout set to 0, for no limit
437    on the retries, set to 0.
438 
439    Note that regardless of length of timeout or number of retries, when the IP address
440    valid lifetime expires, the Client can no longer use its global IP address
441    assigned by the DHCPv6 Server. */
442 
443 #ifndef NX_DHCPV6_FIRST_SOL_MAX_DELAY
444 #define NX_DHCPV6_FIRST_SOL_MAX_DELAY                   (1 * NX_DHCPV6_TICKS_PER_SECOND)
445 #endif
446 
447 #ifndef NX_DHCPV6_INIT_SOL_TRANSMISSION_TIMEOUT
448 #define NX_DHCPV6_INIT_SOL_TRANSMISSION_TIMEOUT         (1 * NX_DHCPV6_TICKS_PER_SECOND)
449 #endif
450 
451 #ifndef NX_DHCPV6_MAX_SOL_RETRANSMISSION_TIMEOUT
452 #define NX_DHCPV6_MAX_SOL_RETRANSMISSION_TIMEOUT        (120 * NX_DHCPV6_TICKS_PER_SECOND)
453 #endif
454 
455 #ifndef NX_DHCPV6_MAX_SOL_RETRANSMISSION_COUNT
456 #define NX_DHCPV6_MAX_SOL_RETRANSMISSION_COUNT           0
457 #endif
458 
459 #ifndef NX_DHCPV6_MAX_SOL_RETRANSMISSION_DURATION
460 #define NX_DHCPV6_MAX_SOL_RETRANSMISSION_DURATION        0
461 #endif
462 
463 #ifndef NX_DHCPV6_INIT_REQ_TRANSMISSION_TIMEOUT
464 #define NX_DHCPV6_INIT_REQ_TRANSMISSION_TIMEOUT         (1 * NX_DHCPV6_TICKS_PER_SECOND)
465 #endif
466 
467 #ifndef NX_DHCPV6_MAX_REQ_RETRANSMISSION_TIMEOUT
468 #define NX_DHCPV6_MAX_REQ_RETRANSMISSION_TIMEOUT        (30 * NX_DHCPV6_TICKS_PER_SECOND)
469 #endif
470 
471 #ifndef NX_DHCPV6_MAX_REQ_RETRANSMISSION_COUNT
472 #define NX_DHCPV6_MAX_REQ_RETRANSMISSION_COUNT           10
473 #endif
474 
475 
476 #ifndef NX_DHCPV6_MAX_REQ_RETRANSMISSION_DURATION
477 #define NX_DHCPV6_MAX_REQ_RETRANSMISSION_DURATION        0
478 #endif
479 
480 #ifndef NX_DHCPV6_INIT_RENEW_TRANSMISSION_TIMEOUT
481 #define NX_DHCPV6_INIT_RENEW_TRANSMISSION_TIMEOUT       (10 * NX_DHCPV6_TICKS_PER_SECOND)
482 #endif
483 
484 #ifndef NX_DHCPV6_MAX_RENEW_RETRANSMISSION_TIMEOUT
485 #define NX_DHCPV6_MAX_RENEW_RETRANSMISSION_TIMEOUT      (600 * NX_DHCPV6_TICKS_PER_SECOND)
486 #endif
487 
488 #ifndef NX_DHCPV6_MAX_RENEW_RETRANSMISSION_COUNT
489 #define NX_DHCPV6_MAX_RENEW_RETRANSMISSION_COUNT         0
490 #endif
491 
492 #ifndef NX_DHCPV6_INIT_REBIND_TRANSMISSION_TIMEOUT
493 #define NX_DHCPV6_INIT_REBIND_TRANSMISSION_TIMEOUT      (10 * NX_DHCPV6_TICKS_PER_SECOND)
494 #endif
495 
496 #ifndef NX_DHCPV6_MAX_REBIND_RETRANSMISSION_TIMEOUT
497 #define NX_DHCPV6_MAX_REBIND_RETRANSMISSION_TIMEOUT     (600 * NX_DHCPV6_TICKS_PER_SECOND)
498 #endif
499 
500 #ifndef NX_DHCPV6_MAX_REBIND_RETRANSMISSION_COUNT
501 #define NX_DHCPV6_MAX_REBIND_RETRANSMISSION_COUNT        0
502 #endif
503 
504 #ifndef NX_DHCPV6_INIT_RELEASE_TRANSMISSION_TIMEOUT
505 #define NX_DHCPV6_INIT_RELEASE_TRANSMISSION_TIMEOUT     (1 * NX_DHCPV6_TICKS_PER_SECOND)
506 #endif
507 
508 #ifndef NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_TIMEOUT
509 #define NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_TIMEOUT     0
510 #endif
511 
512 #ifndef NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_COUNT
513 #define NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_COUNT       5
514 #endif
515 
516 #ifndef NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_DURATION
517 #define NX_DHCPV6_MAX_RELEASE_RETRANSMISSION_DURATION    0
518 #endif
519 
520 #ifndef NX_DHCPV6_INIT_DECLINE_TRANSMISSION_TIMEOUT
521 #define NX_DHCPV6_INIT_DECLINE_TRANSMISSION_TIMEOUT     (1 * NX_DHCPV6_TICKS_PER_SECOND)
522 #endif
523 
524 #ifndef NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_TIMEOUT
525 #define NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_TIMEOUT     0
526 #endif
527 
528 #ifndef NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_COUNT
529 #define NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_COUNT       5
530 #endif
531 
532 #ifndef NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_DURATION
533 #define NX_DHCPV6_MAX_DECLINE_RETRANSMISSION_DURATION    0
534 #endif
535 
536 #ifndef NX_DHCPV6_FIRST_CONFIRM_MAX_DELAY
537 #define NX_DHCPV6_FIRST_CONFIRM_MAX_DELAY               (1 * NX_DHCPV6_TICKS_PER_SECOND)
538 #endif
539 
540 #ifndef NX_DHCPV6_INIT_CONFIRM_TRANSMISSION_TIMEOUT
541 #define NX_DHCPV6_INIT_CONFIRM_TRANSMISSION_TIMEOUT     (1 * NX_DHCPV6_TICKS_PER_SECOND)
542 #endif
543 
544 #ifndef NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_TIMEOUT
545 #define NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_TIMEOUT    (4 * NX_DHCPV6_TICKS_PER_SECOND)
546 #endif
547 
548 #ifndef NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_COUNT
549 #define NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_COUNT       0
550 #endif
551 
552 #ifndef NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_DURATION
553 #define NX_DHCPV6_MAX_CONFIRM_RETRANSMISSION_DURATION    10
554 #endif
555 
556 #ifndef NX_DHCPV6_FIRST_INFORM_MAX_DELAY
557 #define NX_DHCPV6_FIRST_INFORM_MAX_DELAY                (1 * NX_DHCPV6_TICKS_PER_SECOND)
558 #endif
559 
560 #ifndef NX_DHCPV6_INIT_INFORM_TRANSMISSION_TIMEOUT
561 #define NX_DHCPV6_INIT_INFORM_TRANSMISSION_TIMEOUT      (1 * NX_DHCPV6_TICKS_PER_SECOND)
562 #endif
563 
564 #ifndef NX_DHCPV6_MAX_INFORM_RETRANSMISSION_TIMEOUT
565 #define NX_DHCPV6_MAX_INFORM_RETRANSMISSION_TIMEOUT     (120 * NX_DHCPV6_TICKS_PER_SECOND)
566 #endif
567 
568 #ifndef NX_DHCPV6_MAX_INFORM_RETRANSMISSION_COUNT
569 #define NX_DHCPV6_MAX_INFORM_RETRANSMISSION_COUNT        0
570 #endif
571 
572 #ifndef NX_DHCPV6_MAX_INFORM_RETRANSMISSION_DURATION
573 #define NX_DHCPV6_MAX_INFORM_RETRANSMISSION_DURATION     0
574 #endif
575 
576 
577 /* Define the Identity Association Internet Address option structure  */
578 typedef struct NX_DHCPV6_IA_ADDRESS_STRUCT
579 {
580 
581     USHORT          nx_op_code;                    /* IA internet address option code is 5 */
582     USHORT          nx_option_length;              /* Length of the IA address option data = 24 not including length and op code field*/
583     NXD_ADDRESS     nx_global_address;             /* Assigned Host IPv6 address */
584     ULONG           nx_preferred_lifetime;         /* Server's preference for IPv6 address T1 life time for itself */
585     ULONG           nx_valid_lifetime;             /* Server's assigned valid time for T2 for any server  */
586     UINT            nx_address_status;             /* Indicates if the global address is registered and validated. */
587     UINT            nx_address_map;                /* Map the IPv6 address with client, indicates if the IPv6 address already exists or not.  */
588 
589 } NX_DHCPV6_IA_ADDRESS;
590 
591 /* Define the Option status structure  */
592 typedef struct NX_DHCPV6_OP_STATUS_STRUCT
593 {
594 
595     USHORT          nx_op_code;                    /* IA address option code is 5 */
596     USHORT          nx_option_length;              /* Length of the IA address option data = 24 not including length and op code field*/
597 } NX_DHCPV6_OP_STATUS;
598 
599 
600 /* Define the Preference Option structure  */
601 typedef struct NX_DHCPV6_PREFERENCE_STRUCT
602 {
603 
604     USHORT          nx_op_code;                    /* IA address option code is 5 */
605     USHORT          nx_option_length;              /* Length of the IA address option data = 24 not including length and op code field*/
606     USHORT          nx_pref_value;                 /* Assigned Host IPv6 address */
607 
608 } NX_DHCPV6_PREFERENCE;
609 
610 
611 /* Define the Identity Association for Permanent ("Non Temporary" in RFC) address */
612 
613 typedef struct NX_DHCPV6_IA_NA_STRUCT
614 {
615 
616     USHORT              nx_op_code;             /* IA NA address option code is 3 */
617     USHORT              nx_option_length;       /* 12 + length of variable length fields in IA_NA option . */
618     ULONG               nx_IA_NA_id;            /* IANA identifier; must be unique among all client IANA's. Must be the same on restart per IANA */
619     ULONG               nx_T1;                  /* Time client can extend time before address lifetime expires from the server it got it from; applies to all addresses in IA_NA. */
620     ULONG               nx_T2;                  /* Same as T1 except this is when the client will request REBIND from another server. */
621 
622 } NX_DHCPV6_IA_NA;
623 
624 
625 /* Define DHCPv6 Unique Identifier (DUID); both Client and Server must send messages with their own DUID. */
626 
627 typedef struct NX_DHCPV6_DUID_STRUCT
628 {
629 
630     USHORT            nx_op_code;                 /* Client DUID option code is 1; Server DUID code is 2  */
631     USHORT            nx_option_length;           /* Option length = 14 not including length and op code field; */
632     USHORT            nx_duid_type;               /* 3 main types: hw; hw + time; vendor assigned ID (not supported here); requires DUID be stored in non volatile storage */
633     USHORT            nx_hardware_type;           /* Only if LL/LLT type. Hardware type specified by IANA/RFC 826 e.g. IEEE 802; network byte order */
634     ULONG             nx_duid_time;               /* Only if LLT type. Time based on when DUID generated; network byte order. */
635     ULONG             nx_link_layer_address_msw;  /* Only if LL/LLT type. Pointer to Unique link layer address - most significant word (2/4 bytes)*/
636     ULONG             nx_link_layer_address_lsw;  /* Only if LL/LLT type. Pointer to Unique link layer address - least significant word (4 bytes) */
637 
638 } NX_DHCPV6_DUID;
639 
640 
641 /* Define the elapsed time option structure.  This contains the length of the Client Server session. */
642 
643 typedef struct NX_DHCPV6_ELAPSED_TIME_STRUCT
644 {
645 
646     USHORT            nx_op_code;                /* Elapsed time option code = 8 not including length and op code field. */
647     USHORT            nx_op_length;              /* Length of time data = 2. */
648     USHORT            nx_session_time;           /* Time of DHCP session e.g. first msg elapsed time is zero. */
649 
650 } NX_DHCPV6_ELAPSED_TIME;
651 
652 
653 /* Define the Message Option structure. Each message from the Client must have a unique message ID. */
654 
655 typedef struct NX_DHCPV6_MESSAGE_HDR_STRUCT
656 {
657 
658     USHORT             nx_message_type;           /* Message type (1 byte) */
659     USHORT             nx_reserved;               /* Reserved.  */
660     ULONG              nx_message_xid;            /* Message transaction ID (3 bytes)*/
661 } NX_DHCPV6_MESSAGE_HDR;
662 
663 /* Define the option request structure. This is how the Client requests information other than global IP address.
664    It can ask for domain name, DNS server, time zone, time server and other options. */
665 
666 typedef struct NX_DHCPV6_OPTIONREQUEST_STRUCT
667 {
668     USHORT             nx_op_code;                /* Option Request code  = 6*/
669     USHORT             nx_option_length;          /* Length in bytes of option data = 2 * number of requests */
670     USHORT             nx_op_request;             /* e.g. DNS server = 23, ... */
671 
672 } NX_DHCPV6_OPTIONREQUEST;
673 
674 /* Define the DHCPv6 Client FQDN Option structure,  */
675 
676 typedef struct NX_DHCPV6_CLIENT_FQDN_STRUCT
677 {
678     USHORT             nx_op_code;                /* Option Client FQDN code = 39*/
679     USHORT             nx_op_length;              /* 1 + length of domain name.   */
680     UCHAR              nx_flags;                  /* Flag bits used between client and server to negotiate who performs which updates.  */
681     UCHAR              nx_reserved[3];            /* Reserved.  */
682     CHAR              *nx_domain_name;            /* The partial or fully qualified domain name.  */
683 
684 } NX_DHCPV6_CLIENT_FQDN;
685 
686 
687 /* Define the Client DHCPv6 structure containind the DHCPv6 Client record (DHCPv6 status, server DUID etc).  */
688 
689 typedef struct NX_DHCPV6_STRUCT
690 {
691     ULONG                   nx_dhcpv6_id;                               /* DHCPv6 Structure ID  */
692     CHAR                    *nx_dhcpv6_name;                            /* DHCPv6 name supplied at create */
693     UINT                    nx_dhcpv6_client_address_index[NX_DHCPV6_MAX_IA_ADDRESS];
694                                                                         /* Index in IP address table where the Client assigned address is located. */
695     UINT                    nx_dhcpv6_client_interface_index;           /* DHCPv6 outgoing network interface index */
696     TX_THREAD               nx_dhcpv6_thread;                           /* Client processing thread */
697     TX_EVENT_FLAGS_GROUP    nx_dhcpv6_events;                           /* DHCPv6 Client event flags. */
698     TX_MUTEX                nx_dhcpv6_client_mutex;                     /* Mutex for exclusive access to the DHCP Client instance */
699     TX_TIMER                nx_dhcpv6_IP_lifetime_timer;                /* Client IP lifetime timeout timer. */
700     TX_TIMER                nx_dhcpv6_session_timer;                    /* Client session duration timer. */
701     NX_IP                   *nx_dhcpv6_ip_ptr;                          /* The associated IP pointer for this DHCPV6 instance */
702     NX_PACKET_POOL          *nx_dhcpv6_pool_ptr;                        /* Pointer to packet pool for sending DHCPV6 messages */
703     NX_UDP_SOCKET           nx_dhcpv6_socket;                           /* UDP socket for communicating with DHCPv6 server */
704     UCHAR                   nx_dhcpv6_started;                          /* DHCPv6 client task has been started */
705     UCHAR                   nx_dhcpv6_state;                            /* The current state of the DHCPv6 Client */
706     USHORT                  nx_status_code;                             /* Status of current option received by Client */
707     UINT                    nx_dhcpv6_sleep_flag;                       /* If true, the DHCPv6 client is in a position where it can be stopped */
708     NX_DHCPV6_MESSAGE_HDR   nx_dhcpv6_message_hdr;                      /* Message Header for all client messages to DHCPv6 Servers */
709     NX_DHCPV6_DUID          nx_dhcpv6_client_duid;                      /* Client DUID; ID by which Client and Server identify each other's DUID */
710     NX_DHCPV6_DUID          nx_dhcpv6_server_duid;                      /* Server DUID; ID by which Client and Server identify each other's DUID */
711     NX_DHCPV6_ELAPSED_TIME  nx_dhcpv6_elapsed_time;                     /* Time duration of the current DHCP msg exchange between Client and Server. */
712     NX_DHCPV6_IA_NA         nx_dhcpv6_iana;                             /* Identity Association for non temp address - must be stored in non volatile memory */
713     NX_DHCPV6_IA_ADDRESS    nx_dhcpv6_ia[NX_DHCPV6_MAX_IA_ADDRESS];     /* Client internet address option */
714     NX_DHCPV6_PREFERENCE    nx_dhcpv6_preference;                       /* Server's preference affecting the Client's DHCPv6 server selection. */
715     NX_DHCPV6_OPTIONREQUEST nx_dhcpv6_option_request;                   /* Set of request options in Solicit, Renew, Confirm or Rebind message types. */
716     NX_DHCPV6_CLIENT_FQDN   nx_dhcpv6_client_FQDN;                      /* Set of Client options in Solicit, Request, Renew, or Rebind message types. */
717     ULONG                   nx_dhcpv6_IP_lifetime_time_accrued;         /* Time since Client set received or renewed its IP address with the DHCPv6 server. */
718     UCHAR                   nx_status_message[NX_DHCPV6_MAX_MESSAGE_SIZE];                  /* Server's message in its Option status to client.  */
719     NXD_ADDRESS             nx_dhcpv6_server_address;                   /* DHCPv6 server address.  */
720     NXD_ADDRESS             nx_dhcpv6_DNS_name_server_address[NX_DHCPV6_NUM_DNS_SERVERS];   /* DNS name server IP address */
721     NXD_ADDRESS             nx_dhcpv6_time_server_address[NX_DHCPV6_NUM_TIME_SERVERS];      /* time server IP address */
722     NXD_ADDRESS             nx_dhcpv6_client_destination_address;       /* The destination address where DHCP message should be sent, by default All_DHCP_Relay_Agents_and_Servers(FF02::1:2).  */
723     UCHAR                   nx_dhcpv6_domain_name[NX_DHCPV6_DOMAIN_NAME_BUFFER_SIZE];       /* Buffer for holding domain name. */
724     UCHAR                   nx_dhcpv6_time_zone[NX_DHCPV6_TIME_ZONE_BUFFER_SIZE];           /* Buffer for holding time zone. */
725     ULONG                   nx_dhcpv6_solicitations_sent;               /* The number of Solicit messages sent */
726     ULONG                   nx_dhcpv6_solicitation_responses;           /* The number of solicitations server responded to */
727     ULONG                   nx_dhcpv6_requests_sent;                    /* The number of Request messages sent */
728     ULONG                   nx_dhcpv6_request_responses;                /* The number of requests server responded to */
729     ULONG                   nx_dhcpv6_renews_sent;                      /* The number of renew messages sent */
730     ULONG                   nx_dhcpv6_renew_responses;                  /* The number of renews server responded to */
731     ULONG                   nx_dhcpv6_rebinds_sent;                     /* The number of Rebind messages sent */
732     ULONG                   nx_dhcpv6_rebind_responses;                 /* The number of Rebind requests Server responded to */
733     ULONG                   nx_dhcpv6_releases_sent;                    /* The number of Release messages sent */
734     ULONG                   nx_dhcpv6_release_responses;                /* The number of Releases server responded to  */
735     ULONG                   nx_dhcpv6_confirms_sent;                    /* The number of confirmations sent */
736     ULONG                   nx_dhcpv6_confirm_responses;                /* The number of confirmations server responded to */
737     ULONG                   nx_dhcpv6_declines_sent;                    /* The number of declines sent */
738     ULONG                   nx_dhcpv6_decline_responses;                /* The number of declines server responded to */
739     ULONG                   nx_dhcpv6_inform_req_sent;                  /* The number of Inform (option requests) sent */
740     ULONG                   nx_dhcpv6_inform_req_responses;             /* The number of Inform server responsed to */
741     ULONG                   nx_dhcpv6_transmission_timeout;             /* Timeout on Client messages before resending a request to the server. */
742     ULONG                   nx_dhcpv6_retransmission_count;             /* The number of request retransmissions to the server. */
743     ULONG                   nx_dhcpv6_init_retransmission_timeout;      /* The initial retransmission time. */
744     ULONG                   nx_dhcpv6_max_retransmission_count;         /* The maximum retransmission count. */
745     ULONG                   nx_dhcpv6_max_retransmission_timeout;       /* The maximum retransmission time. */
746     ULONG                   nx_dhcpv6_max_retransmission_duration;      /* The maximum retransmissions duration. */
747     UINT                    nx_dhcpv6_request_solicit_mode;             /* The mode of sending the solicit message with rapid commit option. */
748     UINT                    nx_dhcpv6_reply_option_flags;               /* The flags indicate options the reply messages included. */
749     USHORT                  nx_dhcpv6_reply_option_current_pref_value;  /* The preference value of current advertise message. */
750     UCHAR                   nx_dhcpv6_received_message_type;            /* The type of received message  */
751     UCHAR                   nx_dhcpv6_reserved;                         /* Reserved.  */
752 
753     /* Define the callback function for DHCP state change notification. If specified
754        by the application, this function is called whenever a state change occurs for
755        the DHCP associated with this IP instance.  */
756     VOID (*nx_dhcpv6_state_change_callback)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT old_state, UINT new_state);
757 
758     /* Define the callback function for receiving a non successful status from the Server.  The
759        context of the status/error is defined by the message type is was received in and what
760        option the status is referring to e.g. IA Address.  */
761     VOID (*nx_dhcpv6_server_error_handler)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT op_code, UINT status_code, UINT message_type);
762 
763     /* Define the callback function for adding specific DHCPv6 user option.  */
764     UINT (*nx_dhcpv6_user_option_add)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT interface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length);
765 
766 } NX_DHCPV6;
767 
768 
769 
770 #ifdef NX_DHCPV6_CLIENT_RESTORE_STATE
771 /* Define the DHCPv6 Client record structure for restore the DHCPv6 Client state from non volatile memory/across reboots.  */
772 
773 typedef struct NX_DHCPV6_CLIENT_RECORD_STRUCT
774 {
775     UCHAR                   nx_dhcpv6_state;                            /* The current state of the DHCPv6 Client */
776     UCHAR                   nx_dhcpv6_reserved[3];                      /* Reserved.  */
777     UINT                    nx_dhcpv6_client_interface_index;           /* DHCPv6 outgoing network interface index */
778     UINT                    nx_dhcpv6_client_address_index[NX_DHCPV6_MAX_IA_ADDRESS];
779                                                                         /* Index in IP address table where the Client assigned address is located. */
780     ULONG                   nx_dhcpv6_IP_lifetime_time_accrued;         /* Time since Client set received or renewed its IP address with the DHCPv6 server. */
781     NX_DHCPV6_DUID          nx_dhcpv6_client_duid;                      /* Client DUID; ID by which Client and Server identify each other's DUID */
782     NX_DHCPV6_DUID          nx_dhcpv6_server_duid;                      /* Server DUID; ID by which Client and Server identify each other's DUID */
783     NX_DHCPV6_IA_NA         nx_dhcpv6_iana;                             /* Identity Association for non temp address - must be stored in non volatile memory */
784     NX_DHCPV6_IA_ADDRESS    nx_dhcpv6_ia[NX_DHCPV6_MAX_IA_ADDRESS];     /* Client internet address option */
785     NX_DHCPV6_OPTIONREQUEST nx_dhcpv6_option_request;                   /* Set of request options in Solicit, Renew, Confirm or Rebind message types. */
786     NX_DHCPV6_CLIENT_FQDN   nx_dhcpv6_client_FQDN;                      /* Set of Client options in Solicit, Request, Renew, or Rebind message types. */
787     NXD_ADDRESS             nx_dhcpv6_DNS_name_server_address[NX_DHCPV6_NUM_DNS_SERVERS];   /* DNS name server IP address */
788     NXD_ADDRESS             nx_dhcpv6_time_server_address[NX_DHCPV6_NUM_TIME_SERVERS];      /* time server IP address */
789     UCHAR                   nx_dhcpv6_domain_name[NX_DHCPV6_DOMAIN_NAME_BUFFER_SIZE];       /* Buffer for holding domain name. */
790     UCHAR                   nx_dhcpv6_time_zone[NX_DHCPV6_TIME_ZONE_BUFFER_SIZE];           /* Buffer for holding time zone. */
791 } NX_DHCPV6_CLIENT_RECORD;
792 #endif
793 
794 #ifndef NX_DHCPV6_SOURCE_CODE
795 
796 /* Application caller is present, perform API mapping.  */
797 
798 /* Determine if error checking is desired.  If so, map DHCP API functions
799    to the appropriate error checking front-ends.  Otherwise, map API
800    functions to the core functions that actually perform the work.
801    Note: error checking is enabled by default.  */
802 
803 
804 #ifdef NX_DISABLE_ERROR_CHECKING
805 
806 /* Services without error checking.  */
807 
808 #define nx_dhcpv6_client_create                             _nx_dhcpv6_client_create
809 #define nx_dhcpv6_client_delete                             _nx_dhcpv6_client_delete
810 #define nx_dhcpv6_create_client_duid                        _nx_dhcpv6_create_client_duid
811 #define nx_dhcpv6_create_client_iana                        _nx_dhcpv6_create_client_iana
812 #define nx_dhcpv6_create_client_ia                          _nx_dhcpv6_add_client_ia
813 #define nx_dhcpv6_add_client_ia                             _nx_dhcpv6_add_client_ia
814 #define nx_dhcpv6_client_set_interface                      _nx_dhcpv6_client_set_interface
815 #define nx_dhcpv6_client_set_destination_address            _nx_dhcpv6_client_set_destination_address
816 #define nx_dhcpv6_set_time_accrued                          _nx_dhcpv6_set_time_accrued
817 #define nx_dhcpv6_get_client_duid_time_id                   _nx_dhcpv6_get_client_duid_time_id
818 #define nx_dhcpv6_get_IP_address                            _nx_dhcpv6_get_IP_address
819 #define nx_dhcpv6_get_lease_time_data                       _nx_dhcpv6_get_lease_time_data
820 #define nx_dhcpv6_get_other_option_data                     _nx_dhcpv6_get_other_option_data
821 #define nx_dhcpv6_get_DNS_server_address                    _nx_dhcpv6_get_DNS_server_address
822 #define nx_dhcpv6_get_time_server_address                   _nx_dhcpv6_get_time_server_address
823 #define nx_dhcpv6_get_time_accrued                          _nx_dhcpv6_get_time_accrued
824 #define nx_dhcpv6_get_iana_lease_time                       _nx_dhcpv6_get_iana_lease_time
825 #define nx_dhcpv6_get_valid_ip_address_count                _nx_dhcpv6_get_valid_ip_address_count
826 #define nx_dhcpv6_get_valid_ip_address_lease_time           _nx_dhcpv6_get_valid_ip_address_lease_time
827 #define nx_dhcpv6_reinitialize                              _nx_dhcpv6_reinitialize
828 #define nx_dhcpv6_request_solicit                           _nx_dhcpv6_request_solicit
829 #define nx_dhcpv6_request_solicit_rapid                     _nx_dhcpv6_request_solicit_rapid
830 #define nx_dhcpv6_request_confirm                           _nx_dhcpv6_request_confirm
831 #define nx_dhcpv6_request_release                           _nx_dhcpv6_request_release
832 #define nx_dhcpv6_request_inform_request                    _nx_dhcpv6_request_inform_request
833 #define nx_dhcpv6_request_option_DNS_server                 _nx_dhcpv6_request_option_DNS_server
834 #define nx_dhcpv6_request_option_domain_name                _nx_dhcpv6_request_option_domain_name
835 #define nx_dhcpv6_request_option_time_server                _nx_dhcpv6_request_option_time_server
836 #define nx_dhcpv6_request_option_timezone                   _nx_dhcpv6_request_option_timezone
837 #define nx_dhcpv6_request_option_FQDN                       _nx_dhcpv6_request_option_FQDN
838 #define nx_dhcpv6_start                                     _nx_dhcpv6_start
839 #define nx_dhcpv6_stop                                      _nx_dhcpv6_stop
840 #define nx_dhcpv6_suspend                                   _nx_dhcpv6_suspend
841 #define nx_dhcpv6_resume                                    _nx_dhcpv6_resume
842 #define nx_dhcpv6_user_option_add_callback_set              _nx_dhcpv6_user_option_add_callback_set
843 #ifdef NX_DHCPV6_CLIENT_RESTORE_STATE
844 #define nx_dhcpv6_client_get_record                         _nx_dhcpv6_client_get_record
845 #define nx_dhcpv6_client_restore_record                     _nx_dhcpv6_client_restore_record
846 #endif
847 
848 #else
849 
850 /* Services with error checking.  */
851 
852 #define nx_dhcpv6_client_create                             _nxe_dhcpv6_client_create
853 #define nx_dhcpv6_client_delete                             _nxe_dhcpv6_client_delete
854 #define nx_dhcpv6_create_client_duid                        _nxe_dhcpv6_create_client_duid
855 #define nx_dhcpv6_create_client_iana                        _nxe_dhcpv6_create_client_iana
856 #define nx_dhcpv6_create_client_ia                          _nxe_dhcpv6_add_client_ia
857 #define nx_dhcpv6_add_client_ia                             _nxe_dhcpv6_add_client_ia
858 #define nx_dhcpv6_client_set_interface                      _nxe_dhcpv6_client_set_interface
859 #define nx_dhcpv6_client_set_destination_address            _nxe_dhcpv6_client_set_destination_address
860 #define nx_dhcpv6_set_time_accrued                          _nxe_dhcpv6_set_time_accrued
861 #define nx_dhcpv6_get_client_duid_time_id                   _nxe_dhcpv6_get_client_duid_time_id
862 #define nx_dhcpv6_get_IP_address                            _nxe_dhcpv6_get_IP_address
863 #define nx_dhcpv6_get_lease_time_data                       _nxe_dhcpv6_get_lease_time_data
864 #define nx_dhcpv6_get_other_option_data                     _nxe_dhcpv6_get_other_option_data
865 #define nx_dhcpv6_get_DNS_server_address                    _nxe_dhcpv6_get_DNS_server_address
866 #define nx_dhcpv6_get_time_server_address                   _nxe_dhcpv6_get_time_server_address
867 #define nx_dhcpv6_get_time_accrued                          _nxe_dhcpv6_get_time_accrued
868 #define nx_dhcpv6_get_iana_lease_time                       _nxe_dhcpv6_get_iana_lease_time
869 #define nx_dhcpv6_get_valid_ip_address_count                _nxe_dhcpv6_get_valid_ip_address_count
870 #define nx_dhcpv6_get_valid_ip_address_lease_time           _nxe_dhcpv6_get_valid_ip_address_lease_time
871 #define nx_dhcpv6_reinitialize                              _nxe_dhcpv6_reinitialize
872 #define nx_dhcpv6_request_solicit                           _nxe_dhcpv6_request_solicit
873 #define nx_dhcpv6_request_solicit_rapid                     _nxe_dhcpv6_request_solicit_rapid
874 #define nx_dhcpv6_request_confirm                           _nxe_dhcpv6_request_confirm
875 #define nx_dhcpv6_request_release                           _nxe_dhcpv6_request_release
876 #define nx_dhcpv6_request_inform_request                    _nxe_dhcpv6_request_inform_request
877 #define nx_dhcpv6_request_option_DNS_server                 _nxe_dhcpv6_request_option_DNS_server
878 #define nx_dhcpv6_request_option_domain_name                _nxe_dhcpv6_request_option_domain_name
879 #define nx_dhcpv6_request_option_time_server                _nxe_dhcpv6_request_option_time_server
880 #define nx_dhcpv6_request_option_timezone                   _nxe_dhcpv6_request_option_timezone
881 #define nx_dhcpv6_request_option_FQDN                       _nxe_dhcpv6_request_option_FQDN
882 #define nx_dhcpv6_start                                     _nxe_dhcpv6_start
883 #define nx_dhcpv6_stop                                      _nxe_dhcpv6_stop
884 #define nx_dhcpv6_suspend                                   _nxe_dhcpv6_suspend
885 #define nx_dhcpv6_resume                                    _nxe_dhcpv6_resume
886 #define nx_dhcpv6_user_option_add_callback_set              _nxe_dhcpv6_user_option_add_callback_set
887 #ifdef NX_DHCPV6_CLIENT_RESTORE_STATE
888 #define nx_dhcpv6_client_get_record                         _nxe_dhcpv6_client_get_record
889 #define nx_dhcpv6_client_restore_record                     _nxe_dhcpv6_client_restore_record
890 #endif
891 
892 #endif
893 
894 /* Define the prototypes accessible to the application software.  */
895 UINT        nx_dhcpv6_client_create(NX_DHCPV6 *dhcpv6_ptr, NX_IP *ip_ptr, CHAR *name_ptr, NX_PACKET_POOL *packet_pool_ptr, VOID *stack_ptr, ULONG stack_size,
896                                     VOID (*dhcpv6_state_change_notify)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT old_state, UINT new_state),
897                                     VOID (*dhcpv6_server_error_handler)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT op_code, UINT status_code, UINT message_type));
898 UINT        nx_dhcpv6_client_delete(NX_DHCPV6 *dhcpv6_ptr);
899 UINT        nx_dhcpv6_create_client_duid(NX_DHCPV6 *dhcpv6_ptr, UINT duid_type, UINT hardware_type, ULONG time);
900 UINT        nx_dhcpv6_create_client_iana(NX_DHCPV6 *dhcpv6_ptr, UINT IA_ident, ULONG T1, ULONG T2);
901 UINT        nx_dhcpv6_create_client_ia(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ipv6_address, ULONG preferred_lifetime, ULONG valid_lifetime);
902 UINT        nx_dhcpv6_add_client_ia(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ipv6_address, ULONG preferred_lifetime, ULONG valid_lifetime);
903 UINT        nx_dhcpv6_client_set_interface(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index);
904 UINT        nx_dhcpv6_client_set_destination_address(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *destination_address);
905 UINT        nx_dhcpv6_set_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG time_accrued);
906 UINT        nx_dhcpv6_get_client_duid_time_id(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_id);
907 UINT        nx_dhcpv6_get_IP_address(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ip_address);
908 UINT        nx_dhcpv6_get_lease_time_data(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2, ULONG *preferred_lifetime, ULONG *valid_lifetime);
909 UINT        nx_dhcpv6_get_other_option_data(NX_DHCPV6 *dhcpv6_ptr, UINT option_code, UCHAR *buffer, UINT buffer_length);
910 UINT        nx_dhcpv6_get_DNS_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
911 UINT        nx_dhcpv6_get_time_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
912 UINT        nx_dhcpv6_get_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_accrued);
913 UINT        nx_dhcpv6_get_iana_lease_time(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2);
914 UINT        nx_dhcpv6_get_valid_ip_address_count(NX_DHCPV6 *dhcpv6_ptr, UINT *address_count);
915 UINT        nx_dhcpv6_get_valid_ip_address_lease_time(NX_DHCPV6 *dhcpv6_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *preferred_lifetime, ULONG *valid_lifetime);
916 UINT        nx_dhcpv6_reinitialize(NX_DHCPV6 *dhcpv6_ptr);
917 UINT        nx_dhcpv6_request_solicit(NX_DHCPV6 *dhcpv6_ptr);
918 UINT        nx_dhcpv6_request_solicit_rapid(NX_DHCPV6 *dhcpv6_ptr);
919 UINT        nx_dhcpv6_request_confirm(NX_DHCPV6 *dhcpv6_ptr);
920 UINT        nx_dhcpv6_request_release(NX_DHCPV6 *dhcpv6_ptr);
921 UINT        nx_dhcpv6_request_inform_request(NX_DHCPV6 *dhcpv6_ptr);
922 UINT        nx_dhcpv6_request_option_DNS_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
923 UINT        nx_dhcpv6_request_option_domain_name(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
924 UINT        nx_dhcpv6_request_option_time_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
925 UINT        nx_dhcpv6_request_option_timezone(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
926 UINT        nx_dhcpv6_request_option_FQDN(NX_DHCPV6 *dhcpv6_ptr, CHAR *domain_name, UINT op);
927 UINT        nx_dhcpv6_start(NX_DHCPV6 *dhcpv6_ptr);
928 UINT        nx_dhcpv6_stop(NX_DHCPV6 *dhcpv6_ptr);
929 UINT        nx_dhcpv6_suspend(NX_DHCPV6 *dhcpv6_ptr);
930 UINT        nx_dhcpv6_resume(NX_DHCPV6 *dhcpv6_ptr);
931 UINT        nx_dhcpv6_user_option_add_callback_set(NX_DHCPV6 *dhcpv6_ptr, UINT (*dhcpv6_user_option_add)(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
932 #ifdef NX_DHCPV6_CLIENT_RESTORE_STATE
933 UINT        nx_dhcpv6_client_get_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr);
934 UINT        nx_dhcpv6_client_restore_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr, ULONG time_elapsed);
935 #endif
936 
937 
938 #else
939 
940 /* DHCP source code is being compiled, do not perform any API mapping.  */
941 
942 UINT        _nxe_dhcpv6_client_create(NX_DHCPV6 *dhcpv6_ptr, NX_IP *ip_ptr, CHAR *name_ptr, NX_PACKET_POOL *packet_pool_ptr, VOID *stack_ptr, ULONG stack_size,
943                                       VOID (*dhcpv6_state_change_notify)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT old_state, UINT new_state),
944                                       VOID (*dhcpv6_server_error_handler)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT op_code, UINT status_code, UINT message_type));
945 UINT        _nx_dhcpv6_client_create(NX_DHCPV6 *dhcpv6_ptr, NX_IP *ip_ptr, CHAR *name_ptr, NX_PACKET_POOL *packet_pool_ptr, VOID *stack_ptr, ULONG stack_size,
946                                      VOID (*dhcpv6_state_change_notify)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT old_state, UINT new_state),
947                                      VOID (*dhcpv6_server_error_handler)(struct NX_DHCPV6_STRUCT *dhcpv6_ptr, UINT op_code, UINT status_code, UINT message_type));
948 UINT        _nxe_dhcpv6_client_delete(NX_DHCPV6 *dhcpv6_ptr);
949 UINT        _nx_dhcpv6_client_delete(NX_DHCPV6 *dhcpv6_ptr);
950 UINT        _nxe_dhcpv6_create_client_duid(NX_DHCPV6 *dhcpv6_ptr, UINT duid_type, UINT hardware_type, ULONG time);
951 UINT        _nx_dhcpv6_create_client_duid(NX_DHCPV6 *dhcpv6_ptr, UINT duid_type, UINT hardware_type, ULONG time);
952 UINT        _nxe_dhcpv6_create_client_iana(NX_DHCPV6 *dhcpv6_ptr, UINT IA_ident, ULONG T1, ULONG T2);
953 UINT        _nx_dhcpv6_create_client_iana(NX_DHCPV6 *dhcpv6_ptr, UINT IA_ident, ULONG T1, ULONG T2);
954 UINT        _nxe_dhcpv6_add_client_ia(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ipv6_address, ULONG preferred_lifetime, ULONG valid_lifetime);
955 UINT        _nx_dhcpv6_add_client_ia(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ipv6_address, ULONG preferred_lifetime, ULONG valid_lifetime);
956 UINT        _nxe_dhcpv6_client_set_interface(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index);
957 UINT        _nx_dhcpv6_client_set_interface(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index);
958 UINT        _nxe_dhcpv6_client_set_destination_address(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *destination_address);
959 UINT        _nx_dhcpv6_client_set_destination_address(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *destination_address);
960 UINT        _nxe_dhcpv6_set_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG time_accrued);
961 UINT        _nx_dhcpv6_set_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG time_accrued);
962 UINT        _nxe_dhcpv6_get_client_duid_time_id(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_id);
963 UINT        _nx_dhcpv6_get_client_duid_time_id(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_id);
964 UINT        _nxe_dhcpv6_get_IP_address(NX_DHCPV6 *dhcpv6_ptr,  NXD_ADDRESS *ip_address);
965 UINT        _nx_dhcpv6_get_IP_address(NX_DHCPV6 *dhcpv6_ptr, NXD_ADDRESS *ip_address);
966 UINT        _nxe_dhcpv6_get_lease_time_data(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2, ULONG *preferred_lifetime, ULONG *valid_lifetime);
967 UINT        _nx_dhcpv6_get_lease_time_data(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2, ULONG *preferred_lifetime, ULONG *valid_lifetime);
968 UINT        _nxe_dhcpv6_get_other_option_data(NX_DHCPV6 *dhcpv6_ptr, UINT option_code, UCHAR *buffer, UINT buffer_length);
969 UINT        _nx_dhcpv6_get_other_option_data(NX_DHCPV6 *dhcpv6_ptr, UINT option_code, UCHAR *buffer, UINT buffer_length);
970 UINT        _nxe_dhcpv6_get_DNS_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
971 UINT        _nx_dhcpv6_get_DNS_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
972 UINT        _nxe_dhcpv6_get_time_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
973 UINT        _nx_dhcpv6_get_time_server_address(NX_DHCPV6 *dhcpv6_ptr, UINT index, NXD_ADDRESS *server_address);
974 UINT        _nxe_dhcpv6_get_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_accrued);
975 UINT        _nx_dhcpv6_get_time_accrued(NX_DHCPV6 *dhcpv6_ptr, ULONG *time_accrued);
976 UINT        _nxe_dhcpv6_get_iana_lease_time(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2);
977 UINT        _nx_dhcpv6_get_iana_lease_time(NX_DHCPV6 *dhcpv6_ptr, ULONG *T1, ULONG *T2);
978 UINT        _nxe_dhcpv6_get_valid_ip_address_count(NX_DHCPV6 *dhcpv6_ptr, UINT *address_count);
979 UINT        _nx_dhcpv6_get_valid_ip_address_count(NX_DHCPV6 *dhcpv6_ptr, UINT *address_count);
980 UINT        _nxe_dhcpv6_get_valid_ip_address_lease_time(NX_DHCPV6 *dhcpv6_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *preferred_lifetime, ULONG *valid_lifetime);
981 UINT        _nx_dhcpv6_get_valid_ip_address_lease_time(NX_DHCPV6 *dhcpv6_ptr, UINT address_index, NXD_ADDRESS *ip_address, ULONG *preferred_lifetime, ULONG *valid_lifetime);
982 UINT        _nxe_dhcpv6_reinitialize(NX_DHCPV6 *dhcpv6_ptr);
983 UINT        _nx_dhcpv6_reinitialize(NX_DHCPV6 *dhcpv6_ptr);
984 UINT        _nxe_dhcpv6_request_solicit(NX_DHCPV6 *dhcpv6_ptr);
985 UINT        _nx_dhcpv6_request_solicit(NX_DHCPV6 *dhcpv6_ptr);
986 UINT        _nxe_dhcpv6_request_solicit_rapid(NX_DHCPV6 *dhcpv6_ptr);
987 UINT        _nx_dhcpv6_request_solicit_rapid(NX_DHCPV6 *dhcpv6_ptr);
988 UINT        _nxe_dhcpv6_request_confirm(NX_DHCPV6 *dhcpv6_ptr);
989 UINT        _nx_dhcpv6_request_confirm(NX_DHCPV6 *dhcpv6_ptr);
990 UINT        _nxe_dhcpv6_request_release(NX_DHCPV6 *dhcpv6_ptr);
991 UINT        _nx_dhcpv6_request_release(NX_DHCPV6 *dhcpv6_ptr);
992 UINT        _nxe_dhcpv6_request_inform_request(NX_DHCPV6 *dhcpv6_ptr);
993 UINT        _nx_dhcpv6_request_inform_request(NX_DHCPV6 *dhcpv6_ptr);
994 UINT        _nxe_dhcpv6_request_option_DNS_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
995 UINT        _nx_dhcpv6_request_option_DNS_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
996 UINT        _nxe_dhcpv6_request_option_domain_name(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
997 UINT        _nx_dhcpv6_request_option_domain_name(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
998 UINT        _nxe_dhcpv6_request_option_time_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
999 UINT        _nx_dhcpv6_request_option_time_server(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
1000 UINT        _nxe_dhcpv6_request_option_timezone(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
1001 UINT        _nx_dhcpv6_request_option_timezone(NX_DHCPV6 *dhcpv6_ptr, UINT enable);
1002 UINT        _nxe_dhcpv6_request_option_FQDN(NX_DHCPV6 *dhcpv6_ptr, CHAR *domain_name, UINT op);
1003 UINT        _nx_dhcpv6_request_option_FQDN(NX_DHCPV6 *dhcpv6_ptr, CHAR *domain_name, UINT op);
1004 UINT        _nxe_dhcpv6_start(NX_DHCPV6 *dhcpv6_ptr);
1005 UINT        _nx_dhcpv6_start(NX_DHCPV6 *dhcpv6_ptr);
1006 UINT        _nxe_dhcpv6_stop(NX_DHCPV6 *dhcpv6_ptr);
1007 UINT        _nx_dhcpv6_stop(NX_DHCPV6 *dhcpv6_ptr);
1008 UINT        _nxe_dhcpv6_suspend(NX_DHCPV6 *dhcpv6_ptr);
1009 UINT        _nx_dhcpv6_suspend(NX_DHCPV6 *dhcpv6_ptr);
1010 UINT        _nxe_dhcpv6_resume(NX_DHCPV6 *dhcpv6_ptr);
1011 UINT        _nx_dhcpv6_resume(NX_DHCPV6 *dhcpv6_ptr);
1012 UINT        _nxe_dhcpv6_user_option_add_callback_set(NX_DHCPV6 *dhcpv6_ptr, UINT (*dhcpv6_user_option_add)(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
1013 UINT        _nx_dhcpv6_user_option_add_callback_set(NX_DHCPV6 *dhcpv6_ptr, UINT (*dhcpv6_user_option_add)(NX_DHCPV6 *dhcpv6_ptr, UINT interface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
1014 #ifdef NX_DHCPV6_CLIENT_RESTORE_STATE
1015 UINT        _nxe_dhcpv6_client_get_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr);
1016 UINT        _nx_dhcpv6_client_get_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr);
1017 UINT        _nxe_dhcpv6_client_restore_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr, ULONG time_elapsed);
1018 UINT        _nx_dhcpv6_client_restore_record(NX_DHCPV6 *dhcpv6_ptr, NX_DHCPV6_CLIENT_RECORD *client_record_ptr, ULONG time_elapsed);
1019 #endif
1020 
1021 #endif
1022 
1023 
1024 /* Define DHCPv6 Client internal functions. */
1025 
1026 VOID        _nx_dhcpv6_thread_entry(ULONG info);
1027 VOID        _nx_dhcpv6_process(NX_DHCPV6 *dhcpv6_ptr);
1028 UINT        _nx_dhcpv6_request(NX_DHCPV6 *dhcpv6_ptr, UINT dhcpv6_state);
1029 UINT        _nx_dhcpv6_request_renew(NX_DHCPV6 *dhcpv6_ptr);
1030 UINT        _nx_dhcpv6_request_rebind(NX_DHCPV6 *dhcpv6_ptr);
1031 UINT        _nx_dhcpv6_request_decline(NX_DHCPV6 *dhcpv6_ptr);
1032 UINT        _nx_dhcpv6_send_request(NX_DHCPV6 *dhcpv6_ptr);
1033 UINT        _nx_dhcpv6_add_client_duid(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1034 UINT        _nx_dhcpv6_add_elapsed_time(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1035 UINT        _nx_dhcpv6_add_option_request(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1036 UINT        _nx_dhcpv6_add_ia_address(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index, UINT ia_index);
1037 UINT        _nx_dhcpv6_add_iana(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1038 UINT        _nx_dhcpv6_add_server_duid(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1039 UINT        _nx_dhcpv6_add_client_FQDN(NX_DHCPV6 *dhcpv6_ptr, UCHAR *buffer_ptr, UINT *index);
1040 UINT        _nx_dhcpv6_waiting_on_reply(NX_DHCPV6 *dhcpv6_ptr);
1041 UINT        _nx_dhcpv6_packet_process(NX_DHCPV6 *dhcpv6_ptr, NX_PACKET *packet_ptr);
1042 UINT        _nx_dhcpv6_scan_packet_options(NX_DHCPV6 *dhcpv6_ptr, NX_PACKET *packet_ptr);
1043 UINT        _nx_dhcpv6_preprocess_packet_information(NX_DHCPV6 *dhcpv6_ptr, NX_PACKET *packet_ptr);
1044 UINT        _nx_dhcpv6_extract_packet_information(NX_DHCPV6 *dhcpv6_ptr, NX_PACKET *packet_ptr);
1045 VOID        _nx_dhcpv6_flush_queue_packets(NX_DHCPV6 *dhcpv6_ptr);
1046 UINT        _nx_dhcpv6_process_client_duid(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1047 UINT        _nx_dhcpv6_process_DNS_server(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1048 UINT        _nx_dhcpv6_process_domain_name(NX_DHCPV6 *dhcpv6_ptr, UCHAR *packet_start, UCHAR *option_data, UINT option_length);
1049 UINT        _nx_dhcpv6_process_ia(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length, UINT ia_index);
1050 UINT        _nx_dhcpv6_process_iana(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1051 UINT        _nx_dhcpv6_process_preference(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1052 UINT        _nx_dhcpv6_process_server_duid(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1053 UINT        _nx_dhcpv6_process_status(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1054 UINT        _nx_dhcpv6_process_time_zone(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1055 UINT        _nx_dhcpv6_process_time_server(NX_DHCPV6 *dhcpv6_ptr, UCHAR *option_data, UINT option_length);
1056 VOID        _nx_dhcpv6_IP_lifetime_timeout_entry(ULONG dhcpv6_ptr_value);
1057 VOID        _nx_dhcpv6_session_timeout_entry(ULONG dhcpv6_ptr_value);
1058 UINT        _nx_dhcpv6_utility_get_block_option_length(UCHAR *buffer_ptr, ULONG *option, ULONG *length);
1059 UINT        _nx_dhcpv6_utility_get_data(UCHAR *buffer, UINT size, ULONG *value);
1060 INT         _nx_dhcpv6_utility_time_randomize(void);
1061 UINT        _nx_dhcpv6_update_retransmit_info(NX_DHCPV6 *dhcpv6_ptr);
1062 UINT        _nx_dhcpv6_register_IP_address(NX_DHCPV6 *dhcpv6_ptr);
1063 UINT        _nx_dhcpv6_remove_assigned_address(NX_DHCPV6 *dhcpv6_ptr, UINT ia_index);
1064 UINT        _nx_dhcpv6_name_string_encode(UCHAR *ptr, UCHAR *name);
1065 UINT        _nx_dhcpv6_name_string_unencode(UCHAR *data, UINT start, UCHAR *buffer, UINT size);
1066 #if !defined (NX_DISABLE_IPV6_DAD) && defined (NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY)
1067 VOID        _nx_dhcpv6_ipv6_address_DAD_notify(NX_IP *ip_ptr, UINT status, UINT interface_index, UINT ipv6_addr_index, ULONG *ipv6_address);
1068 #endif
1069 
1070 /* Determine if a C++ compiler is being used.  If so, complete the standard
1071    C conditional started above.  */
1072 #ifdef   __cplusplus
1073         }
1074 #endif
1075 
1076 #endif /* NX_DHCPV6_CLIENT_H */
1077 
1078 
1079