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