]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.h
code scrub for UefiPxeBcDxe.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcDhcp.h
index b3438d0e14138bca331ea14e938ad99656c1b260..76ebaca143dd7893fc502145e645d1b1af205660 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+  Dhcp and Discover routines for PxeBc.\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,21 +10,12 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  PxeBcDhcp.h\r
-\r
-Abstract:\r
-\r
-  Dhcp and Discover routines for PxeBc\r
-\r
-\r
 **/\r
 \r
 #ifndef __EFI_PXEBC_DHCP_H__\r
 #define __EFI_PXEBC_DHCP_H__\r
 \r
-enum {\r
+typedef enum {\r
   PXEBC_DHCP4_MAX_OPTION_NUM        = 16,\r
   PXEBC_DHCP4_MAX_OPTION_SIZE       = 312,\r
   PXEBC_DHCP4_MAX_PACKET_SIZE       = 1472,\r
@@ -105,12 +97,12 @@ enum {
 \r
   PXEBC_DHCP4_OVERLOAD_FILE         = 1,\r
   PXEBC_DHCP4_OVERLOAD_SERVER_NAME  = 2\r
-};\r
+} PXEBC_ENUM_TYPES;\r
 \r
 //\r
 // The array index of the DHCP4 option tag interested\r
 //\r
-enum {\r
+typedef enum {\r
   PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN,\r
   PXEBC_DHCP4_TAG_INDEX_VENDOR,\r
   PXEBC_DHCP4_TAG_INDEX_OVERLOAD,\r
@@ -119,19 +111,19 @@ enum {
   PXEBC_DHCP4_TAG_INDEX_CLASS_ID,\r
   PXEBC_DHCP4_TAG_INDEX_BOOTFILE,\r
   PXEBC_DHCP4_TAG_INDEX_MAX\r
-};\r
+} PXEBC_DHCP4_TAG_INDEX_ENUM_TYPES;\r
 \r
 //\r
 // The type of DHCP OFFER, arranged by priority, PXE10 has the highest priority.\r
 //\r
-enum {\r
+typedef enum {\r
   DHCP4_PACKET_TYPE_PXE10,\r
   DHCP4_PACKET_TYPE_WFM11A,\r
   DHCP4_PACKET_TYPE_BINL,\r
   DHCP4_PACKET_TYPE_DHCP_ONLY,\r
   DHCP4_PACKET_TYPE_MAX,\r
   DHCP4_PACKET_TYPE_BOOTP           = DHCP4_PACKET_TYPE_MAX\r
-};\r
+} DHCP4_PACKET_TYPE_ENUM_TYPES;\r
 \r
 #define BIT(x)  (1 << x)\r
 #define CTRL(x) (0x1F & (x))\r
@@ -301,36 +293,33 @@ typedef struct {
 #define GET_NEXT_BOOT_SVR_ENTRY(Ent) \\r
   (PXEBC_BOOT_SVR_ENTRY *) ((UINT8 *) Ent + sizeof (*(Ent)) + ((Ent)->IpCnt - 1) * sizeof (EFI_IPv4_ADDRESS))\r
 \r
+\r
+/**\r
+  This function initialize the DHCP4 message instance.\r
+\r
+  This function will pad each item of dhcp4 message packet.\r
+  \r
+  @param  Seed    Pointer to the message instance of the DHCP4 packet.\r
+  @param  Udp4    Pointer to the EFI_UDP4_PROTOCOL instance.\r
+\r
+  @return none.\r
+\r
+**/\r
 VOID\r
 PxeBcInitSeedPacket (\r
   IN EFI_DHCP4_PACKET  *Seed,\r
   IN EFI_UDP4_PROTOCOL *Udp4\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_NOTO: Add function description\r
-\r
-Arguments:\r
-\r
-  Seed  - GC_NOTO: add argument description\r
-  Udp4  - GC_NOTO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_NOTO: add return values\r
-\r
---*/\r
 ;\r
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
+  Parse the cached dhcp packet.\r
 \r
-  @param  CachedPacket    GC_NOTO: add argument description\r
+  @param  CachedPacket  Pointer to cached dhcp packet.\r
 \r
-  @return GC_NOTO: add return values\r
+  @retval TRUE          Success to parse and validation.\r
+  @retval FALSE         Fail to parse or validation.\r
 \r
 **/\r
 BOOLEAN\r
@@ -339,13 +328,15 @@ PxeBcParseCachedDhcpPacket (
   )\r
 ;\r
 \r
-\r
 /**\r
-  GC_NOTO: Add function description\r
+  This function is to check the selected proxy offer(include BINL dhcp offer and\r
+  DHCP_ONLY offer ) and set the flag and copy the DHCP packets to the Pxe base code\r
+  mode structure.\r
 \r
-  @param  Private         GC_NOTO: add argument description\r
+  @param  Private          Pointer to PxeBc private data.\r
 \r
-  @return GC_NOTO: add return values\r
+  @retval EFI_SUCCESS      Operational successful.\r
+  @retval EFI_NO_RESPONSE  Offer dhcp service failed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -356,16 +347,32 @@ PxeBcCheckSelectedOffer (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
-\r
-  @param  This            GC_NOTO: add argument description\r
-  @param  Context         GC_NOTO: add argument description\r
-  @param  CurrentState    GC_NOTO: add argument description\r
-  @param  Dhcp4Event      GC_NOTO: add argument description\r
-  @param  Packet          GC_NOTO: add argument description\r
-  @param  NewPacket       GC_NOTO: add argument description\r
-\r
-  @return GC_NOTO: add return values\r
+  Callback routine.\r
+  \r
+  EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver\r
+  to intercept events that occurred in the configuration process. This structure\r
+  provides advanced control of each state transition of the DHCP process. The\r
+  returned status code determines the behavior of the EFI DHCPv4 Protocol driver.\r
+  There are three possible returned values, which are described in the following\r
+  table.\r
+\r
+  @param  This                  Pointer to the EFI DHCPv4 Protocol instance that is used to\r
+                                configure this callback function.\r
+  @param  Context               Pointer to the context that is initialized by\r
+                                EFI_DHCP4_PROTOCOL.Configure().\r
+  @param  CurrentState          The current operational state of the EFI DHCPv4 Protocol\r
+                                driver.\r
+  @param  Dhcp4Event            The event that occurs in the current state, which usually means a\r
+                                state transition.\r
+  @param  Packet                The DHCP packet that is going to be sent or already received.\r
+  @param  NewPacket             The packet that is used to replace the above Packet.\r
+\r
+  @retval EFI_SUCCESS           Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.\r
+  @retval EFI_NOT_READY         Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol\r
+                                driver will continue to wait for more DHCPOFFER packets until the retry\r
+                                timeout expires.\r
+  @retval EFI_ABORTED           Tells the EFI DHCPv4 Protocol driver to abort the current process and\r
+                                return to the Dhcp4Init or Dhcp4InitReboot state.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -381,20 +388,23 @@ PxeBcDhcpCallBack (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
-\r
-  @param  Private         GC_NOTO: add argument description\r
-  @param  Type            GC_NOTO: add argument description\r
-  @param  Layer           GC_NOTO: add argument description\r
-  @param  UseBis          GC_NOTO: add argument description\r
-  @param  DestIp          GC_NOTO: add argument description\r
-  @param  IpCount         GC_NOTO: add argument description\r
-  @param  SrvList         GC_NOTO: add argument description\r
-  @param  IsDiscv         GC_NOTO: add argument description\r
-  @param  Reply           GC_NOTO: add argument description\r
-\r
-  @return GC_NOTO: add return values\r
-\r
+  Discover the boot of service and initialize the vendor option if exists.\r
+\r
+  @param  Private               Pointer to PxeBc private data.\r
+  @param  Type                  PxeBc option boot item type\r
+  @param  Layer                 PxeBc option boot item layer\r
+  @param  UseBis                use bios or not\r
+  @param  DestIp                ip address for server      \r
+  @param  IpCount               the total of the server ip address    \r
+  @param  SrvList               server list\r
+  @param  IsDiscv               discover the vendor or not\r
+  @param  Reply                 the dhcp4 packet of Pxe reply\r
+\r
+  @retval EFI_SUCCESS           operational success.\r
+  @retval EFI_OUT_OF_RESOURCES  Allocate memory pool failed.\r
+  @retval EFI_NOT_FOUND         There is no vendor option exists.\r
+  @retval EFI_TIMEOUT           Send Pxe Discover time out. \r
+  \r
 **/\r
 EFI_STATUS\r
 PxeBcDiscvBootService (\r
@@ -412,13 +422,14 @@ PxeBcDiscvBootService (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
+  Initialize the DHCP options and build the option list.\r
 \r
-  @param  Private         GC_NOTO: add argument description\r
-  @param  OptList         GC_NOTO: add argument description\r
-  @param  IsDhcpDiscover  GC_NOTO: add argument description\r
+  @param  Private          Pointer to PxeBc private data.\r
+  @param  OptList          Pointer to a DHCP option list.\r
+                           \r
+  @param  IsDhcpDiscover   Discover dhcp option or not.     \r
 \r
-  @return GC_NOTO: add return values\r
+  @return The index item number of the option list.\r
 \r
 **/\r
 UINT32\r
@@ -431,14 +442,14 @@ PxeBcBuildDhcpOptions (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
+  Create the boot options\r
 \r
-  @param  OptList         GC_NOTO: add argument description\r
-  @param  Type            GC_NOTO: add argument description\r
-  @param  Layer           GC_NOTO: add argument description\r
-  @param  OptLen          GC_NOTO: add argument description\r
+  @param  OptList    Pointer to the list of the options\r
+  @param  Type       the type of option\r
+  @param  Layer      the layer of the boot options \r
+  @param  OptLen     length of opotion\r
 \r
-  @return GC_NOTO: add return values\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -452,13 +463,14 @@ PxeBcCreateBootOptions (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
+  Parse interested dhcp options.\r
 \r
-  @param  Buffer          GC_NOTO: add argument description\r
-  @param  Length          GC_NOTO: add argument description\r
-  @param  OptTag          GC_NOTO: add argument description\r
+  @param  Buffer     Pointer to the dhcp options packet.\r
+  @param  Length     the length of the dhcp options.\r
+  @param  OptTag     the option OpCode.\r
 \r
-  @return GC_NOTO: add return values\r
+  @return Return NULL if the buffer length is 0 and OpCode is not \r
+          PXEBC_DHCP4_TAG_EOP, or the pointer to the buffer.\r
 \r
 **/\r
 EFI_DHCP4_PACKET_OPTION *\r
@@ -471,12 +483,12 @@ PxeBcParseExtendOptions (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
+  This function is to parse and check vendor options.\r
 \r
-  @param  Dhcp4Option     GC_NOTO: add argument description\r
-  @param  VendorOption    GC_NOTO: add argument description\r
+  @param  Dhcp4Option           Pointer to dhcp options\r
+  @param  VendorOption          Pointer to vendor options\r
 \r
-  @return GC_NOTO: add return values\r
+  @return Return TRUE if valid for vendor options, or FALSE.\r
 \r
 **/\r
 BOOLEAN\r
@@ -488,31 +500,16 @@ PxeBcParseVendorOptions (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
-\r
-  @param  Private         GC_NOTO: add argument description\r
-  @param  Info            GC_NOTO: add argument description\r
-  @param  Type            GC_NOTO: add argument description\r
-\r
-  @return GC_NOTO: add return values\r
-\r
-**/\r
-EFI_STATUS\r
-PxeBcSelectBootServers (\r
-  IN  PXEBC_PRIVATE_DATA               *Private,\r
-  OUT EFI_PXE_BASE_CODE_DISCOVER_INFO  **Info,\r
-  OUT UINT16                           *Type\r
-  )\r
-;\r
-\r
-\r
-/**\r
-  GC_NOTO: Add function description\r
-\r
-  @param  Private         GC_NOTO: add argument description\r
+  Choose the boot prompt.\r
 \r
-  @return GC_NOTO: add return values\r
+  @param  Private              Pointer to PxeBc private data.\r
 \r
+  @retval EFI_SUCCESS          Select boot prompt done.\r
+  @retval EFI_TIMEOUT          Select boot prompt time out. \r
+  @retval EFI_NOT_FOUND        The proxy offer is not Pxe10.\r
+  @retval EFI_ABORTED          User cancel the operation.\r
+  @retval EFI_NOT_READY        Read the input key from the keybroad has not finish.\r
+  \r
 **/\r
 EFI_STATUS\r
 PxeBcSelectBootPrompt (\r
@@ -522,12 +519,15 @@ PxeBcSelectBootPrompt (
 \r
 \r
 /**\r
-  GC_NOTO: Add function description\r
-\r
-  @param  Private         GC_NOTO: add argument description\r
-  @param  Type            GC_NOTO: add argument description\r
-\r
-  @return GC_NOTO: add return values\r
+  Select the boot menu.\r
+\r
+  @param  Private         Pointer to PxeBc private data.\r
+  @param  Type            The type of the menu.\r
+  @param  UseDefaultItem  Use default item or not.\r
+  \r
+  @retval EFI_ABORTED     User cancel operation.\r
+  @retval EFI_SUCCESS     Select the boot menu success.\r
+  @retval EFI_NOT_READY   Read the input key from the keybroad has not finish.    \r
 \r
 **/\r
 EFI_STATUS\r