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 (DHCP)                          */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
27 /*                                                                        */
28 /*    nxd_dhcp_client.h                                   PORTABLE C      */
29 /*                                                           6.1.10       */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Yuxin Zhou, Microsoft Corporation                                   */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the NetX Dynamic Host Configuration Protocol      */
37 /*    (DHCP) component, including all data types and external references. */
38 /*    It is assumed that nx_api.h and nx_port.h have already been         */
39 /*    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),          */
47 /*                                            resulting in version 6.1    */
48 /*  08-02-2021     Yuxin Zhou               Modified comment(s), supported*/
49 /*                                            adding additional request   */
50 /*                                            option in parameter request,*/
51 /*                                            resulting in version 6.1.8  */
52 /*  01-31-2022     Yuxin Zhou               Modified comment(s), supported*/
53 /*                                            multiple client instances,  */
54 /*                                            resulting in version 6.1.10 */
55 /*                                                                        */
56 /**************************************************************************/
57 
58 #ifndef NXD_DHCP_CLIENT_H
59 #define NXD_DHCP_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 #include "nx_udp.h"
73 #include "nx_ip.h"
74 
75 
76 /* Enable BOOTP protocol instead of DHCP, define this option.
77 #define NX_DHCP_ENABLE_BOOTP
78 */
79 
80 /*  Enable support for client state preserved between reboots
81 #define NX_DHCP_CLIENT_RESTORE_STATE
82 */
83 
84 /* Enable the DHCP Client to accept a pointer to the DHCP packet pool.
85 #define NX_DHCP_CLIENT_USER_CREATE_PACKET_POOL
86 */
87 
88 /* Enables an ARP probe for verifying the assigned DHCP address is
89    not owned by another host.  This is recommended, but not required by RFC 2131 (4.4.1).
90 #define NX_DHCP_CLIENT_SEND_ARP_PROBE
91 */
92 
93 /* Enables DHCP Client send Maximum DHCP Message Size Option. RFC2132, Section9.10, Page29.
94 #define NX_DHCP_CLIENT_SEND_MAX_DHCP_MESSAGE_OPTION
95 */
96 
97 /* Defined, the host name is checked, the host name must follow the rules for ARPANET host names.
98    RFC 1035, Section 2.3.1, Page 8.  The default is disabled.
99 #define NX_DHCP_CLIENT_ENABLE_HOST_NAME_CHECK
100 */
101 
102 /* Define the DHCP ID that is used to mark the DHCP structure as created.  */
103 #define NX_DHCP_ID                      0x44484350UL
104 
105 
106 /* Define the DHCP stack size.  */
107 #ifndef NX_DHCP_THREAD_STACK_SIZE
108 #define NX_DHCP_THREAD_STACK_SIZE       (4096)
109 #endif
110 
111 
112 /* Define the number of interfaces the Client is running on. This can be any
113    size but practically speaking should be less than or equal to the number
114    of physical interfaces attached to the IP instance (NX_MAX_PHYSICAL_INTERFACES).  */
115 /* Note: User can redefine the symbol to reduce the size of records if the dhcp interfaces
116          are less than true physical interfaces.
117    For example: There are three physical interfaces, but only two interfaces enable DHCP,
118                 the recommended value for NX_DHCP_CLIENT_MAX_RECORDS should be 2.  */
119 #ifndef NX_DHCP_CLIENT_MAX_RECORDS
120 #define NX_DHCP_CLIENT_MAX_RECORDS      (NX_MAX_PHYSICAL_INTERFACES)
121 #endif
122 
123 
124 /* Define the DHCP stack priority. This priority must be high enough to insure the
125    DHCP client gets scheduled promptly, and thus assigned an IP address.  Assigning
126    it a higher priority increases the risk of 'starving' out the IP thread task which
127    needs to initialize the network driver (which is required to be able to transmit packets). */
128 #ifndef NX_DHCP_THREAD_PRIORITY
129 #define NX_DHCP_THREAD_PRIORITY         3
130 #endif
131 
132 
133 /* Define DHCP timer expiration interval. */
134 #ifndef NX_DHCP_TIME_INTERVAL
135 #define NX_DHCP_TIME_INTERVAL          (1 * NX_IP_PERIODIC_RATE)
136 #endif
137 
138 
139 /* Define the max number of user request parameter.
140    Subnet mask, gateway and dns server options are added in _nx_dhcp_request_parameters arrary by default.  */
141 #ifndef NX_DHCP_CLIENT_MAX_USER_REQUEST_PARAMETER
142 #define NX_DHCP_CLIENT_MAX_USER_REQUEST_PARAMETER 4
143 #endif /* NX_DHCP_CLIENT_MAX_USER_REQUEST_PARAMETER */
144 
145 
146 /* Define the size of DHCP options buffer.  */
147 /* A DHCP client must be prepared to receive DHCP messages with an 'options' field of
148    at least length 312 octets. RFC 2131; Section 2. Protocol Summary.  */
149 #ifndef NX_DHCP_OPTIONS_BUFFER_SIZE
150 #define NX_DHCP_OPTIONS_BUFFER_SIZE     312
151 #endif
152 
153 
154 /* Define the size of the BOOT buffer. This should be large enough for all the
155    required DHCP header fields plus the minimum requirement of 312 bytes of option data
156    (total: 548 bytes) as per RFC 2131; Section 2. Protocol Summary. */
157 #define NX_BOOT_CLIENT_BUFFER_SIZE      548
158 
159 
160 /* Define the minimum IP datafram size as per RFC 2131; Section 2. Protocol Summary.
161    A DHCP Client must be prepared to receive a message of up to 576 bytes:
162    IP header(20 bytes), UDP header (8 bytes), required DHCP header fields (236 bytes)
163    and the minimum requirement of option data(312 bytes).  */
164 #define NX_DHCP_MINIMUM_IP_DATAGRAM     576
165 
166 
167 /* Define the packet payload size, keeping in mind the DHCP Client must be prepared to
168    receive a message of up to 576 octets and allow room for physical network header,
169    as per RFC 2131; Section 2. Protocol Summary.  */
170 #ifndef NX_DHCP_PACKET_PAYLOAD
171 #define NX_DHCP_PACKET_PAYLOAD          (NX_DHCP_MINIMUM_IP_DATAGRAM + NX_PHYSICAL_HEADER)
172 #endif /* NX_DHCP_PACKET_PAYLOAD */
173 
174 
175 /* Define the packet pool size.  */
176 #ifndef NX_DHCP_PACKET_POOL_SIZE
177 #define NX_DHCP_PACKET_POOL_SIZE        (5 * NX_DHCP_PACKET_PAYLOAD)
178 #endif
179 
180 
181 /* Define time out options for retransmission in seconds.  */
182 /* Define the minimum amount of time to retransmit a DHCP IP address request. The
183    recommended wait time is 4 seconds in RFC 2131. */
184 #ifndef NX_DHCP_MIN_RETRANS_TIMEOUT
185 #define NX_DHCP_MIN_RETRANS_TIMEOUT     (4 * NX_IP_PERIODIC_RATE)
186 #endif
187 
188 
189 /* Define the maximum amount of time to retransmit a DHCP IP address request. The
190    recommended wait time is 64 seconds in RFC 2131. */
191 #ifndef NX_DHCP_MAX_RETRANS_TIMEOUT
192 #define NX_DHCP_MAX_RETRANS_TIMEOUT     (64 * NX_IP_PERIODIC_RATE)
193 #endif
194 
195 
196 /* Define the minimum amount of time to retransmit a DHCP renew/rebind request. The
197    recommended wait time is 60 seconds in RFC 2131. */
198 #ifndef NX_DHCP_MIN_RENEW_TIMEOUT
199 #define NX_DHCP_MIN_RENEW_TIMEOUT      (60 * NX_IP_PERIODIC_RATE)
200 #endif
201 
202 
203 /* Define UDP socket create options.  */
204 #ifndef NX_DHCP_TYPE_OF_SERVICE
205 #define NX_DHCP_TYPE_OF_SERVICE         NX_IP_NORMAL
206 #endif
207 
208 #ifndef NX_DHCP_FRAGMENT_OPTION
209 #define NX_DHCP_FRAGMENT_OPTION         NX_DONT_FRAGMENT
210 #endif
211 
212 #ifndef NX_DHCP_TIME_TO_LIVE
213 #define NX_DHCP_TIME_TO_LIVE            0x80
214 #endif
215 
216 #ifndef NX_DHCP_QUEUE_DEPTH
217 #define NX_DHCP_QUEUE_DEPTH             4
218 #endif
219 
220 
221 #ifdef NX_DHCP_CLIENT_SEND_ARP_PROBE
222 
223 /* Define the timing and retry constants for ARP probe. RFC5227, Section1.1, Page 5.  */
224 #ifndef NX_DHCP_ARP_PROBE_WAIT
225 #define NX_DHCP_ARP_PROBE_WAIT          (1 * NX_IP_PERIODIC_RATE)
226 #endif
227 
228 /* Define the number of ARP probes sent. */
229 #ifndef NX_DHCP_ARP_PROBE_NUM
230 #define NX_DHCP_ARP_PROBE_NUM           3
231 #endif
232 
233 /* Define the minimum and maximum variation in the interval between ARP probe transmissions. */
234 #ifndef NX_DHCP_ARP_PROBE_MIN
235 #define NX_DHCP_ARP_PROBE_MIN           (1 * NX_IP_PERIODIC_RATE)
236 #endif
237 
238 #ifndef NX_DHCP_ARP_PROBE_MAX
239 #define NX_DHCP_ARP_PROBE_MAX           (2 * NX_IP_PERIODIC_RATE)
240 #endif
241 #endif /* NX_DHCP_CLIENT_SEND_ARP_PROBE  */
242 
243 
244 /*  Define the wait time before restarting the configuration process when DHCP detects that the address is
245     already in use.
246 
247     The client SHOULD wait a minimum of ten seconds before restarting the configuration process
248     to avoid excessive network traffic in case of looping. RFC2131, Section 3.1, Page 17.  */
249 #ifndef NX_DHCP_RESTART_WAIT
250 #define NX_DHCP_RESTART_WAIT            (10 * NX_IP_PERIODIC_RATE)
251 #endif
252 
253 
254 /* Define the BootP Message Area Offsets.  The DHCP message format is identical to that of BootP, except
255    for the Vendor options that start at the offset specified by NX_BOOTP_OFFSET_OPTIONS.  */
256 #define NX_BOOTP_OFFSET_OP              0       /* 1 BootP Operation 1=req, 2=reply                         */
257 #define NX_BOOTP_OFFSET_HTYPE           1       /* 1 Hardware type 1 = Ethernet                             */
258 #define NX_BOOTP_OFFSET_HLEN            2       /* 1 Hardware address length, 6 for Ethernet                */
259 #define NX_BOOTP_OFFSET_HOPS            3       /* 1 Number of hops, usually 0                              */
260 #define NX_BOOTP_OFFSET_XID             4       /* 4 Transaction ID, pseudo random number                   */
261 #define NX_BOOTP_OFFSET_SECS            8       /* 2 Seconds since boot                                     */
262 #define NX_BOOTP_OFFSET_FLAGS           10      /* 2 Flags, 0x80 = Broadcast response, 0 = unicast response */
263 #define NX_BOOTP_OFFSET_CLIENT_IP       12      /* 4 Initial client IP, used as dest for unicast response   */
264 #define NX_BOOTP_OFFSET_YOUR_IP         16      /* 4 Assigned IP, initialized to 0.0.0.0                    */
265 #define NX_BOOTP_OFFSET_SERVER_IP       20      /* 4 Server IP, usually initialized to 0.0.0.0              */
266 #define NX_BOOTP_OFFSET_GATEWAY_IP      24      /* 4 gateway IP, usually 0.0.0.0, only for BootP and TFTP   */
267 #define NX_BOOTP_OFFSET_CLIENT_HW       28      /* 16 Client hardware address                               */
268 #define NX_BOOTP_OFFSET_SERVER_NM       44      /* 64 Server name, nulls if unused                          */
269 #define NX_BOOTP_OFFSET_BOOT_FILE       108     /* 128 Boot file name, null if unused                       */
270 #define NX_BOOTP_OFFSET_VENDOR          236     /* 64 Vendor options, set first 4 bytes to a magic number   */
271 #define NX_BOOTP_OFFSET_OPTIONS         240     /* First variable vendor option                             */
272 #define NX_BOOTP_OFFSET_END             300     /* End of BOOTP buffer                                      */
273 
274 
275 /* Define the DHCP Specific Vendor Extensions. */
276 #define NX_DHCP_OPTION_PAD              0
277 #define NX_DHCP_OPTION_PAD_SIZE         0
278 #define NX_DHCP_OPTION_SUBNET_MASK      1
279 #define NX_DHCP_OPTION_SUBNET_MASK_SIZE 4
280 #define NX_DHCP_OPTION_TIME_OFFSET      2
281 #define NX_DHCP_OPTION_TIME_OFFSET_SIZE 4
282 #define NX_DHCP_OPTION_GATEWAYS         3
283 #define NX_DHCP_OPTION_TIMESVR          4
284 #define NX_DHCP_OPTION_DNS_SVR          6
285 #define NX_DHCP_OPTION_HOST_NAME        12
286 #define NX_DHCP_OPTION_DNS_NAME         15
287 #define NX_DHCP_OPTION_NTP_SVR          42
288 #define NX_DHCP_OPTION_VENDOR_OPTIONS   43
289 #define NX_DHCP_OPTION_DHCP_IP_REQ      50
290 #define NX_DHCP_OPTION_DHCP_IP_REQ_SIZE 4
291 #define NX_DHCP_OPTION_DHCP_LEASE       51
292 #define NX_DHCP_OPTION_DHCP_LEASE_SIZE  4
293 #define NX_DHCP_OPTION_DHCP_TYPE        53
294 #define NX_DHCP_OPTION_DHCP_TYPE_SIZE   1
295 #define NX_DHCP_OPTION_DHCP_SERVER      54
296 #define NX_DHCP_OPTION_DHCP_SERVER_SIZE 4
297 #define NX_DHCP_OPTION_DHCP_PARAMETERS  55
298 #define NX_DHCP_OPTION_DHCP_MESSAGE     56
299 #define NX_DHCP_OPTION_MAX_DHCP_MESSAGE 57
300 #define NX_DHCP_OPTION_RENEWAL          58
301 #define NX_DHCP_OPTION_RENEWAL_SIZE     4
302 #define NX_DHCP_OPTION_REBIND           59
303 #define NX_DHCP_OPTION_REBIND_SIZE      4
304 #define NX_DHCP_OPTION_CLIENT_ID        61
305 #define NX_DHCP_OPTION_CLIENT_ID_SIZE   7 /* 1 byte for address type (01 = Ethernet), 6 bytes for address */
306 #define NX_DHCP_OPTION_FDQN             81
307 #define NX_DHCP_OPTION_FDQN_FLAG_N      8
308 #define NX_DHCP_OPTION_FDQN_FLAG_E      4
309 #define NX_DHCP_OPTION_FDQN_FLAG_O      2
310 #define NX_DHCP_OPTION_FDQN_FLAG_S      1
311 #define NX_DHCP_OPTION_END              255
312 #define NX_DHCP_OPTION_END_SIZE         0
313 
314 
315 /* Define various BootP/DHCP constants.  */
316 #define NX_DHCP_SERVER_UDP_PORT         67
317 #define NX_DHCP_SERVER_TCP_PORT         67
318 #define NX_DHCP_CLIENT_UDP_PORT         68
319 #define NX_DHCP_CLIENT_TCP_PORT         68
320 
321 #define NX_BOOTP_OP_REQUEST             1
322 #define NX_BOOTP_OP_REPLY               2
323 #define NX_BOOTP_TYPE_ETHERNET          1
324 #define NX_BOOTP_HLEN_ETHERNET          6
325 #define NX_BOOTP_FLAGS_BROADCAST        0x80
326 #define NX_BOOTP_FLAGS_UNICAST          0x00
327 #define NX_BOOTP_MAGIC_COOKIE           IP_ADDRESS(99, 130, 83, 99)
328 #define NX_BOOTP_NO_ADDRESS             IP_ADDRESS(0, 0, 0, 0)
329 #define NX_BOOTP_BC_ADDRESS             IP_ADDRESS(255, 255, 255, 255)
330 #define NX_AUTO_IP_ADDRESS              IP_ADDRESS(169, 254, 0, 0)
331 #define NX_AUTO_IP_ADDRESS_MASK         0xFFFF0000UL
332 
333 #define NX_DHCP_INFINITE_LEASE          0xffffffffUL
334 
335 
336 /* Define the DHCP Message Types.  */
337 #define NX_DHCP_TYPE_DHCPDISCOVER       1
338 #define NX_DHCP_TYPE_DHCPOFFER          2
339 #define NX_DHCP_TYPE_DHCPREQUEST        3
340 #define NX_DHCP_TYPE_DHCPDECLINE        4
341 #define NX_DHCP_TYPE_DHCPACK            5
342 #define NX_DHCP_TYPE_DHCPNACK           6
343 #define NX_DHCP_TYPE_DHCPRELEASE        7
344 #define NX_DHCP_TYPE_DHCPINFORM         8
345 #define NX_DHCP_TYPE_DHCPFORCERENEW     9
346 #ifdef NX_DHCP_ENABLE_BOOTP
347 #define NX_DHCP_TYPE_BOOT_REQUEST       10
348 #endif
349 
350 
351 /* Define the states of the DHCP state machine.  */
352 #define NX_DHCP_STATE_NOT_STARTED       0       /* Not started                                              */
353 #define NX_DHCP_STATE_BOOT              1       /* Started with a previous address                          */
354 #define NX_DHCP_STATE_INIT              2       /* Started with no previous address                         */
355 #define NX_DHCP_STATE_SELECTING         3       /* Waiting to identify a DHCP server                        */
356 #define NX_DHCP_STATE_REQUESTING        4       /* Address requested, waiting for the Ack                   */
357 #define NX_DHCP_STATE_BOUND             5       /* Address established, no time outs                        */
358 #define NX_DHCP_STATE_RENEWING          6       /* Address established, renewal time out                    */
359 #define NX_DHCP_STATE_REBINDING         7       /* Address established, renewal and rebind time out         */
360 #define NX_DHCP_STATE_FORCERENEW        8       /* Address established, force renewal                       */
361 #define NX_DHCP_STATE_ADDRESS_PROBING   9       /* Address probing, address conflict detection              */
362 
363 /* Define error codes from DHCP API.  */
364 #define NX_DHCP_ERROR                   0x90    /* General DHCP error code                                  */
365 #define NX_DHCP_NO_RESPONSE             0x91    /* No response from server for option request               */
366 #define NX_DHCP_BAD_IP_ADDRESS          0x92    /* Bad IP address or invalid interface input                */
367 #define NX_DHCP_ALREADY_STARTED         0x93    /* DHCP was already started                                 */
368 #define NX_DHCP_NOT_BOUND               0x94    /* DHCP is not in a bound state                             */
369 #define NX_DHCP_DEST_TO_SMALL           0x95    /* DHCP response is too big for destination                 */
370 #define NX_DHCP_NOT_STARTED             0x96    /* DHCP was not started when stop was issued                */
371 #define NX_DHCP_PARSE_ERROR             0x97    /* Error extracting DHCP option data                        */
372 #define NX_DHCP_BAD_XID                 0x98    /* DHCP packet received with mismatched XID                 */
373 #define NX_DHCP_BAD_MAC_ADDRESS         0x99    /* DHCP packet received with mismatched MAC address         */
374 #define NX_DHCP_INVALID_MESSAGE         0x9B    /* Invalid message received or requested to send            */
375 #define NX_DHCP_INVALID_PAYLOAD         0x9C    /* Client receives DHCP message exceeding packet payload    */
376 #define NX_DHCP_INVALID_IP_REQUEST      0x9D    /* Null IP address input for requesting IP address          */
377 #define NX_DHCP_UNKNOWN_OPTION          0x9F    /* This option is unknow.                                   */
378 #define NX_DHCP_INTERFACE_ALREADY_ENABLED 0xA3  /* Interface is already enabled                             */
379 #define NX_DHCP_INTERFACE_NOT_ENABLED   0xA4    /* If interface not enabled for DHCP interaction            */
380 #define NX_DHCP_NO_INTERFACES_ENABLED   0xA5    /* No interfaces enabled for DHCP interaction               */
381 #define NX_DHCP_NO_INTERFACES_STARTED   0xA6    /* If DHCP CLient fails to start any interfacers            */
382 #define NX_DHCP_NO_RECORDS_AVAILABLE    0xA7    /* No Client record available to start DHCP on an interface */
383 #define NX_DHCP_INVALID_NAME            0xA8    /* Client host name has invalid characters                  */
384 
385 
386 /* Define DHCP Client thread events.  */
387 #define NX_DHCP_CLIENT_RECEIVE_EVENT    0x00000001        /* DHCP Server data received                            */
388 #define NX_DHCP_CLIENT_TIMER_EVENT      0x00000002        /* DHCP timer expires                                   */
389 #define NX_DHCP_CLIENT_CONFLICT_EVENT   0x00000004        /* IP conflict event detected                           */
390 #define NX_DHCP_CLIENT_ALL_EVENTS       0xFFFFFFFF        /* All DHCP events                                      */
391 
392 
393 #ifdef NX_DHCP_CLIENT_RESTORE_STATE
394 
395 /* Define a Client record for restore DHCP Client state from non volatile memory/across reboots. */
396 typedef struct NX_DHCP_CLIENT_RECORD_STRUCT
397 {
398     UCHAR           nx_dhcp_state;              /* The current state of the DHCP Client                     */
399     ULONG           nx_dhcp_ip_address;         /* Server assigned IP Address                               */
400     ULONG           nx_dhcp_network_mask;       /* Server assigned network mask                             */
401     ULONG           nx_dhcp_gateway_address;    /* Server assigned gateway address                          */
402     UINT            nx_dhcp_interface_index;    /* Index of DHCP Client network interface                   */
403     ULONG           nx_dhcp_timeout;            /* The current value of any timeout, in seconds             */
404     ULONG           nx_dhcp_server_ip;          /* The server IP Address                                    */
405     ULONG           nx_dhcp_lease_remain_time;  /* Time remaining before lease expires                      */
406     ULONG           nx_dhcp_lease_time;         /* The current Lease Time in seconds                        */
407     ULONG           nx_dhcp_renewal_time;       /* Renewal Time in seconds                                  */
408     ULONG           nx_dhcp_rebind_time;        /* Rebind Time in seconds                                   */
409     ULONG           nx_dhcp_renewal_remain_time;/* Time remaining to renew (before rebinding necessary)     */
410     ULONG           nx_dhcp_rebind_remain_time; /* Time remaining to rebind (before lease expires)          */
411 } NX_DHCP_CLIENT_RECORD;
412 #endif /* NX_DHCP_CLIENT_RESTORE_STATE */
413 
414 /* Define the DHCP interface record that contains all the information necessary for a DHCP
415    instance on each interface.  */
416 typedef struct NX_DHCP_INTERFACE_RECORD_STRUCT
417 {
418     UCHAR           nx_dhcp_record_valid;       /* The flag indicate this record is valid. NX_TRUE: valid   */
419     UCHAR           nx_dhcp_state;              /* The current state of the DHCP Client                     */
420     UCHAR           nx_dhcp_user_option;        /* User option request                                      */
421     UCHAR           reserved;
422     ULONG           nx_dhcp_xid;                /* Unique transaction ID                                    */
423     ULONG           nx_dhcp_seconds;            /* Track number of seconds for a DHCP request process       */
424     ULONG           nx_dhcp_ip_address;         /* Server assigned IP Address                               */
425     ULONG           nx_dhcp_gateway_address;    /* Server assigned gateway address                          */
426     ULONG           nx_dhcp_server_ip;          /* The server IP Address                                    */
427     ULONG           nx_dhcp_network_mask;       /* Server assigned network mask                             */
428     UINT            nx_dhcp_interface_index;    /* Index of DHCP Client network interface                   */
429     ULONG           nx_dhcp_timeout;            /* Count down timer for sending out DHCP message            */
430     ULONG           nx_dhcp_rtr_interval;       /* Interval between sending out another DHCP message        */
431     ULONG           nx_dhcp_lease_remain_time;  /* Time remaining before lease expires                      */
432     ULONG           nx_dhcp_lease_time;         /* The current Lease Time in seconds                        */
433     ULONG           nx_dhcp_renewal_time;       /* Renewal Time in seconds                                  */
434     ULONG           nx_dhcp_rebind_time;        /* Rebind Time in seconds                                   */
435     ULONG           nx_dhcp_renewal_remain_time;/* Time remaining to renew (before rebinding necessary)     */
436     ULONG           nx_dhcp_rebind_remain_time; /* Time remaining to rebind (before lease expires)          */
437 #ifdef NX_DHCP_CLIENT_SEND_ARP_PROBE
438     UINT            nx_dhcp_probe_count;        /* Number of ARP probes to send to prove IP address unique  */
439 #endif
440     UINT            nx_dhcp_clear_broadcast;    /* Client sends messages with unicast reply requested       */
441     UINT            nx_dhcp_skip_discovery;     /* Indicate if host should skip the discovery message       */
442     UCHAR           nx_dhcp_options_buffer[NX_DHCP_OPTIONS_BUFFER_SIZE];
443     UINT            nx_dhcp_options_size;       /* The total size of DHCP options.                          */
444 
445     ULONG           nx_dhcp_internal_errors;    /* The number of internal DHCP errors encountered           */
446     ULONG           nx_dhcp_discoveries_sent;   /* The number of Discovery sent by the Client               */
447     ULONG           nx_dhcp_offers_received;    /* The number of Offers received by the Client              */
448     ULONG           nx_dhcp_requests_sent;      /* The number of Request attempts made by the Client        */
449     ULONG           nx_dhcp_acks_received;      /* The number of ACKs received by the Client                */
450     ULONG           nx_dhcp_nacks_received;     /* The number of NACKs received by the Client               */
451     ULONG           nx_dhcp_releases_sent;      /* The number of Releases sent by the Client                */
452     ULONG           nx_dhcp_declines_sent;      /* The number of Declines sent by the Client                */
453     ULONG           nx_dhcp_force_renewal_rec;  /* The number of Forced Renewal received by the Client      */
454     ULONG           nx_dhcp_informs_sent;       /* The number of Inform (option requests) sent by the Client*/
455     ULONG           nx_dhcp_inform_responses;   /* The number of Inform responses                           */
456 
457 } NX_DHCP_INTERFACE_RECORD;
458 
459 
460 /* Define the DHCP structure that contains all information common to all interfaces on
461    which DHCP Client may run.  */
462 typedef struct NX_DHCP_STRUCT
463 {
464 
465     ULONG           nx_dhcp_id;                 /* DHCP Structure ID                                        */
466     CHAR           *nx_dhcp_name;               /* DHCP name supplied at create                             */
467     NX_IP          *nx_dhcp_ip_ptr;             /* The associated IP pointer for this DHCP instance         */
468 #ifndef NX_DHCP_CLIENT_USER_CREATE_PACKET_POOL
469     NX_PACKET_POOL  nx_dhcp_pool;               /* The pool of UDP data packets for DHCP messages           */
470     UCHAR           nx_dhcp_pool_area[NX_DHCP_PACKET_POOL_SIZE];
471 #endif
472     NX_PACKET_POOL *nx_dhcp_packet_pool_ptr;    /* Pointer to DHCP Client packet pool                       */
473     NX_UDP_SOCKET   nx_dhcp_socket;             /* The Socket used for DHCP messages                        */
474     TX_THREAD       nx_dhcp_thread;             /* The DHCP processing thread                               */
475     UCHAR           nx_dhcp_thread_stack[NX_DHCP_THREAD_STACK_SIZE];
476     TX_MUTEX        nx_dhcp_mutex;              /* The DHCP mutex for protecting access                     */
477     TX_EVENT_FLAGS_GROUP
478                     nx_dhcp_events;              /* DHCP Client thread events                               */
479     TX_TIMER        nx_dhcp_timer;               /* DHCP Client timeout timer                               */
480     NX_DHCP_INTERFACE_RECORD
481                     nx_dhcp_interface_record[NX_DHCP_CLIENT_MAX_RECORDS];
482                                                 /* Record of DHCP Client state on specific interface        */
483     UCHAR           nx_dhcp_user_request_parameter[NX_DHCP_CLIENT_MAX_USER_REQUEST_PARAMETER];
484                                                 /* User request parameter                                   */
485     UINT            nx_dhcp_user_request_parameter_size;
486                                                 /* User request parameter size                              */
487 
488 #ifdef NX_DHCP_CLIENT_SEND_MAX_DHCP_MESSAGE_OPTION
489     ULONG           nx_dhcp_max_dhcp_message_size;
490                                                 /* Maximum length DHCP message DHCP Client will accept     */
491 #endif /* NX_DHCP_CLIENT_SEND_MAX_DHCP_MESSAGE_OPTION */
492 
493 #ifdef NX_DHCP_CLIENT_SEND_ARP_PROBE
494     UINT            nx_dhcp_interface_conflict_flag;    /* The flag indicate IP addresses conflict on which interfaces, one bit represent one interface.
495                                                            For examples:
496                                                            0x00000001: interface index 0;
497                                                            0x00000002: interface index 1;
498                                                            0x00000003: interface index 0 and 1;  */
499 #endif /* NX_DHCP_CLIENT_SEND_ARP_PROBE  */
500 
501     /* Define the callback function for DHCP state change notification. If specified
502        by the application, this function is called whenever a state change occurs for
503        the DHCP associated with this IP instance.  */
504     VOID (*nx_dhcp_state_change_callback)(struct NX_DHCP_STRUCT *dhcp_ptr, UCHAR new_state);
505 
506     /* Define the callback function for DHCP interface state change notification.
507        this function is similar as nx_dhcp_state_change_callback,
508 
509        Note: Suggest using state change notification, and use nx_dhcp_interface_state_change_callback
510              if DHCP is running on multiple interfaces.  */
511     VOID (*nx_dhcp_interface_state_change_callback)(struct NX_DHCP_STRUCT *dhcp_ptr, UINT iface_index, UCHAR new_state);
512 
513     /* Define the callback function for adding specific DHCP user option.  */
514     UINT (*nx_dhcp_user_option_add)(struct NX_DHCP_STRUCT *dhcp_ptr, UINT iface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length);
515 
516     /* Define the link between other DHCP structures created by the application.  */
517     struct NX_DHCP_STRUCT *nx_dhcp_created_next;
518 
519     /* This pointer is reserved for application specific use.  */
520     void            *nx_dhcp_reserved_ptr;
521 
522 } NX_DHCP;
523 
524 
525 #ifndef NX_DHCP_SOURCE_CODE
526 
527 /* Application caller is present, perform API mapping.  */
528 
529 /* Determine if error checking is desired.  If so, map DHCP API functions
530    to the appropriate error checking front-ends.  Otherwise, map API
531    functions to the core functions that actually perform the work.
532    Note: error checking is enabled by default.  */
533 
534 #ifdef NX_DISABLE_ERROR_CHECKING
535 
536 /* Services without error checking.  */
537 
538 #define nx_dhcp_create                                  _nx_dhcp_create
539 #define nx_dhcp_packet_pool_set                         _nx_dhcp_packet_pool_set
540 #define nx_dhcp_request_client_ip                       _nx_dhcp_request_client_ip
541 #define nx_dhcp_delete                                  _nx_dhcp_delete
542 #define nx_dhcp_decline                                 _nx_dhcp_decline
543 #define nx_dhcp_force_renew                             _nx_dhcp_force_renew
544 #define nx_dhcp_release                                 _nx_dhcp_release
545 #define nx_dhcp_start                                   _nx_dhcp_start
546 #define nx_dhcp_stop                                    _nx_dhcp_stop
547 #define nx_dhcp_server_address_get                      _nx_dhcp_server_address_get
548 #define nx_dhcp_state_change_notify                     _nx_dhcp_state_change_notify
549 #define nx_dhcp_user_option_request                     _nx_dhcp_user_option_request
550 #define nx_dhcp_user_option_retrieve                    _nx_dhcp_user_option_retrieve
551 #define nx_dhcp_user_option_convert                     _nx_dhcp_user_option_convert
552 #define nx_dhcp_user_option_add_callback_set            _nx_dhcp_user_option_add_callback_set
553 #define nx_dhcp_reinitialize                            _nx_dhcp_reinitialize
554 #define nx_dhcp_send_request                            _nx_dhcp_send_request
555 #define nx_dhcp_set_interface_index                     _nx_dhcp_set_interface_index
556 #define nx_dhcp_clear_broadcast_flag                    _nx_dhcp_clear_broadcast_flag
557 #define nx_dhcp_interface_clear_broadcast_flag          _nx_dhcp_interface_clear_broadcast_flag
558 #define nx_dhcp_interface_enable                        _nx_dhcp_interface_enable
559 #define nx_dhcp_interface_disable                       _nx_dhcp_interface_disable
560 #define nx_dhcp_interface_decline                       _nx_dhcp_interface_decline
561 #define nx_dhcp_interface_force_renew                   _nx_dhcp_interface_force_renew
562 #define nx_dhcp_interface_reinitialize                  _nx_dhcp_interface_reinitialize
563 #define nx_dhcp_interface_release                       _nx_dhcp_interface_release
564 #define nx_dhcp_interface_request_client_ip             _nx_dhcp_interface_request_client_ip
565 #define nx_dhcp_interface_start                         _nx_dhcp_interface_start
566 #define nx_dhcp_interface_stop                          _nx_dhcp_interface_stop
567 #define nx_dhcp_interface_send_request                  _nx_dhcp_interface_send_request
568 #define nx_dhcp_interface_server_address_get            _nx_dhcp_interface_server_address_get
569 #define nx_dhcp_interface_state_change_notify           _nx_dhcp_interface_state_change_notify
570 #define nx_dhcp_interface_user_option_retrieve          _nx_dhcp_interface_user_option_retrieve
571 #ifdef NX_DHCP_CLIENT_RESTORE_STATE
572 #define nx_dhcp_resume                                  _nx_dhcp_resume
573 #define nx_dhcp_suspend                                 _nx_dhcp_suspend
574 #define nx_dhcp_client_get_record                       _nx_dhcp_client_get_record
575 #define nx_dhcp_client_restore_record                   _nx_dhcp_client_restore_record
576 #define nx_dhcp_client_update_time_remaining            _nx_dhcp_client_update_time_remaining
577 #define nx_dhcp_client_interface_get_record             _nx_dhcp_client_interface_get_record
578 #define nx_dhcp_client_interface_restore_record         _nx_dhcp_client_interface_restore_record
579 #define nx_dhcp_client_interface_update_time_remaining  _nx_dhcp_client_interface_update_time_remaining
580 #endif /* NX_DHCP_CLIENT_RESTORE_STATE */
581 
582 #else
583 
584 /* Services with error checking.  */
585 
586 #define nx_dhcp_create                                  _nxe_dhcp_create
587 #define nx_dhcp_packet_pool_set                         _nxe_dhcp_packet_pool_set
588 #define nx_dhcp_request_client_ip                       _nxe_dhcp_request_client_ip
589 #define nx_dhcp_delete                                  _nxe_dhcp_delete
590 #define nx_dhcp_decline                                 _nxe_dhcp_decline
591 #define nx_dhcp_force_renew                             _nxe_dhcp_force_renew
592 #define nx_dhcp_release                                 _nxe_dhcp_release
593 #define nx_dhcp_start                                   _nxe_dhcp_start
594 #define nx_dhcp_stop                                    _nxe_dhcp_stop
595 #define nx_dhcp_server_address_get                      _nxe_dhcp_server_address_get
596 #define nx_dhcp_state_change_notify                     _nxe_dhcp_state_change_notify
597 #define nx_dhcp_user_option_request                     _nxe_dhcp_user_option_request
598 #define nx_dhcp_user_option_retrieve                    _nxe_dhcp_user_option_retrieve
599 #define nx_dhcp_user_option_convert                     _nxe_dhcp_user_option_convert
600 #define nx_dhcp_user_option_add_callback_set            _nxe_dhcp_user_option_add_callback_set
601 #define nx_dhcp_reinitialize                            _nxe_dhcp_reinitialize
602 #define nx_dhcp_send_request                            _nxe_dhcp_send_request
603 #define nx_dhcp_set_interface_index                     _nxe_dhcp_set_interface_index
604 #define nx_dhcp_clear_broadcast_flag                    _nxe_dhcp_clear_broadcast_flag
605 #define nx_dhcp_interface_clear_broadcast_flag          _nxe_dhcp_interface_clear_broadcast_flag
606 #define nx_dhcp_interface_enable                        _nxe_dhcp_interface_enable
607 #define nx_dhcp_interface_disable                       _nxe_dhcp_interface_disable
608 #define nx_dhcp_interface_decline                       _nxe_dhcp_interface_decline
609 #define nx_dhcp_interface_force_renew                   _nxe_dhcp_interface_force_renew
610 #define nx_dhcp_interface_reinitialize                  _nxe_dhcp_interface_reinitialize
611 #define nx_dhcp_interface_release                       _nxe_dhcp_interface_release
612 #define nx_dhcp_interface_request_client_ip             _nxe_dhcp_interface_request_client_ip
613 #define nx_dhcp_interface_start                         _nxe_dhcp_interface_start
614 #define nx_dhcp_interface_stop                          _nxe_dhcp_interface_stop
615 #define nx_dhcp_interface_send_request                  _nxe_dhcp_interface_send_request
616 #define nx_dhcp_interface_server_address_get            _nxe_dhcp_interface_server_address_get
617 #define nx_dhcp_interface_state_change_notify           _nxe_dhcp_interface_state_change_notify
618 #define nx_dhcp_interface_user_option_retrieve          _nxe_dhcp_interface_user_option_retrieve
619 #ifdef NX_DHCP_CLIENT_RESTORE_STATE
620 #define nx_dhcp_resume                                  _nxe_dhcp_resume
621 #define nx_dhcp_suspend                                 _nxe_dhcp_suspend
622 #define nx_dhcp_client_get_record                       _nxe_dhcp_client_get_record
623 #define nx_dhcp_client_restore_record                   _nxe_dhcp_client_restore_record
624 #define nx_dhcp_client_update_time_remaining            _nxe_dhcp_client_update_time_remaining
625 #define nx_dhcp_client_interface_get_record             _nxe_dhcp_client_interface_get_record
626 #define nx_dhcp_client_interface_restore_record         _nxe_dhcp_client_interface_restore_record
627 #define nx_dhcp_client_interface_update_time_remaining  _nxe_dhcp_client_interface_update_time_remaining
628 #endif /* NX_DHCP_CLIENT_RESTORE_STATE */
629 
630 #endif  /* NX_DISABLE_ERROR_CHECKING */
631 
632 /* Define the prototypes accessible to the application software.  */
633 
634 UINT        nx_dhcp_create(NX_DHCP *dhcp_ptr, NX_IP *ip_ptr, CHAR *name_ptr);
635 UINT        nx_dhcp_packet_pool_set(NX_DHCP *dhcp_ptr, NX_PACKET_POOL *packet_pool_ptr);
636 UINT        nx_dhcp_request_client_ip(NX_DHCP *dhcp_ptr, ULONG client_ip_address, UINT skip_discover_message);
637 UINT        nx_dhcp_delete(NX_DHCP *dhcp_ptr);
638 UINT        nx_dhcp_decline(NX_DHCP *dhcp_ptr);
639 UINT        nx_dhcp_force_renew(NX_DHCP *dhcp_ptr);
640 UINT        nx_dhcp_release(NX_DHCP *dhcp_ptr);
641 UINT        nx_dhcp_start(NX_DHCP *dhcp_ptr);
642 UINT        nx_dhcp_stop(NX_DHCP *dhcp_ptr);
643 UINT        nx_dhcp_server_address_get(NX_DHCP *dhcp_ptr, ULONG *server_address);
644 UINT        nx_dhcp_state_change_notify(NX_DHCP *dhcp_ptr, VOID (*dhcp_state_change_notify)(NX_DHCP *dhcp_ptr, UCHAR new_state));
645 UINT        nx_dhcp_user_option_request(NX_DHCP *dhcp_ptr, UINT option_code);
646 UINT        nx_dhcp_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT request_option, UCHAR *destination_ptr, UINT *destination_size);
647 ULONG       nx_dhcp_user_option_convert(UCHAR *source_ptr);
648 UINT        nx_dhcp_user_option_add_callback_set(NX_DHCP *dhcp_ptr, UINT (*dhcp_user_option_add)(NX_DHCP *dhcp_ptr, UINT iface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
649 UINT        nx_dhcp_reinitialize(NX_DHCP *dhcp_ptr);
650 UINT        nx_dhcp_send_request(NX_DHCP *dhcp_ptr, UINT dhcp_message_type);
651 UINT        nx_dhcp_set_interface_index(NX_DHCP *dhcp_ptr, UINT interface_index);
652 UINT        nx_dhcp_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT clear_flag);
653 UINT        nx_dhcp_interface_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT iface_index, UINT clear_flag);
654 UINT        nx_dhcp_interface_enable(NX_DHCP *dhcp_ptr, UINT iface_index);
655 UINT        nx_dhcp_interface_disable(NX_DHCP *dhcp_ptr, UINT iface_index);
656 UINT        nx_dhcp_interface_decline(NX_DHCP *dhcp_ptr, UINT iface_index);
657 UINT        nx_dhcp_interface_force_renew(NX_DHCP *dhcp_ptr, UINT iface_index);
658 UINT        nx_dhcp_interface_release(NX_DHCP *dhcp_ptr, UINT iface_index);
659 UINT        nx_dhcp_interface_reinitialize(NX_DHCP *dhcp_ptr, UINT iface_index);
660 UINT        nx_dhcp_interface_request_client_ip(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG client_ip_address, UINT skip_discover_message);
661 UINT        nx_dhcp_interface_start(NX_DHCP *dhcp_ptr, UINT iface_index);
662 UINT        nx_dhcp_interface_stop(NX_DHCP *dhcp_ptr, UINT iface_index);
663 UINT        nx_dhcp_interface_send_request(NX_DHCP *dhcp_ptr, UINT iface_index, UINT dhcp_message_type);
664 UINT        nx_dhcp_interface_server_address_get(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG *server_address);
665 UINT        nx_dhcp_interface_state_change_notify(NX_DHCP *dhcp_ptr, VOID (*dhcp_interface_state_change_notify)(NX_DHCP *dhcp_ptr, UINT iface_index, UCHAR new_state));
666 UINT        nx_dhcp_interface_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT iface_index, UINT option_request, UCHAR *destination_ptr, UINT *destination_size);
667 
668 #ifdef NX_DHCP_CLIENT_RESTORE_STATE
669 UINT        nx_dhcp_resume(NX_DHCP *dhcp_ptr);
670 UINT        nx_dhcp_suspend(NX_DHCP *dhcp_ptr);
671 UINT        nx_dhcp_client_get_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr);
672 UINT        nx_dhcp_client_restore_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
673 UINT        nx_dhcp_client_update_time_remaining(NX_DHCP *dhcp_ptr, ULONG time_elapsed);
674 UINT        nx_dhcp_client_interface_get_record(NX_DHCP *dhcp_ptr, UINT iface_index,  NX_DHCP_CLIENT_RECORD *record_ptr);
675 UINT        nx_dhcp_client_interface_restore_record(NX_DHCP *dhcp_ptr, UINT iface_index, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
676 UINT        nx_dhcp_client_interface_update_time_remaining(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG time_elapsed);
677 #endif /* NX_DHCP_CLIENT_RESTORE_STATE */
678 
679 #else
680 
681 /* DHCP source code is being compiled, do not perform any API mapping.  */
682 
683 UINT        _nxe_dhcp_create(NX_DHCP *dhcp_ptr, NX_IP *ip_ptr, CHAR *name_ptr);
684 UINT        _nx_dhcp_create(NX_DHCP *dhcp_ptr, NX_IP *ip_ptr, CHAR *name_ptr);
685 UINT        _nxe_dhcp_packet_pool_set(NX_DHCP *dhcp_ptr, NX_PACKET_POOL *packet_pool_ptr);
686 UINT        _nx_dhcp_packet_pool_set(NX_DHCP *dhcp_ptr, NX_PACKET_POOL *packet_pool_ptr);
687 UINT        _nxe_dhcp_request_client_ip(NX_DHCP *dhcp_ptr, ULONG client_ip_address, UINT skip_discover_message);
688 UINT        _nx_dhcp_request_client_ip(NX_DHCP *dhcp_ptr, ULONG client_ip_address, UINT skip_discover_message);
689 UINT        _nxe_dhcp_delete(NX_DHCP *dhcp_ptr);
690 UINT        _nx_dhcp_delete(NX_DHCP *dhcp_ptr);
691 UINT        _nxe_dhcp_decline(NX_DHCP *dhcp_ptr);
692 UINT        _nx_dhcp_decline(NX_DHCP *dhcp_ptr);
693 UINT        _nxe_dhcp_force_renew(NX_DHCP *dhcp_ptr);
694 UINT        _nx_dhcp_force_renew(NX_DHCP *dhcp_ptr);
695 UINT        _nxe_dhcp_release(NX_DHCP *dhcp_ptr);
696 UINT        _nx_dhcp_release(NX_DHCP *dhcp_ptr);
697 UINT        _nxe_dhcp_start(NX_DHCP *dhcp_ptr);
698 UINT        _nx_dhcp_start(NX_DHCP *dhcp_ptr);
699 UINT        _nxe_dhcp_stop(NX_DHCP *dhcp_ptr);
700 UINT        _nx_dhcp_stop(NX_DHCP *dhcp_ptr);
701 UINT        _nxe_dhcp_server_address_get(NX_DHCP *dhcp_ptr, ULONG *server_address);
702 UINT        _nx_dhcp_server_address_get(NX_DHCP *dhcp_ptr, ULONG *server_address);
703 UINT        _nxe_dhcp_state_change_notify(NX_DHCP *dhcp_ptr,  VOID (*dhcp_state_change_notify)(NX_DHCP *dhcp_ptr, UCHAR new_state));
704 UINT        _nx_dhcp_state_change_notify(NX_DHCP *dhcp_ptr, VOID (*dhcp_state_change_notify)(NX_DHCP *dhcp_ptr, UCHAR new_state));
705 UINT        _nxe_dhcp_user_option_request(NX_DHCP *dhcp_ptr, UINT option_code);
706 UINT        _nx_dhcp_user_option_request(NX_DHCP *dhcp_ptr, UINT option_code);
707 UINT        _nxe_dhcp_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT request_option, UCHAR *destination_ptr, UINT *destination_size);
708 UINT        _nx_dhcp_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT request_option, UCHAR *destination_ptr, UINT *destination_size);
709 ULONG       _nxe_dhcp_user_option_convert(UCHAR *source_ptr);
710 ULONG       _nx_dhcp_user_option_convert(UCHAR *source_ptr);
711 UINT        _nxe_dhcp_reinitialize(NX_DHCP *dhcp_ptr);
712 UINT        _nx_dhcp_reinitialize(NX_DHCP *dhcp_ptr);
713 UINT        _nxe_dhcp_send_request(NX_DHCP *dhcp_ptr, UINT dhcp_message_type);
714 UINT        _nx_dhcp_send_request(NX_DHCP *dhcp_ptr, UINT dhcp_message_type);
715 UINT        _nxe_dhcp_set_interface_index(NX_DHCP *dhcp_ptr, UINT interface_index);
716 UINT        _nx_dhcp_set_interface_index(NX_DHCP *dhcp_ptr, UINT interface_index);
717 UINT        _nxe_dhcp_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT clear_flag);
718 UINT        _nx_dhcp_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT clear_flag);
719 UINT        _nxe_dhcp_user_option_add_callback_set(NX_DHCP *dhcp_ptr, UINT (*dhcp_user_option_add)(NX_DHCP *dhcp_ptr, UINT iface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
720 UINT        _nx_dhcp_user_option_add_callback_set(NX_DHCP *dhcp_ptr, UINT (*dhcp_user_option_add)(NX_DHCP *dhcp_ptr, UINT iface_index, UINT message_type, UCHAR *user_option_ptr, UINT *user_option_length));
721 UINT        _nxe_dhcp_interface_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT iface_index, UINT clear_flag);
722 UINT        _nx_dhcp_interface_clear_broadcast_flag(NX_DHCP *dhcp_ptr, UINT iface_index, UINT clear_flag);
723 UINT        _nxe_dhcp_interface_enable(NX_DHCP *dhcp_ptr, UINT iface_index);
724 UINT        _nx_dhcp_interface_enable(NX_DHCP *dhcp_ptr, UINT iface_index);
725 UINT        _nxe_dhcp_interface_disable(NX_DHCP *dhcp_ptr, UINT iface_index);
726 UINT        _nx_dhcp_interface_disable(NX_DHCP *dhcp_ptr, UINT iface_index);
727 UINT        _nxe_dhcp_interface_decline(NX_DHCP *dhcp_ptr, UINT iface_index);
728 UINT        _nx_dhcp_interface_decline(NX_DHCP *dhcp_ptr, UINT iface_index);
729 UINT        _nxe_dhcp_interface_force_renew(NX_DHCP *dhcp_ptr, UINT iface_index);
730 UINT        _nx_dhcp_interface_force_renew(NX_DHCP *dhcp_ptr, UINT iface_index);
731 UINT        _nxe_dhcp_interface_release(NX_DHCP *dhcp_ptr, UINT iface_index);
732 UINT        _nx_dhcp_interface_release(NX_DHCP *dhcp_ptr, UINT iface_index);
733 UINT        _nxe_dhcp_interface_reinitialize(NX_DHCP *dhcp_ptr, UINT iface_index);
734 UINT        _nx_dhcp_interface_reinitialize(NX_DHCP *dhcp_ptr, UINT iface_index);
735 UINT        _nxe_dhcp_interface_start(NX_DHCP *dhcp_ptr, UINT iface_index);
736 UINT        _nx_dhcp_interface_start(NX_DHCP *dhcp_ptr, UINT iface_index);
737 UINT        _nxe_dhcp_interface_stop(NX_DHCP *dhcp_ptr, UINT iface_index);
738 UINT        _nx_dhcp_interface_stop(NX_DHCP *dhcp_ptr, UINT iface_index);
739 UINT        _nxe_dhcp_interface_request_client_ip(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG client_ip_address, UINT skip_discover_message);
740 UINT        _nx_dhcp_interface_request_client_ip(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG client_ip_address, UINT skip_discover_message);
741 UINT        _nxe_dhcp_interface_send_request(NX_DHCP *dhcp_ptr, UINT iface_index, UINT dhcp_message_type);
742 UINT        _nx_dhcp_interface_send_request(NX_DHCP *dhcp_ptr, UINT iface_index, UINT dhcp_message_type);
743 UINT        _nxe_dhcp_interface_server_address_get(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG *server_address);
744 UINT        _nx_dhcp_interface_server_address_get(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG *server_address);
745 UINT        _nxe_dhcp_interface_state_change_notify(NX_DHCP *dhcp_ptr,  VOID (*dhcp_interface_state_change_notify)(NX_DHCP *dhcp_ptr, UINT iface_index, UCHAR new_state));
746 UINT        _nx_dhcp_interface_state_change_notify(NX_DHCP *dhcp_ptr, VOID (*dhcp_interface_state_change_notify)(NX_DHCP *dhcp_ptr, UINT iface_index, UCHAR new_state));
747 UINT        _nxe_dhcp_interface_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT iface_index, UINT option_request, UCHAR *destination_ptr, UINT *destination_size);
748 UINT        _nx_dhcp_interface_user_option_retrieve(NX_DHCP *dhcp_ptr, UINT iface_index, UINT option_request, UCHAR *destination_ptr, UINT *destination_size);
749 
750 #ifdef NX_DHCP_CLIENT_RESTORE_STATE
751 UINT        _nxe_dhcp_resume(NX_DHCP *dhcp_ptr);
752 UINT        _nx_dhcp_resume(NX_DHCP *dhcp_ptr);
753 UINT        _nxe_dhcp_suspend(NX_DHCP *dhcp_ptr);
754 UINT        _nx_dhcp_suspend(NX_DHCP *dhcp_ptr);
755 UINT        _nxe_dhcp_client_get_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr);
756 UINT        _nx_dhcp_client_get_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr);
757 UINT        _nxe_dhcp_client_restore_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
758 UINT        _nx_dhcp_client_restore_record(NX_DHCP *dhcp_ptr, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
759 UINT        _nxe_dhcp_client_update_time_remaining(NX_DHCP *dhcp_ptr, ULONG time_elapsed);
760 UINT        _nx_dhcp_client_update_time_remaining(NX_DHCP *dhcp_ptr, ULONG time_elapsed);
761 UINT        _nxe_dhcp_client_interface_get_record(NX_DHCP *dhcp_ptr, UINT iface_index,  NX_DHCP_CLIENT_RECORD *record_ptr);
762 UINT        _nx_dhcp_client_interface_get_record(NX_DHCP *dhcp_ptr, UINT iface_index,  NX_DHCP_CLIENT_RECORD *record_ptr);
763 UINT        _nxe_dhcp_client_interface_restore_record(NX_DHCP *dhcp_ptr, UINT iface_index, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
764 UINT        _nx_dhcp_client_interface_restore_record(NX_DHCP *dhcp_ptr, UINT iface_index, NX_DHCP_CLIENT_RECORD *record_ptr, ULONG time_elapsed);
765 UINT        _nxe_dhcp_client_interface_update_time_remaining(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG time_elapsed);
766 UINT        _nx_dhcp_client_interface_update_time_remaining(NX_DHCP *dhcp_ptr, UINT iface_index, ULONG time_elapsed);
767 #endif /* NX_DHCP_CLIENT_RESTORE_STATE */
768 
769 #endif /* NX_DHCP_SOURCE_CODE */
770 
771 
772 /* Determine if a C++ compiler is being used.  If so, complete the standard
773    C conditional started above.  */
774 #ifdef   __cplusplus
775 }
776 #endif  /* __cplusplus */
777 
778 #endif  /* NXD_DHCP_CLIENT_H */
779