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