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