iPXE
Dhcp4.h
Go to the documentation of this file.
1/** @file
2 EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.
3 EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.
4 These protocols are used to collect configuration information for the EFI IPv4 Protocol
5 drivers and to provide DHCPv4 server and PXE boot server discovery services.
6
7Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 @par Revision Reference:
11 This Protocol was introduced in UEFI Specification 2.0.
12
13**/
14
15#pragma once
16
17FILE_LICENCE ( BSD2_PATENT );
18FILE_SECBOOT ( PERMITTED );
19
20#define EFI_DHCP4_PROTOCOL_GUID \
21 { \
22 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \
23 }
24
25#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \
26 { \
27 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \
28 }
29
31
32#pragma pack(1)
33typedef struct {
34 ///
35 /// DHCP option code.
36 ///
38 ///
39 /// Length of the DHCP option data. Not present if OpCode is 0 or 255.
40 ///
42 ///
43 /// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero.
44 ///
47#pragma pack()
48
49#pragma pack(1)
50///
51/// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information.
52///
53typedef struct {
61 EFI_IPv4_ADDRESS ClientAddr; ///< Client IP address from client.
62 EFI_IPv4_ADDRESS YourAddr; ///< Client IP address from server.
63 EFI_IPv4_ADDRESS ServerAddr; ///< IP address of next server in bootstrap.
64 EFI_IPv4_ADDRESS GatewayAddr; ///< Relay agent IP address.
65 UINT8 ClientHwAddr[16]; ///< Client hardware address.
69#pragma pack()
70
71#pragma pack(1)
72typedef struct {
73 ///
74 /// Size of the EFI_DHCP4_PACKET buffer.
75 ///
77 ///
78 /// Length of the EFI_DHCP4_PACKET from the first byte of the Header field
79 /// to the last byte of the Option[] field.
80 ///
82
83 struct {
84 ///
85 /// DHCP packet header.
86 ///
88 ///
89 /// DHCP magik cookie in network byte order.
90 ///
92 ///
93 /// Start of the DHCP packed option data.
94 ///
96 } Dhcp4;
98#pragma pack()
99
100typedef enum {
101 ///
102 /// The EFI DHCPv4 Protocol driver is stopped.
103 ///
105 ///
106 /// The EFI DHCPv4 Protocol driver is inactive.
107 ///
109 ///
110 /// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.
111 ///
113 ///
114 /// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.
115 ///
117 ///
118 /// The DHCP configuration has completed.
119 ///
121 ///
122 /// The DHCP configuration is being renewed and another request has
123 /// been sent out, but it has not received a response from the server yet.
124 ///
126 ///
127 /// The DHCP configuration has timed out and the EFI DHCPv4
128 /// Protocol driver is trying to extend the lease time.
129 ///
131 ///
132 /// The EFI DHCPv4 Protocol driver was initialized with a previously
133 /// allocated or known IP address.
134 ///
136 ///
137 /// The EFI DHCPv4 Protocol driver is seeking to reuse the previously
138 /// allocated IP address by sending a request to the DHCP server.
139 ///
142
143typedef enum {
144 ///
145 /// The packet to start the configuration sequence is about to be sent.
146 ///
148 ///
149 /// A reply packet was just received.
150 ///
152 ///
153 /// It is time for Dhcp4Callback to select an offer.
154 ///
156 ///
157 /// A request packet is about to be sent.
158 ///
160 ///
161 /// A DHCPACK packet was received and will be passed to Dhcp4Callback.
162 ///
164 ///
165 /// A DHCPNAK packet was received and will be passed to Dhcp4Callback.
166 ///
168 ///
169 /// A decline packet is about to be sent.
170 ///
172 ///
173 /// The DHCP configuration process has completed. No packet is associated with this event.
174 ///
176 ///
177 /// It is time to enter the Dhcp4Renewing state and to contact the server
178 /// that originally issued the network address. No packet is associated with this event.
179 ///
181 ///
182 /// It is time to enter the Dhcp4Rebinding state and to contact any server.
183 /// No packet is associated with this event.
184 ///
186 ///
187 /// The configured IP address was lost either because the lease has expired,
188 /// the user released the configuration, or a DHCPNAK packet was received in
189 /// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event.
190 ///
192 ///
193 /// The DHCP process failed because a DHCPNAK packet was received or the user
194 /// aborted the DHCP process at a time when the configuration was not available yet.
195 /// No packet is associated with this event.
196 ///
199
200/**
201 Callback routine.
202
203 EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
204 to intercept events that occurred in the configuration process. This structure
205 provides advanced control of each state transition of the DHCP process. The
206 returned status code determines the behavior of the EFI DHCPv4 Protocol driver.
207 There are three possible returned values, which are described in the following
208 table.
209
210 @param This The pointer to the EFI DHCPv4 Protocol instance that is used to
211 configure this callback function.
212 @param Context The pointer to the context that is initialized by
213 EFI_DHCP4_PROTOCOL.Configure().
214 @param CurrentState The current operational state of the EFI DHCPv4 Protocol
215 driver.
216 @param Dhcp4Event The event that occurs in the current state, which usually means a
217 state transition.
218 @param Packet The DHCP packet that is going to be sent or already received.
219 @param NewPacket The packet that is used to replace the above Packet.
220
221 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
222 When it is in the Dhcp4Selecting state, it tells the EFI DHCPv4 Protocol
223 driver to stop collecting additional packets. The driver will exit
224 the Dhcp4Selecting state and enter the Dhcp4Requesting state.
225 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
226 driver will continue to wait for more packets until the retry
227 timeout expires.
228 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
229 return to the Dhcp4Init or Dhcp4InitReboot state.
230
231**/
232typedef
236 IN VOID *Context,
237 IN EFI_DHCP4_STATE CurrentState,
238 IN EFI_DHCP4_EVENT Dhcp4Event,
240 OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL
241 );
242
243typedef struct {
244 ///
245 /// The number of times to try sending a packet during the Dhcp4SendDiscover
246 /// event and waiting for a response during the Dhcp4RcvdOffer event.
247 /// Set to zero to use the default try counts and timeout values.
248 ///
250 ///
251 /// The maximum amount of time (in seconds) to wait for returned packets in each
252 /// of the retries. Timeout values of zero will default to a timeout value
253 /// of one second. Set to NULL to use default timeout values.
254 ///
256 ///
257 /// The number of times to try sending a packet during the Dhcp4SendRequest event
258 /// and waiting for a response during the Dhcp4RcvdAck event before accepting
259 /// failure. Set to zero to use the default try counts and timeout values.
260 ///
262 ///
263 /// The maximum amount of time (in seconds) to wait for return packets in each of the retries.
264 /// Timeout values of zero will default to a timeout value of one second.
265 /// Set to NULL to use default timeout values.
266 ///
268 ///
269 /// For a DHCPDISCOVER, setting this parameter to the previously allocated IP
270 /// address will cause the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state.
271 /// And set this field to 0.0.0.0 to enter the Dhcp4Init state.
272 /// For a DHCPINFORM this parameter should be set to the client network address
273 /// which was assigned to the client during a DHCPDISCOVER.
274 ///
276 ///
277 /// The callback function to intercept various events that occurred in
278 /// the DHCP configuration process. Set to NULL to ignore all those events.
279 ///
281 ///
282 /// The pointer to the context that will be passed to Dhcp4Callback when it is called.
283 ///
285 ///
286 /// Number of DHCP options in the OptionList.
287 ///
289 ///
290 /// List of DHCP options to be included in every packet that is sent during the
291 /// Dhcp4SendDiscover event. Pad options are appended automatically by DHCP driver
292 /// in outgoing DHCP packets. If OptionList itself contains pad option, they are
293 /// ignored by the driver. OptionList can be freed after EFI_DHCP4_PROTOCOL.Configure()
294 /// returns. Ignored if OptionCount is zero.
295 ///
298
299typedef struct {
300 ///
301 /// The EFI DHCPv4 Protocol driver operating state.
302 ///
304 ///
305 /// The configuration data of the current EFI DHCPv4 Protocol driver instance.
306 ///
308 ///
309 /// The client IP address that was acquired from the DHCP server. If it is zero,
310 /// the DHCP acquisition has not completed yet and the following fields in this structure are undefined.
311 ///
313 ///
314 /// The local hardware address.
315 ///
317 ///
318 /// The server IP address that is providing the DHCP service to this client.
319 ///
321 ///
322 /// The router IP address that was acquired from the DHCP server.
323 /// May be zero if the server does not offer this address.
324 ///
326 ///
327 /// The subnet mask of the connected network that was acquired from the DHCP server.
328 ///
330 ///
331 /// The lease time (in 1-second units) of the configured IP address.
332 /// The value 0xFFFFFFFF means that the lease time is infinite.
333 /// A default lease of 7 days is used if the DHCP server does not provide a value.
334 ///
336 ///
337 /// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached.
338 ///
341
342typedef struct {
343 ///
344 /// Alternate listening address. It can be a unicast, multicast, or broadcast address.
345 ///
347 ///
348 /// The subnet mask of above listening unicast/broadcast IP address.
349 /// Ignored if ListenAddress is a multicast address.
350 ///
352 ///
353 /// Alternate station source (or listening) port number.
354 /// If zero, then the default station port number (68) will be used.
355 ///
358
359typedef struct {
360 ///
361 /// The completion status of transmitting and receiving.
362 ///
364 ///
365 /// If not NULL, the event that will be signaled when the collection process
366 /// completes. If NULL, this function will busy-wait until the collection process competes.
367 ///
369 ///
370 /// The pointer to the server IP address. This address may be a unicast, multicast, or broadcast address.
371 ///
373 ///
374 /// The server listening port number. If zero, the default server listening port number (67) will be used.
375 ///
377 ///
378 /// The pointer to the gateway address to override the existing setting.
379 ///
381 ///
382 /// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used.
383 ///
385 ///
386 /// An array of station address and port number pairs that are used as receiving filters.
387 /// The first entry is also used as the source address and source port of the outgoing packet.
388 ///
390 ///
391 /// The number of seconds to collect responses. Zero is invalid.
392 ///
394 ///
395 /// The pointer to the packet to be transmitted.
396 ///
398 ///
399 /// Number of received packets.
400 ///
402 ///
403 /// The pointer to the allocated list of received packets.
404 ///
407
408/**
409 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
410
411 The GetModeData() function returns the current operating mode and cached data
412 packet for the EFI DHCPv4 Protocol driver.
413
414 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
415 @param Dhcp4ModeData The pointer to storage for the EFI_DHCP4_MODE_DATA structure.
416
417 @retval EFI_SUCCESS The mode data was returned.
418 @retval EFI_INVALID_PARAMETER This is NULL.
419
420**/
421typedef
425 OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData
426 );
427
428/**
429 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
430
431 The Configure() function is used to initialize, change, or reset the operational
432 settings of the EFI DHCPv4 Protocol driver for the communication device on which
433 the EFI DHCPv4 Service Binding Protocol is installed. This function can be
434 successfully called only if both of the following are true:
435 * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,
436 Dhcp4InitReboot, or Dhcp4Bound states.
437 * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI
438 DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4
439 Protocol driver.
440 When this driver is in the Dhcp4Stopped state, it can transfer into one of the
441 following two possible initial states:
442 * Dhcp4Init
443 * Dhcp4InitReboot.
444 The driver can transfer into these states by calling Configure() with a non-NULL
445 Dhcp4CfgData. The driver will transfer into the appropriate state based on the
446 supplied client network address in the ClientAddress parameter and DHCP options
447 in the OptionList parameter as described in RFC 2131.
448 When Configure() is called successfully while Dhcp4CfgData is set to NULL, the
449 default configuring data will be reset in the EFI DHCPv4 Protocol driver and
450 the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance
451 wants to make it possible for another instance to configure the EFI DHCPv4 Protocol
452 driver, it must call this function with Dhcp4CfgData set to NULL.
453
454 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
455 @param Dhcp4CfgData The pointer to the EFI_DHCP4_CONFIG_DATA.
456
457 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or
458 Dhcp4InitReboot state, if the original state of this driver
459 was Dhcp4Stopped, Dhcp4Init,Dhcp4InitReboot, or Dhcp4Bound
460 and the value of Dhcp4CfgData was not NULL.
461 Otherwise, the state was left unchanged.
462 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the
463 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;
464 Or onother instance of this EFI DHCPv4 Protocol driver is already
465 in a valid configured state.
466 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
467 This is NULL.
468 DiscoverTryCount > 0 and DiscoverTimeout is NULL
469 RequestTryCount > 0 and RequestTimeout is NULL.
470 OptionCount >0 and OptionList is NULL.
471 ClientAddress is not a valid unicast address.
472 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
473 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
474
475**/
476typedef
480 IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL
481 );
482
483/**
484 Starts the DHCP configuration process.
485
486 The Start() function starts the DHCP configuration process. This function can
487 be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or
488 Dhcp4InitReboot state.
489 If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol
490 driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the
491 Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.
492 If the process aborts, either by the user or by some unexpected network error,
493 the state is restored to the Dhcp4Init state. The Start() function can be called
494 again to restart the process.
495 Refer to RFC 2131 for precise state transitions during this process. At the
496 time when each event occurs in this process, the callback function that was set
497 by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this
498 opportunity to control the process.
499
500 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
501 @param CompletionEvent If not NULL, it indicates the event that will be signaled when the
502 EFI DHCPv4 Protocol driver is transferred into the
503 Dhcp4Bound state or when the DHCP process is aborted.
504 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
505 check the completion status. If NULL,
506 EFI_DHCP4_PROTOCOL.Start() will wait until the driver
507 is transferred into the Dhcp4Bound state or the process fails.
508
509 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed
510 when CompletionEvent is NULL.
511 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
512 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.
513 @retval EFI_INVALID_PARAMETER This is NULL.
514 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
515 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was
516 received from the server within the specified timeout value.
517 @retval EFI_ABORTED The user aborted the DHCP process.
518 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the
519 DHCP process.
520 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
521 @retval EFI_NO_MEDIA There was a media error.
522
523**/
524typedef
528 IN EFI_EVENT CompletionEvent OPTIONAL
529 );
530
531/**
532 Extends the lease time by sending a request packet.
533
534 The RenewRebind() function is used to manually extend the lease time when the
535 EFI DHCPv4 Protocol driver is in the Dhcp4Bound state, and the lease time has
536 not expired yet. This function will send a request packet to the previously
537 found server (or to any server when RebindRequest is TRUE) and transfer the
538 state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is
539 TRUE). When a response is received, the state is returned to Dhcp4Bound.
540 If no response is received before the try count is exceeded (the RequestTryCount
541 field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that
542 was issued by the previous server expires, the driver will return to the Dhcp4Bound
543 state, and the previous configuration is restored. The outgoing and incoming packets
544 can be captured by the EFI_DHCP4_CALLBACK function.
545
546 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
547 @param RebindRequest If TRUE, this function broadcasts the request packets and enters
548 the Dhcp4Rebinding state. Otherwise, it sends a unicast
549 request packet and enters the Dhcp4Renewing state.
550 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase
551 completes or some error occurs.
552 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
553 check the completion status. If NULL,
554 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait
555 until the DHCP process finishes.
556
557 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the
558 Dhcp4Renewing state or is back to the Dhcp4Bound state.
559 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
560 state. EFI_DHCP4_PROTOCOL.Configure() needs to
561 be called.
562 @retval EFI_INVALID_PARAMETER This is NULL.
563 @retval EFI_TIMEOUT There was no response from the server when the try count was
564 exceeded.
565 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.
566 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
567
568**/
569typedef
573 IN BOOLEAN RebindRequest,
574 IN EFI_EVENT CompletionEvent OPTIONAL
575 );
576
577/**
578 Releases the current address configuration.
579
580 The Release() function releases the current configured IP address by doing either
581 of the following:
582 * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the
583 Dhcp4Bound state
584 * Setting the previously assigned IP address that was provided with the
585 EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in
586 Dhcp4InitReboot state
587 After a successful call to this function, the EFI DHCPv4 Protocol driver returns
588 to the Dhcp4Init state, and any subsequent incoming packets will be discarded silently.
589
590 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
591
592 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.
593 @retval EFI_INVALID_PARAMETER This is NULL.
594 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.
595 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
596
597**/
598typedef
602 );
603
604/**
605 Stops the current address configuration.
606
607 The Stop() function is used to stop the DHCP configuration process. After this
608 function is called successfully, the EFI DHCPv4 Protocol driver is transferred
609 into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called
610 before DHCP configuration process can be started again. This function can be
611 called when the EFI DHCPv4 Protocol driver is in any state.
612
613 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
614
615 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.
616 @retval EFI_INVALID_PARAMETER This is NULL.
617
618**/
619typedef
623 );
624
625/**
626 Builds a DHCP packet, given the options to be appended or deleted or replaced.
627
628 The Build() function is used to assemble a new packet from the original packet
629 by replacing or deleting existing options or appending new options. This function
630 does not change any state of the EFI DHCPv4 Protocol driver and can be used at
631 any time.
632
633 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
634 @param SeedPacket Initial packet to be used as a base for building new packet.
635 @param DeleteCount Number of opcodes in the DeleteList.
636 @param DeleteList List of opcodes to be deleted from the seed packet.
637 Ignored if DeleteCount is zero.
638 @param AppendCount Number of entries in the OptionList.
639 @param AppendList The pointer to a DHCP option list to be appended to SeedPacket.
640 If SeedPacket also contains options in this list, they are
641 replaced by new options (except pad option). Ignored if
642 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION
643 @param NewPacket The pointer to storage for the pointer to the new allocated packet.
644 Use the EFI Boot Service FreePool() on the resulting pointer
645 when done with the packet.
646
647 @retval EFI_SUCCESS The new packet was built.
648 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.
649 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
650 This is NULL.
651 SeedPacket is NULL.
652 SeedPacket is not a well-formed DHCP packet.
653 AppendCount is not zero and AppendList is NULL.
654 DeleteCount is not zero and DeleteList is NULL.
655 NewPacket is NULL
656 Both DeleteCount and AppendCount are zero and
657 NewPacket is not NULL.
658
659**/
660typedef
664 IN EFI_DHCP4_PACKET *SeedPacket,
665 IN UINT32 DeleteCount,
666 IN UINT8 *DeleteList OPTIONAL,
667 IN UINT32 AppendCount,
668 IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
669 OUT EFI_DHCP4_PACKET **NewPacket
670 );
671
672/**
673 Transmits a DHCP formatted packet and optionally waits for responses.
674
675 The TransmitReceive() function is used to transmit a DHCP packet and optionally
676 wait for the response from servers. This function does not change the state of
677 the EFI DHCPv4 Protocol driver. It can be used at any time because of this.
678
679 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
680 @param Token The pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.
681
682 @retval EFI_SUCCESS The packet was successfully queued for transmission.
683 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
684 This is NULL.
685 Token.RemoteAddress is zero.
686 Token.Packet is NULL.
687 Token.Packet is not a well-formed DHCP packet.
688 The transaction ID in Token.Packet is in use by another DHCP process.
689 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call
690 this function after collection process completes.
691 @retval EFI_NO_MAPPING The default station address is not available yet.
692 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
693 @retval EFI_UNSUPPORTED The implementation doesn't support this function
694 @retval Others Some other unexpected error occurred.
695
696**/
697typedef
702 );
703
704/**
705 Parses the packed DHCP option data.
706
707 The Parse() function is used to retrieve the option list from a DHCP packet.
708 If *OptionCount isn't zero, and there is enough space for all the DHCP options
709 in the Packet, each element of PacketOptionList is set to point to somewhere in
710 the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,
711 the caller should reassemble the parsed DHCP options to get the final result.
712 If *OptionCount is zero or there isn't enough space for all of them, the number
713 of DHCP options in the Packet is returned in OptionCount.
714
715 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
716 @param Packet The pointer to packet to be parsed.
717 @param OptionCount On input, the number of entries in the PacketOptionList.
718 On output, the number of entries that were written into the
719 PacketOptionList.
720 @param PacketOptionList A list of packet option entries to be filled in. End option or pad
721 options are not included.
722
723 @retval EFI_SUCCESS The packet was successfully parsed.
724 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
725 This is NULL.
726 The packet is NULL.
727 The packet is not a well-formed DHCP packet.
728 OptionCount is NULL.
729 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:
730 1) *OptionCount is smaller than the number of options that
731 were found in the Packet.
732 2) PacketOptionList is NULL.
733 @retval EFI_OUT_OF_RESOURCE The packet failed to parse because of a resource shortage.
734
735**/
736typedef
740 IN EFI_DHCP4_PACKET *Packet,
741 IN OUT UINT32 *OptionCount,
742 OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL
743 );
744
745///
746/// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers
747/// and to provide DHCPv4 server and PXE boot server discovery services.
748///
760
unsigned short UINT16
2-byte unsigned value.
unsigned char BOOLEAN
Logical Boolean.
char CHAR8
1-byte Character
#define EFIAPI
unsigned char UINT8
1-byte unsigned value.
unsigned int UINT32
4-byte unsigned value.
#define VOID
Undeclared type.
Definition Base.h:271
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition Base.h:292
EFI_STATUS(EFIAPI * EFI_DHCP4_PARSE)(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_PACKET *Packet, IN OUT UINT32 *OptionCount, OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL)
Parses the packed DHCP option data.
Definition Dhcp4.h:738
EFI_DHCP4_STATE
Definition Dhcp4.h:100
@ Dhcp4Stopped
The EFI DHCPv4 Protocol driver is stopped.
Definition Dhcp4.h:104
@ Dhcp4Init
The EFI DHCPv4 Protocol driver is inactive.
Definition Dhcp4.h:108
@ Dhcp4Bound
The DHCP configuration has completed.
Definition Dhcp4.h:120
@ Dhcp4Rebooting
The EFI DHCPv4 Protocol driver is seeking to reuse the previously allocated IP address by sending a r...
Definition Dhcp4.h:140
@ Dhcp4Requesting
The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.
Definition Dhcp4.h:116
@ Dhcp4InitReboot
The EFI DHCPv4 Protocol driver was initialized with a previously allocated or known IP address.
Definition Dhcp4.h:135
@ Dhcp4Rebinding
The DHCP configuration has timed out and the EFI DHCPv4 Protocol driver is trying to extend the lease...
Definition Dhcp4.h:130
@ Dhcp4Selecting
The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.
Definition Dhcp4.h:112
@ Dhcp4Renewing
The DHCP configuration is being renewed and another request has been sent out, but it has not receive...
Definition Dhcp4.h:125
EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid
EFI_STATUS(EFIAPI * EFI_DHCP4_STOP)(IN EFI_DHCP4_PROTOCOL *This)
Stops the current address configuration.
Definition Dhcp4.h:621
EFI_STATUS(EFIAPI * EFI_DHCP4_TRANSMIT_RECEIVE)(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token)
Transmits a DHCP formatted packet and optionally waits for responses.
Definition Dhcp4.h:699
EFI_STATUS(EFIAPI * EFI_DHCP4_BUILD)(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_PACKET *SeedPacket, IN UINT32 DeleteCount, IN UINT8 *DeleteList OPTIONAL, IN UINT32 AppendCount, IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket)
Builds a DHCP packet, given the options to be appended or deleted or replaced.
Definition Dhcp4.h:662
EFI_STATUS(EFIAPI * EFI_DHCP4_START)(IN EFI_DHCP4_PROTOCOL *This, IN EFI_EVENT CompletionEvent OPTIONAL)
Starts the DHCP configuration process.
Definition Dhcp4.h:526
EFI_STATUS(EFIAPI * EFI_DHCP4_RELEASE)(IN EFI_DHCP4_PROTOCOL *This)
Releases the current address configuration.
Definition Dhcp4.h:600
EFI_GUID gEfiDhcp4ProtocolGuid
EFI_STATUS(EFIAPI * EFI_DHCP4_RENEW_REBIND)(IN EFI_DHCP4_PROTOCOL *This, IN BOOLEAN RebindRequest, IN EFI_EVENT CompletionEvent OPTIONAL)
Extends the lease time by sending a request packet.
Definition Dhcp4.h:571
struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL
Definition Dhcp4.h:30
EFI_STATUS(EFIAPI * EFI_DHCP4_CONFIGURE)(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL)
Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
Definition Dhcp4.h:478
EFI_DHCP4_EVENT
Definition Dhcp4.h:143
@ Dhcp4RcvdNak
A DHCPNAK packet was received and will be passed to Dhcp4Callback.
Definition Dhcp4.h:167
@ Dhcp4Fail
The DHCP process failed because a DHCPNAK packet was received or the user aborted the DHCP process at...
Definition Dhcp4.h:197
@ Dhcp4SendDecline
A decline packet is about to be sent.
Definition Dhcp4.h:171
@ Dhcp4RcvdAck
A DHCPACK packet was received and will be passed to Dhcp4Callback.
Definition Dhcp4.h:163
@ Dhcp4SendRequest
A request packet is about to be sent.
Definition Dhcp4.h:159
@ Dhcp4SelectOffer
It is time for Dhcp4Callback to select an offer.
Definition Dhcp4.h:155
@ Dhcp4EnterRebinding
It is time to enter the Dhcp4Rebinding state and to contact any server.
Definition Dhcp4.h:185
@ Dhcp4BoundCompleted
The DHCP configuration process has completed.
Definition Dhcp4.h:175
@ Dhcp4RcvdOffer
A reply packet was just received.
Definition Dhcp4.h:151
@ Dhcp4SendDiscover
The packet to start the configuration sequence is about to be sent.
Definition Dhcp4.h:147
@ Dhcp4EnterRenewing
It is time to enter the Dhcp4Renewing state and to contact the server that originally issued the netw...
Definition Dhcp4.h:180
@ Dhcp4AddressLost
The configured IP address was lost either because the lease has expired, the user released the config...
Definition Dhcp4.h:191
EFI_STATUS(EFIAPI * EFI_DHCP4_GET_MODE_DATA)(IN EFI_DHCP4_PROTOCOL *This, OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData)
Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
Definition Dhcp4.h:423
EFI_STATUS(EFIAPI * EFI_DHCP4_CALLBACK)(IN EFI_DHCP4_PROTOCOL *This, IN VOID *Context, IN EFI_DHCP4_STATE CurrentState, IN EFI_DHCP4_EVENT Dhcp4Event, IN EFI_DHCP4_PACKET *Packet OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL)
Callback routine.
Definition Dhcp4.h:234
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
GUID EFI_GUID
128-bit buffer containing a unique identifier value.
IPv4_ADDRESS EFI_IPv4_ADDRESS
4-byte buffer.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:951
#define EFI_EVENT
Definition efi.h:54
#define IN
Definition mlx_utils.h:28
#define OUT
Definition mlx_utils.h:29
VOID * CallbackContext
The pointer to the context that will be passed to Dhcp4Callback when it is called.
Definition Dhcp4.h:284
EFI_DHCP4_PACKET_OPTION ** OptionList
List of DHCP options to be included in every packet that is sent during the Dhcp4SendDiscover event.
Definition Dhcp4.h:296
UINT32 * DiscoverTimeout
The maximum amount of time (in seconds) to wait for returned packets in each of the retries.
Definition Dhcp4.h:255
EFI_IPv4_ADDRESS ClientAddress
For a DHCPDISCOVER, setting this parameter to the previously allocated IP address will cause the EFI ...
Definition Dhcp4.h:275
UINT32 * RequestTimeout
The maximum amount of time (in seconds) to wait for return packets in each of the retries.
Definition Dhcp4.h:267
UINT32 OptionCount
Number of DHCP options in the OptionList.
Definition Dhcp4.h:288
EFI_DHCP4_CALLBACK Dhcp4Callback
The callback function to intercept various events that occurred in the DHCP configuration process.
Definition Dhcp4.h:280
UINT32 RequestTryCount
The number of times to try sending a packet during the Dhcp4SendRequest event and waiting for a respo...
Definition Dhcp4.h:261
UINT32 DiscoverTryCount
The number of times to try sending a packet during the Dhcp4SendDiscover event and waiting for a resp...
Definition Dhcp4.h:249
EFI_DHCP4_PACKET defines the format of DHCPv4 packets.
Definition Dhcp4.h:53
EFI_IPv4_ADDRESS ClientAddr
Client IP address from client.
Definition Dhcp4.h:61
EFI_IPv4_ADDRESS ServerAddr
IP address of next server in bootstrap.
Definition Dhcp4.h:63
CHAR8 ServerName[64]
Definition Dhcp4.h:66
EFI_IPv4_ADDRESS GatewayAddr
Relay agent IP address.
Definition Dhcp4.h:64
UINT16 Seconds
Definition Dhcp4.h:59
UINT32 Xid
Definition Dhcp4.h:58
UINT8 HwAddrLen
Definition Dhcp4.h:56
CHAR8 BootFileName[128]
Definition Dhcp4.h:67
UINT16 Reserved
Definition Dhcp4.h:60
UINT8 OpCode
Definition Dhcp4.h:54
UINT8 HwType
Definition Dhcp4.h:55
UINT8 ClientHwAddr[16]
Client hardware address.
Definition Dhcp4.h:65
EFI_IPv4_ADDRESS YourAddr
Client IP address from server.
Definition Dhcp4.h:62
UINT16 ListenPort
Alternate station source (or listening) port number.
Definition Dhcp4.h:356
EFI_IPv4_ADDRESS ListenAddress
Alternate listening address.
Definition Dhcp4.h:346
EFI_IPv4_ADDRESS SubnetMask
The subnet mask of above listening unicast/broadcast IP address.
Definition Dhcp4.h:351
EFI_IPv4_ADDRESS ServerAddress
The server IP address that is providing the DHCP service to this client.
Definition Dhcp4.h:320
EFI_IPv4_ADDRESS SubnetMask
The subnet mask of the connected network that was acquired from the DHCP server.
Definition Dhcp4.h:329
EFI_DHCP4_CONFIG_DATA ConfigData
The configuration data of the current EFI DHCPv4 Protocol driver instance.
Definition Dhcp4.h:307
UINT32 LeaseTime
The lease time (in 1-second units) of the configured IP address.
Definition Dhcp4.h:335
EFI_DHCP4_STATE State
The EFI DHCPv4 Protocol driver operating state.
Definition Dhcp4.h:303
EFI_IPv4_ADDRESS RouterAddress
The router IP address that was acquired from the DHCP server.
Definition Dhcp4.h:325
EFI_IPv4_ADDRESS ClientAddress
The client IP address that was acquired from the DHCP server.
Definition Dhcp4.h:312
EFI_DHCP4_PACKET * ReplyPacket
The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet.
Definition Dhcp4.h:339
EFI_MAC_ADDRESS ClientMacAddress
The local hardware address.
Definition Dhcp4.h:316
UINT8 OpCode
DHCP option code.
Definition Dhcp4.h:37
UINT8 Data[1]
Start of the DHCP option data.
Definition Dhcp4.h:45
UINT8 Length
Length of the DHCP option data.
Definition Dhcp4.h:41
UINT8 Option[1]
Start of the DHCP packed option data.
Definition Dhcp4.h:95
UINT32 Length
Length of the EFI_DHCP4_PACKET from the first byte of the Header field to the last byte of the Option...
Definition Dhcp4.h:81
EFI_DHCP4_HEADER Header
DHCP packet header.
Definition Dhcp4.h:87
UINT32 Size
Size of the EFI_DHCP4_PACKET buffer.
Definition Dhcp4.h:76
UINT32 Magik
DHCP magik cookie in network byte order.
Definition Dhcp4.h:91
EFI_IPv4_ADDRESS RemoteAddress
The pointer to the server IP address.
Definition Dhcp4.h:372
UINT32 ListenPointCount
The number of entries in ListenPoints.
Definition Dhcp4.h:384
UINT32 TimeoutValue
The number of seconds to collect responses.
Definition Dhcp4.h:393
EFI_DHCP4_LISTEN_POINT * ListenPoints
An array of station address and port number pairs that are used as receiving filters.
Definition Dhcp4.h:389
EFI_DHCP4_PACKET * Packet
The pointer to the packet to be transmitted.
Definition Dhcp4.h:397
EFI_STATUS Status
The completion status of transmitting and receiving.
Definition Dhcp4.h:363
EFI_IPv4_ADDRESS GatewayAddress
The pointer to the gateway address to override the existing setting.
Definition Dhcp4.h:380
UINT32 ResponseCount
Number of received packets.
Definition Dhcp4.h:401
UINT16 RemotePort
The server listening port number.
Definition Dhcp4.h:376
EFI_DHCP4_PACKET * ResponseList
The pointer to the allocated list of received packets.
Definition Dhcp4.h:405
EFI_EVENT CompletionEvent
If not NULL, the event that will be signaled when the collection process completes.
Definition Dhcp4.h:368
32-byte buffer containing a network Media Access Control address.
This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers and to p...
Definition Dhcp4.h:749
EFI_DHCP4_BUILD Build
Definition Dhcp4.h:756
EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive
Definition Dhcp4.h:757
EFI_DHCP4_CONFIGURE Configure
Definition Dhcp4.h:751
EFI_DHCP4_PARSE Parse
Definition Dhcp4.h:758
EFI_DHCP4_GET_MODE_DATA GetModeData
Definition Dhcp4.h:750
EFI_DHCP4_STOP Stop
Definition Dhcp4.h:755
EFI_DHCP4_START Start
Definition Dhcp4.h:752
EFI_DHCP4_RENEW_REBIND RenewRebind
Definition Dhcp4.h:753
EFI_DHCP4_RELEASE Release
Definition Dhcp4.h:754