]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
Scrubbed part of the code.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Option.c
index 1453dfeb1cbd22c9badedabf7390279f76321806..571c6bbf95db664e8c66c9f3bd0caac66405ac15 100644 (file)
@@ -22,11 +22,11 @@ Abstract:
 \r
 #include "Dhcp4Impl.h"\r
 \r
-//\r
-// A list of the format of DHCP Options sorted by option tag\r
-// to validate a dhcp message. Refere the comments of the\r
-// DHCP_OPTION_FORMAT structure.\r
-//\r
+///\r
+/// A list of the format of DHCP Options sorted by option tag\r
+/// to validate a dhcp message. Refere the comments of the\r
+/// DHCP_OPTION_FORMAT structure.\r
+///\r
 DHCP_OPTION_FORMAT DhcpOptionFormats[] = {\r
   {DHCP_TAG_NETMASK,        DHCP_OPTION_IP,     1, 1  , TRUE},\r
   {DHCP_TAG_TIME_OFFSET,    DHCP_OPTION_INT32,  1, 1  , FALSE},\r
@@ -147,7 +147,7 @@ DhcpFindOptionFormat (
     if (Tag < DhcpOptionFormats[Middle].Tag) {\r
       Right = Middle - 1;\r
     } else {\r
-      Left = Middle + 1;\r
+      Left  = Middle + 1;\r
     }\r
   }\r
 \r
@@ -162,7 +162,8 @@ DhcpFindOptionFormat (
   @param  OptValue               The value of the option\r
   @param  Len                    The length of the option value\r
 \r
-  @return TRUE is the option is valid, otherwise FALSE.\r
+  @retval TRUE     The option is valid.\r
+  @retval FALSE    Otherwise.\r
 \r
 **/\r
 BOOLEAN\r
@@ -213,7 +214,8 @@ DhcpOptionIsValid (
   Occur = Len / Unit;\r
 \r
   if (((Format->MinOccur != -1) && (Occur < Format->MinOccur)) ||\r
-      ((Format->MaxOccur != -1) && (Occur > Format->MaxOccur))) {\r
+      ((Format->MaxOccur != -1) && (Occur > Format->MaxOccur))\r
+      ) {\r
     return FALSE;\r
   }\r
 \r
@@ -247,10 +249,10 @@ DhcpOptionIsValid (
 **/\r
 EFI_STATUS\r
 DhcpGetParameter (\r
-  IN UINT8                  Tag,\r
-  IN INTN                   Len,\r
-  IN UINT8                  *Data,\r
-  IN DHCP_PARAMETER         *Para\r
+  IN  UINT8                  Tag,\r
+  IN  INTN                   Len,\r
+  IN  UINT8                  *Data,\r
+  OUT DHCP_PARAMETER         *Para\r
   )\r
 {\r
   switch (Tag) {\r
@@ -311,7 +313,7 @@ DhcpGetParameter (
   @param  BufLen                 The length of the buffer\r
   @param  Check                  The callback function for each option found\r
   @param  Context                The opaque parameter for the Check\r
-  @param  Overload               variable to save the value of DHCP_TAG_OVERLOAD\r
+  @param  Overload               Variable to save the value of DHCP_TAG_OVERLOAD\r
                                  option.\r
 \r
   @retval EFI_SUCCESS            All the options are valid\r
@@ -389,7 +391,7 @@ DhcpIterateBufferOptions (
   @param  Context                The opaque parameter for Check\r
 \r
   @retval EFI_SUCCESS            The DHCP packet's options are well formated\r
-  @retval Others                 The DHCP packet's options are not well formated\r
+  @retval EFI_INVALID_PARAMETER  The DHCP packet's options are not well formated\r
 \r
 **/\r
 EFI_STATUS\r
@@ -449,7 +451,7 @@ DhcpIterateOptions (
 \r
 \r
 /**\r
-  Call back function to DhcpiterateOptions to compute each option's\r
+  Call back function to DhcpIterateOptions to compute each option's\r
   length. It just adds the data length of all the occurances of this\r
   Tag. Context is an array of 256 DHCP_OPTION_COUNT.\r
 \r
@@ -480,8 +482,8 @@ DhcpGetOptionLen (
 \r
 \r
 /**\r
-  Call back function to DhcpiterateOptions to consolidate each option's\r
-  data. There are maybe several occurance of the same option.\r
+  Call back function to DhcpIterateOptions to consolidate each option's\r
+  data. There are maybe several occurrence of the same option.\r
 \r
   @param  Tag                    The option to consolidate its data\r
   @param  Len                    The length of option data\r
@@ -536,7 +538,7 @@ DhcpFillOption (
   as a UINT8. It then iterates the DHCP packet to get data length of\r
   each option by calling DhcpIterOptions with DhcpGetOptionLen. Now, it\r
   knows the number of present options and their length. It allocates a\r
-  array of DHCP_OPTION and a continous buffer after the array to put\r
+  array of DHCP_OPTION and a continuous buffer after the array to put\r
   all the options' data. Each option's data is pointed to by the Data\r
   field in DHCP_OPTION structure. At last, it call DhcpIterateOptions\r
   with DhcpFillOption to fill each option's data to its position in the\r
@@ -743,10 +745,10 @@ ON_EXIT:
 **/\r
 UINT8 *\r
 DhcpAppendOption (\r
-  IN UINT8                  *Buf,\r
-  IN UINT8                  Tag,\r
-  IN UINT16                 DataLen,\r
-  IN UINT8                  *Data\r
+  OUT UINT8                  *Buf,\r
+  IN  UINT8                  Tag,\r
+  IN  UINT16                 DataLen,\r
+  IN  UINT8                  *Data\r
   )\r
 {\r
   INTN                      Index;\r
@@ -781,6 +783,7 @@ DhcpAppendOption (
                                  function.\r
 \r
   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory\r
+  @retval EFI_INVALID_PARAMETER  The options in SeekPacket are mal-formated\r
   @retval EFI_SUCCESS            The packet is build.\r
 \r
 **/\r