]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Clean codes per ECC.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Jun 2008 07:20:33 +0000 (07:20 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Jun 2008 07:20:33 +0000 (07:20 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5384 6f19259b-4bc3-4df7-8a09-765794883524

19 files changed:
MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.c
MdeModulePkg/Universal/Network/ArpDxe/ArpDriver.h
MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.c
MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.h
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
MdeModulePkg/Universal/Network/DpcDxe/Dpc.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h

index c33ce4d98a712b4b171b8f1d8abe44ef3a6db9eb..49352c0bb115bfae7e31515dd60e8bb16e9891b8 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -45,7 +45,6 @@ EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding = {
   @retval other                  Failed to initialize the arp service context.\r
 \r
 **/\r
   @retval other                  Failed to initialize the arp service context.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 ArpCreateService (\r
   IN EFI_HANDLE        ImageHandle,\r
 EFI_STATUS\r
 ArpCreateService (\r
   IN EFI_HANDLE        ImageHandle,\r
@@ -200,7 +199,6 @@ ERROR_EXIT:
   @return None.\r
 \r
 **/\r
   @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 ArpCleanService (\r
   IN ARP_SERVICE_DATA  *ArpService\r
 VOID\r
 ArpCleanService (\r
   IN ARP_SERVICE_DATA  *ArpService\r
@@ -706,31 +704,23 @@ ArpServiceBindingDestroyChild (
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
+/**\r
+  The entry point for Arp driver which installs the driver binding and component name\r
+  protocol on its ImageHandle.\r
+\r
+  @param  ImageHandle            The image handle of the driver.\r
+  @param  SystemTable            The system table.\r
 \r
 \r
+  @retval EFI_SUCCES             if the driver binding and component name protocols are successfully\r
+  @retval Others                 Failed to install the protocols.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverEntryPoint (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverEntryPoint (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The entry point for Arp driver which installs the driver binding and component name\r
-  protocol on its ImageHandle.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The image handle of the driver.\r
-  SystemTable - The system table.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - if the driver binding and component name protocols are successfully\r
-                installed, otherwise if failed.\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
index 8c938e917defa1a527aa8ee2fd1fe934d166d4c3..aa22cc1433a17563f811899583c6bf2689000c9c 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -41,6 +41,19 @@ extern EFI_DRIVER_BINDING_PROTOCOL    gArpDriverBinding;
 extern EFI_COMPONENT_NAME_PROTOCOL    gArpComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL   gArpComponentName2;\r
 \r
 extern EFI_COMPONENT_NAME_PROTOCOL    gArpComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL   gArpComponentName2;\r
 \r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to test.\r
+  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
+                                 device to start.\r
+\r
+  @retval EFI_SUCCES             This driver supports this device\r
+  @retval EFI_ALREADY_STARTED    This driver is already running on this device.\r
+  @retval other                  This driver does not support this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingSupported (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingSupported (\r
@@ -49,6 +62,19 @@ ArpDriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to bind driver to\r
+  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
+                                 device to start.\r
+\r
+  @retval EFI_SUCCES             This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED    This driver is already running on ControllerHandle\r
+  @retval other                  This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingStart (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingStart (\r
@@ -57,6 +83,19 @@ ArpDriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to stop driver on\r
+  @param  NumberOfChildren       Number of Handles in ChildHandleBuffer. If number\r
+                                 of  children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer      List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCES             This driver is removed ControllerHandle\r
+  @retval other                  This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingStop (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDriverBindingStop (\r
@@ -66,6 +105,22 @@ ArpDriverBindingStop (
   IN EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
   IN EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
+/**\r
+  Creates a child handle with a set of I/O services.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ChildHandle            Pointer to the handle of the child to create. If\r
+                                 it is NULL, then a new handle is created. If it is\r
+                                 not NULL, then the I/O services are  added to the\r
+                                 existing child handle.\r
+\r
+  @retval EFI_SUCCES             The child handle was created with the I/O\r
+                                 services.\r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources availabe to create\r
+                                 the child.\r
+  @retval other                  The child handle was not created.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpServiceBindingCreateChild (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpServiceBindingCreateChild (\r
@@ -73,6 +128,22 @@ ArpServiceBindingCreateChild (
   IN EFI_HANDLE                    *ChildHandle\r
   );\r
 \r
   IN EFI_HANDLE                    *ChildHandle\r
   );\r
 \r
+/**\r
+  Destroys a child handle with a set of I/O services.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ChildHandle            Handle of the child to destroy.\r
+\r
+  @retval EFI_SUCCES             The I/O services were removed from the child\r
+                                 handle.\r
+  @retval EFI_UNSUPPORTED        The child handle does not support the I/O services\r
+                                  that are being removed.\r
+  @retval EFI_INVALID_PARAMETER  Child handle is not a valid EFI Handle.\r
+  @retval EFI_ACCESS_DENIED      The child handle could not be destroyed because\r
+                                 its  I/O services are being used.\r
+  @retval other                  The child handle was not destroyed.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpServiceBindingDestroyChild (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpServiceBindingDestroyChild (\r
index 797ebd0ba08528805d3c6225c2e0b3715b6d86a3..e29fbf872ca157214f6f8b6d2e246b6fc3ebf748 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -531,7 +531,6 @@ ArpTimerHandler (
   @return The two addresses match or not.\r
 \r
 **/\r
   @return The two addresses match or not.\r
 \r
 **/\r
-STATIC\r
 BOOLEAN\r
 ArpMatchAddress (\r
   IN NET_ARP_ADDRESS  *AddressOne,\r
 BOOLEAN\r
 ArpMatchAddress (\r
   IN NET_ARP_ADDRESS  *AddressOne,\r
@@ -597,7 +596,7 @@ ArpFindNextCacheEntryInTable (
   for (Entry = StartEntry->ForwardLink; Entry != CacheTable; Entry = Entry->ForwardLink) {\r
     CacheEntry = NET_LIST_USER_STRUCT (Entry, ARP_CACHE_ENTRY, List);\r
 \r
   for (Entry = StartEntry->ForwardLink; Entry != CacheTable; Entry = Entry->ForwardLink) {\r
     CacheEntry = NET_LIST_USER_STRUCT (Entry, ARP_CACHE_ENTRY, List);\r
 \r
-    if (FindOpType & MATCH_SW_ADDRESS) {\r
+    if ((FindOpType & MATCH_SW_ADDRESS) != 0) {\r
       //\r
       // Find by the software address.\r
       //\r
       //\r
       // Find by the software address.\r
       //\r
@@ -609,7 +608,7 @@ ArpFindNextCacheEntryInTable (
       }\r
     }\r
 \r
       }\r
     }\r
 \r
-    if (FindOpType & MATCH_HW_ADDRESS) {\r
+    if ((FindOpType & MATCH_HW_ADDRESS) != 0) {\r
       //\r
       // Find by the hardware address.\r
       //\r
       //\r
       // Find by the hardware address.\r
       //\r
@@ -930,7 +929,7 @@ ArpConfigureInstance (
       // The instance is not configured.\r
       //\r
 \r
       // The instance is not configured.\r
       //\r
 \r
-      if (ConfigData->SwAddressType == IPv4_ETHER_PROTO_TYPE) {\r
+      if (ConfigData->SwAddressType == IPV4_ETHER_PROTO_TYPE) {\r
         CopyMem (&Ip, ConfigData->StationAddress, sizeof (IP4_ADDR));\r
 \r
         if (!Ip4IsUnicast (NTOHL (Ip), 0)) {\r
         CopyMem (&Ip, ConfigData->StationAddress, sizeof (IP4_ADDR));\r
 \r
         if (!Ip4IsUnicast (NTOHL (Ip), 0)) {\r
@@ -1224,7 +1223,6 @@ CLEAN_EXIT:
   @return The count of the deleted cache entries.\r
 \r
 **/\r
   @return The count of the deleted cache entries.\r
 \r
 **/\r
-STATIC\r
 UINTN\r
 ArpDeleteCacheEntryInTable (\r
   IN LIST_ENTRY      *CacheTable,\r
 UINTN\r
 ArpDeleteCacheEntryInTable (\r
   IN LIST_ENTRY      *CacheTable,\r
index 1db6d34ab30adb5f42f227fbd141dade2280d9ae..935d788280192057a78d3cf4415e5b696762097f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -39,8 +39,8 @@ Abstract:
 \r
 \r
 #define ARP_ETHER_PROTO_TYPE         0x0806\r
 \r
 \r
 #define ARP_ETHER_PROTO_TYPE         0x0806\r
-#define IPv4_ETHER_PROTO_TYPE        0x0800\r
-#define IPv6_ETHER_PROTO_TYPE        0x86DD\r
+#define IPV4_ETHER_PROTO_TYPE        0x0800\r
+#define IPV6_ETHER_PROTO_TYPE        0x86DD\r
 \r
 #define ARP_OPCODE_REQUEST           0x0001\r
 #define ARP_OPCODE_REPLY             0x0002\r
 \r
 #define ARP_OPCODE_REQUEST           0x0001\r
 #define ARP_OPCODE_REPLY             0x0002\r
@@ -172,6 +172,27 @@ typedef struct _ARP_CACHE_ENTRY {
   LIST_ENTRY      UserRequestList;\r
 } ARP_CACHE_ENTRY;\r
 \r
   LIST_ENTRY      UserRequestList;\r
 } ARP_CACHE_ENTRY;\r
 \r
+/**\r
+  This function is used to assign a station address to the ARP cache for this instance\r
+  of the ARP driver. A call to this function with the ConfigData field set to NULL\r
+  will reset this ARP instance.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  ConfigData             Pointer to the EFI_ARP_CONFIG_DATA structure.\r
+\r
+  @retval EFI_SUCCESS            The new station address was successfully\r
+                                 registered.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. SwAddressLength is zero when\r
+                                 ConfigData is not NULL. StationAddress is NULL\r
+                                 when ConfigData is not NULL.\r
+  @retval EFI_ACCESS_DENIED      The SwAddressType, SwAddressLength, or\r
+                                 StationAddress is different from the one that is\r
+                                 already registered.\r
+  @retval EFI_OUT_OF_RESOURCES   Storage for the new StationAddress could not be\r
+                                 allocated.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpConfigure (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpConfigure (\r
@@ -179,6 +200,40 @@ ArpConfigure (
   IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
   );\r
 \r
   IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
   );\r
 \r
+/**\r
+  This function is used to insert entries into the ARP cache.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  DenyFlag               Set to TRUE if this entry is a deny entry. Set to\r
+                                 FALSE if this  entry is a normal entry.\r
+  @param  TargetSwAddress        Pointer to a protocol address to add (or deny).\r
+                                 May be set to NULL if DenyFlag is TRUE.\r
+  @param  TargetHwAddress        Pointer to a hardware address to add (or deny).\r
+                                 May be set to NULL if DenyFlag is TRUE.\r
+  @param  TimeoutValue           Time in 100-ns units that this entry will remain\r
+                                 in the ARP cache. A value of zero means that the\r
+                                 entry is permanent. A nonzero value will override\r
+                                 the one given by Configure() if the entry to be\r
+                                 added is a dynamic entry.\r
+  @param  Overwrite              If TRUE, the matching cache entry will be\r
+                                 overwritten with the supplied parameters. If\r
+                                 FALSE, EFI_ACCESS_DENIED is returned if the\r
+                                 corresponding cache entry already exists.\r
+\r
+  @retval EFI_SUCCESS            The entry has been added or updated.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. DenyFlag is FALSE and\r
+                                 TargetHwAddress is NULL. DenyFlag is FALSE and\r
+                                 TargetSwAddress is NULL. TargetHwAddress is NULL\r
+                                 and TargetSwAddress is NULL. Both TargetSwAddress\r
+                                 and TargetHwAddress are not NULL when DenyFlag is\r
+                                 TRUE.\r
+  @retval EFI_OUT_OF_RESOURCES   The new ARP cache entry could not be allocated.\r
+  @retval EFI_ACCESS_DENIED      The ARP cache entry already exists and Overwrite\r
+                                 is not true.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpAdd (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpAdd (\r
@@ -190,6 +245,33 @@ ArpAdd (
   IN BOOLEAN           Overwrite\r
   );\r
 \r
   IN BOOLEAN           Overwrite\r
   );\r
 \r
+/**\r
+  This function searches the ARP cache for matching entries and allocates a buffer into\r
+  which those entries are copied.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress            Set to TRUE to look for matching software protocol\r
+                                 addresses. Set to FALSE to look for matching\r
+                                 hardware protocol addresses.\r
+  @param  AddressBuffer          Pointer to address buffer. Set to NULL to match\r
+                                 all addresses.\r
+  @param  EntryLength            The size of an entry in the entries buffer.\r
+  @param  EntryCount             The number of ARP cache entries that are found by\r
+                                 the specified criteria.\r
+  @param  Entries                Pointer to the buffer that will receive the ARP\r
+                                 cache entries.\r
+  @param  Refresh                Set to TRUE to refresh the timeout value of the\r
+                                 matching ARP cache entry.\r
+\r
+  @retval EFI_SUCCESS            The requested ARP cache entries were copied into\r
+                                 the buffer.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. Both EntryCount and EntryLength are\r
+                                 NULL, when Refresh is FALSE.\r
+  @retval EFI_NOT_FOUND          No matching entries were found.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpFind (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpFind (\r
@@ -202,6 +284,23 @@ ArpFind (
   IN BOOLEAN             Refresh\r
   );\r
 \r
   IN BOOLEAN             Refresh\r
   );\r
 \r
+/**\r
+  This function removes specified ARP cache entries.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress            Set to TRUE to delete matching protocol addresses.\r
+                                 Set to FALSE to delete matching hardware\r
+                                 addresses.\r
+  @param  AddressBuffer          Pointer to the address buffer that is used as a\r
+                                 key to look for the cache entry. Set to NULL to\r
+                                 delete all entries.\r
+\r
+  @retval EFI_SUCCESS            The entry was removed from the ARP cache.\r
+  @retval EFI_INVALID_PARAMETER  This is NULL.\r
+  @retval EFI_NOT_FOUND          The specified deletion key was not found.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDelete (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpDelete (\r
@@ -210,12 +309,46 @@ ArpDelete (
   IN VOID              *AddressBuffer OPTIONAL\r
   );\r
 \r
   IN VOID              *AddressBuffer OPTIONAL\r
   );\r
 \r
+/**\r
+  This function delete all dynamic entries from the ARP cache that match the specified\r
+  software protocol type.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS            The cache has been flushed.\r
+  @retval EFI_INVALID_PARAMETER  This is NULL.\r
+  @retval EFI_NOT_FOUND          There are no matching dynamic cache entries.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpFlush (\r
   IN EFI_ARP_PROTOCOL  *This\r
   );\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 ArpFlush (\r
   IN EFI_ARP_PROTOCOL  *This\r
   );\r
 \r
+/**\r
+  This function tries to resolve the TargetSwAddress and optionally returns a\r
+  TargetHwAddress if it already exists in the ARP cache.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress        Pointer to the protocol address to resolve.\r
+  @param  ResolvedEvent          Pointer to the event that will be signaled when\r
+                                 the address is resolved or some error occurs.\r
+  @param  TargetHwAddress        Pointer to the buffer for the resolved hardware\r
+                                 address in network byte order.\r
+\r
+  @retval EFI_SUCCESS            The data is copied from the ARP cache into the\r
+                                 TargetHwAddress buffer.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. TargetHwAddress is NULL.\r
+  @retval EFI_ACCESS_DENIED      The requested address is not present in the normal\r
+                                 ARP cache but is present in the deny address list.\r
+                                 Outgoing traffic to that address is forbidden.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_READY          The request has been started and is not finished.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpRequest (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpRequest (\r
@@ -225,6 +358,27 @@ ArpRequest (
   OUT VOID             *TargetHwAddress\r
   );\r
 \r
   OUT VOID             *TargetHwAddress\r
   );\r
 \r
+/**\r
+  This function aborts the previous ARP request (identified by This,  TargetSwAddress\r
+  and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress        Pointer to the protocol address in previous\r
+                                 request session.\r
+  @param  ResolvedEvent          Pointer to the event that is used as the\r
+                                 notification event in previous request session.\r
+\r
+  @retval EFI_SUCCESS            The pending request session(s) is/are aborted and\r
+                                 corresponding event(s) is/are signaled.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. TargetSwAddress is not NULL and\r
+                                 ResolvedEvent is NULL. TargetSwAddress is NULL and\r
+                                 ResolvedEvent is not NULL.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_FOUND          The request is not issued by\r
+                                 EFI_ARP_PROTOCOL.Request().\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ArpCancel (\r
 EFI_STATUS\r
 EFIAPI\r
 ArpCancel (\r
@@ -233,12 +387,41 @@ ArpCancel (
   IN EFI_EVENT         ResolvedEvent    OPTIONAL\r
   );\r
 \r
   IN EFI_EVENT         ResolvedEvent    OPTIONAL\r
   );\r
 \r
+/**\r
+  Configure the instance using the ConfigData. ConfigData is already validated.\r
+\r
+  @param  Instance               Pointer to the instance context data to be\r
+                                 configured.\r
+  @param  ConfigData             Pointer to the configuration data used to\r
+                                 configure the instance.\r
+\r
+  @retval EFI_SUCCESS            The instance is configured with the ConfigData.\r
+  @retval EFI_ACCESS_DENIED      The instance is already configured and the\r
+                                 ConfigData tries to reset some unchangeable\r
+                                 fields.\r
+  @retval EFI_INVALID_PARAMETER  The ConfigData provides a non-unicast IPv4 address\r
+                                 when the SwAddressType is IPv4.\r
+  @retval EFI_OUT_OF_RESOURCES   The instance fails to configure due to memory\r
+                                 limitation.\r
+\r
+**/\r
 EFI_STATUS\r
 ArpConfigureInstance (\r
   IN ARP_INSTANCE_DATA    *Instance,\r
   IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
   );\r
 \r
 EFI_STATUS\r
 ArpConfigureInstance (\r
   IN ARP_INSTANCE_DATA    *Instance,\r
   IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
   );\r
 \r
+/**\r
+  Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,\r
+  in the DeniedCacheTable.\r
+\r
+  @param  ArpService             Pointer to the arp service context data.\r
+  @param  ProtocolAddress        Pointer to the protocol address.\r
+  @param  HardwareAddress        Pointer to the hardware address.\r
+\r
+  @return Pointer to the matched cache entry, if NULL no match is found.\r
+\r
+**/\r
 ARP_CACHE_ENTRY *\r
 ArpFindDeniedCacheEntry (\r
   IN ARP_SERVICE_DATA  *ArpService,\r
 ARP_CACHE_ENTRY *\r
 ArpFindDeniedCacheEntry (\r
   IN ARP_SERVICE_DATA  *ArpService,\r
@@ -246,6 +429,19 @@ ArpFindDeniedCacheEntry (
   IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
   );\r
 \r
   IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
   );\r
 \r
+/**\r
+  Find the CacheEntry which matches the requirements in the specified CacheTable.\r
+\r
+  @param  CacheTable             Pointer to the arp cache table.\r
+  @param  StartEntry             Pointer to the start entry this search begins with\r
+                                 in the cache table.\r
+  @param  FindOpType             The search type.\r
+  @param  ProtocolAddress        Pointer to the protocol address to match.\r
+  @param  HardwareAddress        Pointer to the hardware address to match.\r
+\r
+  @return Pointer to the matched arp cache entry, if NULL, no match is found.\r
+\r
+**/\r
 ARP_CACHE_ENTRY *\r
 ArpFindNextCacheEntryInTable (\r
   IN LIST_ENTRY        *CacheTable,\r
 ARP_CACHE_ENTRY *\r
 ArpFindNextCacheEntryInTable (\r
   IN LIST_ENTRY        *CacheTable,\r
@@ -255,11 +451,30 @@ ArpFindNextCacheEntryInTable (
   IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
   );\r
 \r
   IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
   );\r
 \r
+/**\r
+  Allocate a cache entry and initialize it.\r
+\r
+  @param  Instance               Pointer to the instance context data.\r
+\r
+  @return Pointer to the new created cache entry.\r
+\r
+**/\r
 ARP_CACHE_ENTRY *\r
 ArpAllocCacheEntry (\r
   IN ARP_INSTANCE_DATA  *Instance\r
   );\r
 \r
 ARP_CACHE_ENTRY *\r
 ArpAllocCacheEntry (\r
   IN ARP_INSTANCE_DATA  *Instance\r
   );\r
 \r
+/**\r
+  Fill the addresses in the CacheEntry using the information passed in by\r
+  HwAddr and SwAddr.\r
+\r
+  @param  CacheEntry             Pointer to the cache entry.\r
+  @param  HwAddr                 Pointer to the software address.\r
+  @param  SwAddr                 Pointer to the hardware address.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 ArpFillAddressInCacheEntry (\r
   IN ARP_CACHE_ENTRY  *CacheEntry,\r
 VOID\r
 ArpFillAddressInCacheEntry (\r
   IN ARP_CACHE_ENTRY  *CacheEntry,\r
@@ -267,6 +482,16 @@ ArpFillAddressInCacheEntry (
   IN NET_ARP_ADDRESS  *SwAddr OPTIONAL\r
   );\r
 \r
   IN NET_ARP_ADDRESS  *SwAddr OPTIONAL\r
   );\r
 \r
+/**\r
+  Turn the CacheEntry into the resolved status.\r
+\r
+  @param  CacheEntry             Pointer to the resolved cache entry.\r
+  @param  Instance               Pointer to the instance context data.\r
+  @param  UserEvent              Pointer to the UserEvent to notify.\r
+\r
+  @return The count of notifications sent to the instance.\r
+\r
+**/\r
 UINTN\r
 ArpAddressResolved (\r
   IN ARP_CACHE_ENTRY    *CacheEntry,\r
 UINTN\r
 ArpAddressResolved (\r
   IN ARP_CACHE_ENTRY    *CacheEntry,\r
@@ -274,6 +499,19 @@ ArpAddressResolved (
   IN EFI_EVENT          UserEvent OPTIONAL\r
   );\r
 \r
   IN EFI_EVENT          UserEvent OPTIONAL\r
   );\r
 \r
+/**\r
+  Delete cache entries in all the cache tables.\r
+\r
+  @param  Instance               Pointer to the instance context data.\r
+  @param  BySwAddress            Delete the cache entry by software address or by\r
+                                 hardware address.\r
+  @param  AddressBuffer          Pointer to the buffer containing the address to\r
+                                 match for the deletion.\r
+  @param  Force                  This deletion is forced or not.\r
+\r
+  @return The count of the deleted cache entries.\r
+\r
+**/\r
 UINTN\r
 ArpDeleteCacheEntry (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
 UINTN\r
 ArpDeleteCacheEntry (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
@@ -282,6 +520,18 @@ ArpDeleteCacheEntry (
   IN BOOLEAN            Force\r
   );\r
 \r
   IN BOOLEAN            Force\r
   );\r
 \r
+/**\r
+  Send out an arp frame using the CachEntry and the ArpOpCode.\r
+\r
+  @param  Instance               Pointer to the instance context data.\r
+  @param  CacheEntry             Pointer to the configuration data used to\r
+                                 configure the instance.\r
+  @param  ArpOpCode              The opcode used to send out this Arp frame, either\r
+                                 request or reply.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 ArpSendFrame (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
 VOID\r
 ArpSendFrame (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
@@ -289,18 +539,47 @@ ArpSendFrame (
   IN UINT16             ArpOpCode\r
   );\r
 \r
   IN UINT16             ArpOpCode\r
   );\r
 \r
+/**\r
+  Initialize the instance context data.\r
+\r
+  @param  ArpService             Pointer to the arp service context data this\r
+                                 instance belongs to.\r
+  @param  Instance               Pointer to the instance context data.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 ArpInitInstance (\r
   IN ARP_SERVICE_DATA   *ArpService,\r
   IN ARP_INSTANCE_DATA  *Instance\r
   );\r
 \r
 VOID\r
 ArpInitInstance (\r
   IN ARP_SERVICE_DATA   *ArpService,\r
   IN ARP_INSTANCE_DATA  *Instance\r
   );\r
 \r
+/**\r
+  Process the Arp packets received from Mnp, the procedure conforms to RFC826.\r
+\r
+  @param  Context                Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 ArpOnFrameRcvdDpc (\r
   IN VOID       *Context\r
   );\r
 \r
 VOID\r
 EFIAPI\r
 ArpOnFrameRcvdDpc (\r
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r
+\r
+  @param  Event                  The Event this notify function registered to.\r
+  @param  Context                Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 ArpOnFrameRcvd (\r
 VOID\r
 EFIAPI\r
 ArpOnFrameRcvd (\r
@@ -308,12 +587,31 @@ ArpOnFrameRcvd (
   IN VOID       *Context\r
   );\r
 \r
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Process the already sent arp packets.\r
+\r
+  @param  Context                Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 ArpOnFrameSentDpc (\r
   IN VOID       *Context\r
   );\r
 \r
 VOID\r
 EFIAPI\r
 ArpOnFrameSentDpc (\r
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r
+\r
+  @param  Event                  The Event this notify function registered to.\r
+  @param  Context                Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 ArpOnFrameSent (\r
 VOID\r
 EFIAPI\r
 ArpOnFrameSent (\r
@@ -321,6 +619,16 @@ ArpOnFrameSent (
   IN VOID       *Context\r
   );\r
 \r
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Process the arp cache olding and drive the retrying arp requests.\r
+\r
+  @param  Event                  The Event this notify function registered to.\r
+  @param  Context                Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 ArpTimerHandler (\r
 VOID\r
 EFIAPI\r
 ArpTimerHandler (\r
@@ -328,6 +636,18 @@ ArpTimerHandler (
   IN VOID       *Context\r
   );\r
 \r
   IN VOID       *Context\r
   );\r
 \r
+/**\r
+  Cancel the arp request.\r
+\r
+  @param  Instance               Pointer to the instance context data.\r
+  @param  TargetSwAddress        Pointer to the buffer containing the target\r
+                                 software address to match the arp request.\r
+  @param  UserEvent              The user event used to notify this request\r
+                                 cancellation.\r
+\r
+  @return The count of the cancelled requests.\r
+\r
+**/\r
 UINTN\r
 ArpCancelRequest (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
 UINTN\r
 ArpCancelRequest (\r
   IN ARP_INSTANCE_DATA  *Instance,\r
@@ -335,6 +655,29 @@ ArpCancelRequest (
   IN EFI_EVENT          UserEvent        OPTIONAL\r
   );\r
 \r
   IN EFI_EVENT          UserEvent        OPTIONAL\r
   );\r
 \r
+/**\r
+  Find the cache entry in the cache table.\r
+\r
+  @param  Instance               Pointer to the instance context data.\r
+  @param  BySwAddress            Set to TRUE to look for matching software protocol\r
+                                 addresses. Set to FALSE to look for matching\r
+                                 hardware protocol addresses.\r
+  @param  AddressBuffer          Pointer to address buffer. Set to NULL to match\r
+                                 all addresses.\r
+  @param  EntryLength            The size of an entry in the entries buffer.\r
+  @param  EntryCount             The number of ARP cache entries that are found by\r
+                                 the specified criteria.\r
+  @param  Entries                Pointer to the buffer that will receive the ARP\r
+                                 cache entries.\r
+  @param  Refresh                Set to TRUE to refresh the timeout value of the\r
+                                 matching ARP cache entry.\r
+\r
+  @retval EFI_SUCCESS            The requested ARP cache entries are copied into\r
+                                 the buffer.\r
+  @retval EFI_NOT_FOUND          No matching entries found.\r
+  @retval EFI_OUT_OF_RESOURCE    There is a memory allocation failure.\r
+\r
+**/\r
 EFI_STATUS\r
 ArpFindCacheEntry (\r
   IN ARP_INSTANCE_DATA   *Instance,\r
 EFI_STATUS\r
 ArpFindCacheEntry (\r
   IN ARP_INSTANCE_DATA   *Instance,\r
index 46aa19226b3914c1e8abb9099d7a21c3e88e5938..2d607fbf02569dfb4c88ceef11dec9cb8b064501 100644 (file)
@@ -495,7 +495,7 @@ ArpRequest (
   SnpMode    = &ArpService->SnpMode;\r
 \r
   if ((TargetSwAddress == NULL) ||\r
   SnpMode    = &ArpService->SnpMode;\r
 \r
   if ((TargetSwAddress == NULL) ||\r
-    ((Instance->ConfigData.SwAddressType == IPv4_ETHER_PROTO_TYPE) &&\r
+    ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&\r
     IP4_IS_LOCAL_BROADCAST (*((UINT32 *)TargetSwAddress)))) {\r
     //\r
     // Return the hardware broadcast address.\r
     IP4_IS_LOCAL_BROADCAST (*((UINT32 *)TargetSwAddress)))) {\r
     //\r
     // Return the hardware broadcast address.\r
@@ -505,7 +505,7 @@ ArpRequest (
     goto SIGNAL_USER;\r
   }\r
 \r
     goto SIGNAL_USER;\r
   }\r
 \r
-  if ((Instance->ConfigData.SwAddressType == IPv4_ETHER_PROTO_TYPE) &&\r
+  if ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&\r
     IP4_IS_MULTICAST (NTOHL (*((UINT32 *)TargetSwAddress)))) {\r
     //\r
     // If the software address is an IPv4 multicast address, invoke Mnp to\r
     IP4_IS_MULTICAST (NTOHL (*((UINT32 *)TargetSwAddress)))) {\r
     //\r
     // If the software address is an IPv4 multicast address, invoke Mnp to\r
index d27810322e4d7a5c01124d71d046892e84fad1b4..360193ea4be8db37985eefcfa0f62a9607a3e9ae 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -36,30 +36,22 @@ EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplete = {
   Dhcp4ServiceBindingDestroyChild\r
 };\r
 \r
   Dhcp4ServiceBindingDestroyChild\r
 };\r
 \r
+/**\r
+  Entry point of the DHCP driver to install various protocols.\r
+\r
+  @param  ImageHandle            The image handle of the driver.\r
+  @param  SystemTable            The system table.\r
+\r
+  @retval EFI_SUCCES             if the driver binding and component name protocols are successfully\r
+  @retval Others                 Failed to install the protocols.\r
 \r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverEntryPoint (\r
   IN EFI_HANDLE             ImageHandle,\r
   IN EFI_SYSTEM_TABLE       *SystemTable\r
   )\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverEntryPoint (\r
   IN EFI_HANDLE             ImageHandle,\r
   IN EFI_SYSTEM_TABLE       *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Entry point of the DHCP driver to install various protocols.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The driver's image handle\r
-  SystemTable - The system table\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - All the related protocols are installed.\r
-  Others      - Failed to install the protocols.\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
@@ -432,7 +424,7 @@ Dhcp4DriverBindingStop (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Initialize a new DHCP child\r
+  Initialize a new DHCP child.\r
 \r
   @param  DhcpSb                 The dhcp service instance\r
   @param  Instance               The dhcp instance to initialize\r
 \r
   @param  DhcpSb                 The dhcp service instance\r
   @param  Instance               The dhcp instance to initialize\r
index 845a2847a3c4c586fb19e45b52a952d778e1db1b..b0052bef694cfb37024a15a43a7f8fb0bbff831a 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -26,6 +26,19 @@ Abstract:
 extern EFI_COMPONENT_NAME_PROTOCOL  gDhcp4ComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2;\r
 \r
 extern EFI_COMPONENT_NAME_PROTOCOL  gDhcp4ComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2;\r
 \r
+/**\r
+  Test to see if this driver supports ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to test.\r
+  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
+                                 device to start.\r
+\r
+  @retval EFI_SUCCES             This driver supports this device\r
+  @retval EFI_ALREADY_STARTED    This driver is already running on this device.\r
+  @retval other                  This driver does not support this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingSupported (\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingSupported (\r
@@ -34,6 +47,19 @@ Dhcp4DriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to bind driver to\r
+  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
+                                 device to start.\r
+\r
+  @retval EFI_SUCCES             This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED    This driver is already running on ControllerHandle\r
+  @retval other                  This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingStart (\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingStart (\r
@@ -42,6 +68,19 @@ Dhcp4DriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ControllerHandle       Handle of device to stop driver on\r
+  @param  NumberOfChildren       Number of Handles in ChildHandleBuffer. If number\r
+                                 of  children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer      List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCES             This driver is removed ControllerHandle\r
+  @retval other                  This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingStop (\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4DriverBindingStop (\r
@@ -51,6 +90,22 @@ Dhcp4DriverBindingStop (
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
+/**\r
+  Creates a child handle with a set of I/O services.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ChildHandle            Pointer to the handle of the child to create. If\r
+                                 it is NULL, then a new handle is created. If it is\r
+                                 not NULL, then the I/O services are  added to the\r
+                                 existing child handle.\r
+\r
+  @retval EFI_SUCCES             The child handle was created with the I/O\r
+                                 services.\r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources availabe to create\r
+                                 the child.\r
+  @retval other                  The child handle was not created.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4ServiceBindingCreateChild (\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4ServiceBindingCreateChild (\r
@@ -58,6 +113,22 @@ Dhcp4ServiceBindingCreateChild (
   IN EFI_HANDLE                    *ChildHandle\r
   );\r
 \r
   IN EFI_HANDLE                    *ChildHandle\r
   );\r
 \r
+/**\r
+  Destroys a child handle with a set of I/O services.\r
+\r
+  @param  This                   Protocol instance pointer.\r
+  @param  ChildHandle            Handle of the child to destroy.\r
+\r
+  @retval EFI_SUCCES             The I/O services were removed from the child\r
+                                 handle.\r
+  @retval EFI_UNSUPPORTED        The child handle does not support the I/O services\r
+                                  that are being removed.\r
+  @retval EFI_INVALID_PARAMETER  Child handle is not a valid EFI Handle.\r
+  @retval EFI_ACCESS_DENIED      The child handle could not be destroyed because\r
+                                 its  I/O services are being used.\r
+  @retval other                  The child handle was not destroyed.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4ServiceBindingDestroyChild (\r
 EFI_STATUS\r
 EFIAPI\r
 Dhcp4ServiceBindingDestroyChild (\r
index 77f65d5c392b05541e70c400355214cce76b7695..6097f0d3d728e59ac24cd12283a8cf71b5708aac 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -35,7 +35,6 @@ Abstract:
                                  operation parameter.\r
 \r
 **/\r
                                  operation parameter.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4GetModeData (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4GetModeData (\r
@@ -286,7 +285,6 @@ DhcpYieldControl (
   @retval EFI_SUCCESS            The child is configured.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The child is configured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Configure (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Configure (\r
@@ -407,7 +405,6 @@ ON_EXIT:
   @retval EFI_SUCCESS            The DHCP process is started.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The DHCP process is started.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Start (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Start (\r
@@ -497,7 +494,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            The DHCP is renewed/rebound.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The DHCP is renewed/rebound.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4RenewRebind (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4RenewRebind (\r
@@ -597,7 +593,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            The lease is released.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The lease is released.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Release (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Release (\r
@@ -664,7 +659,6 @@ ON_EXIT:
   @retval EFI_SUCCESS            The DHCP process is stopped.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The DHCP process is stopped.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Stop (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Stop (\r
@@ -719,7 +713,6 @@ EfiDhcp4Stop (
   @retval EFI_SUCCESS            The packet is build.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The packet is build.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Build (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Build (\r
@@ -762,7 +755,6 @@ EfiDhcp4Build (
            );\r
 }\r
 \r
            );\r
 }\r
 \r
-STATIC\r
 EFI_STATUS\r
 Dhcp4InstanceConfigUdpIo (\r
   IN UDP_IO_PORT  *UdpIo,\r
 EFI_STATUS\r
 Dhcp4InstanceConfigUdpIo (\r
   IN UDP_IO_PORT  *UdpIo,\r
@@ -801,7 +793,6 @@ Dhcp4InstanceConfigUdpIo (
   return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
 }\r
 \r
   return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
 }\r
 \r
-STATIC\r
 EFI_STATUS\r
 Dhcp4InstanceCreateUdpIo (\r
   IN DHCP_PROTOCOL  *Instance\r
 EFI_STATUS\r
 Dhcp4InstanceCreateUdpIo (\r
   IN DHCP_PROTOCOL  *Instance\r
@@ -820,7 +811,6 @@ Dhcp4InstanceCreateUdpIo (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
-STATIC\r
 VOID\r
 DhcpDummyExtFree (\r
   IN VOID                   *Arg\r
 VOID\r
 DhcpDummyExtFree (\r
   IN VOID                   *Arg\r
@@ -998,7 +988,6 @@ SIGNAL_USER:
   @retval Others                Some other unexpected error occurred.\r
 \r
 **/\r
   @retval Others                Some other unexpected error occurred.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4TransmitReceive (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4TransmitReceive (\r
@@ -1165,7 +1154,6 @@ ON_ERROR:
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS\r
 \r
 **/\r
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 Dhcp4ParseCheckOption (\r
   IN UINT8                  Tag,\r
 EFI_STATUS\r
 Dhcp4ParseCheckOption (\r
   IN UINT8                  Tag,\r
@@ -1207,7 +1195,6 @@ Dhcp4ParseCheckOption (
   @retval EFI_SUCCESS            The options are parsed.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The options are parsed.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Parse (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiDhcp4Parse (\r
index bf401bda0d0cfe66a91a6cff16fc037adfea4f78..16ea4936cf3447ea19cbeabf94d5c1926c8c217a 100644 (file)
@@ -48,10 +48,10 @@ typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
 #include "Dhcp4Option.h"\r
 #include "Dhcp4Io.h"\r
 \r
 #include "Dhcp4Option.h"\r
 #include "Dhcp4Io.h"\r
 \r
-enum {\r
-  DHCP_SERVICE_SIGNATURE  = EFI_SIGNATURE_32 ('D', 'H', 'C', 'P'),\r
-  DHCP_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('d', 'h', 'c', 'p'),\r
+#define DHCP_SERVICE_SIGNATURE   EFI_SIGNATURE_32 ('D', 'H', 'C', 'P')\r
+#define DHCP_PROTOCOL_SIGNATURE  EFI_SIGNATURE_32 ('d', 'h', 'c', 'p')\r
 \r
 \r
+typedef enum {\r
   //\r
   // The state of the DHCP service. It starts as UNCONFIGED. If\r
   // and active child configures the service successfully, it\r
   //\r
   // The state of the DHCP service. It starts as UNCONFIGED. If\r
   // and active child configures the service successfully, it\r
@@ -62,7 +62,7 @@ enum {
   DHCP_UNCONFIGED         = 0,\r
   DHCP_CONFIGED,\r
   DHCP_DESTORY\r
   DHCP_UNCONFIGED         = 0,\r
   DHCP_CONFIGED,\r
   DHCP_DESTORY\r
-};\r
+} DHCP_STATE;\r
 \r
 struct _DHCP_PROTOCOL {\r
   UINT32                            Signature;\r
 \r
 struct _DHCP_PROTOCOL {\r
   UINT32                            Signature;\r
@@ -153,6 +153,16 @@ typedef struct {
 \r
 extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;\r
 \r
 \r
 extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;\r
 \r
+/**\r
+  Give up the control of the DHCP service to let other child\r
+  resume. Don't change the service's DHCP state and the Client\r
+  address and option list configure as required by RFC2131.\r
+\r
+  @param  DhcpSb                 The DHCP service instance.\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 DhcpYieldControl (\r
   IN DHCP_SERVICE         *DhcpSb\r
 VOID\r
 DhcpYieldControl (\r
   IN DHCP_SERVICE         *DhcpSb\r
index 415ffa8ab7838e9d6dd9270878060e7c38f68fca..1f168c6dfff06eb1f87e74ccd718e61bee037b94 100644 (file)
@@ -82,7 +82,6 @@ DhcpInitRequest (
   @retval EFI_ABORTED           The user function ask it to abort.\r
 \r
 **/\r
   @retval EFI_ABORTED           The user function ask it to abort.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpCallUser (\r
   IN  DHCP_SERVICE          *DhcpSb,\r
 EFI_STATUS\r
 DhcpCallUser (\r
   IN  DHCP_SERVICE          *DhcpSb,\r
@@ -250,7 +249,6 @@ DhcpSetState (
   @return None\r
 \r
 **/\r
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpSetTransmitTimer (\r
   IN DHCP_SERVICE           *DhcpSb\r
 VOID\r
 DhcpSetTransmitTimer (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -287,7 +285,6 @@ DhcpSetTransmitTimer (
   @return None\r
 \r
 **/\r
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpComputeLease (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 VOID\r
 DhcpComputeLease (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -396,7 +393,6 @@ DhcpConfigLeaseIoPort (
   @retval EFI_SUCCESS           The lease is recorded.\r
 \r
 **/\r
   @retval EFI_SUCCESS           The lease is recorded.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpLeaseAcquired (\r
   IN DHCP_SERVICE           *DhcpSb\r
 EFI_STATUS\r
 DhcpLeaseAcquired (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -509,7 +505,6 @@ DhcpCleanLease (
   @retval EFI_SUCCESS           One of the offer is selected.\r
 \r
 **/\r
   @retval EFI_SUCCESS           One of the offer is selected.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpChooseOffer (\r
   IN DHCP_SERVICE           *DhcpSb\r
 EFI_STATUS\r
 DhcpChooseOffer (\r
   IN DHCP_SERVICE           *DhcpSb\r
@@ -591,7 +586,6 @@ DhcpChooseOffer (
   @return None\r
 \r
 **/\r
   @return None\r
 \r
 **/\r
-STATIC\r
 VOID\r
 DhcpEndSession (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 VOID\r
 DhcpEndSession (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -623,7 +617,6 @@ DhcpEndSession (
   @retval Others                Some error occured.\r
 \r
 **/\r
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleSelect (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpHandleSelect (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -698,7 +691,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRequest (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpHandleRequest (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -791,7 +783,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleRenewRebind (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpHandleRenewRebind (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -850,7 +841,7 @@ DhcpHandleRenewRebind (
   DhcpSb->LeaseLife = 0;\r
   DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);\r
 \r
   DhcpSb->LeaseLife = 0;\r
   DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);\r
 \r
-  if (DhcpSb->ExtraRefresh) {\r
+  if (DhcpSb->ExtraRefresh != 0) {\r
     DhcpSb->ExtraRefresh  = FALSE;\r
 \r
     DhcpSb->IoStatus      = EFI_SUCCESS;\r
     DhcpSb->ExtraRefresh  = FALSE;\r
 \r
     DhcpSb->IoStatus      = EFI_SUCCESS;\r
@@ -875,7 +866,6 @@ ON_EXIT:
   @retval Others                Some error occured.\r
 \r
 **/\r
   @retval Others                Some error occured.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpHandleReboot (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpHandleReboot (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -1528,7 +1518,7 @@ DhcpOnTimerTick (
       // user, adjust the current state according to the lease life.\r
       // Otherwise do nothing to wait the lease to timeout\r
       //\r
       // user, adjust the current state according to the lease life.\r
       // Otherwise do nothing to wait the lease to timeout\r
       //\r
-      if (DhcpSb->ExtraRefresh) {\r
+      if (DhcpSb->ExtraRefresh != 0) {\r
         Status = EFI_SUCCESS;\r
 \r
         if (DhcpSb->LeaseLife < DhcpSb->T1) {\r
         Status = EFI_SUCCESS;\r
 \r
         if (DhcpSb->LeaseLife < DhcpSb->T1) {\r
@@ -1564,7 +1554,7 @@ DhcpOnTimerTick (
     // Don't timeout the lease, only count the life if user is\r
     // requesting extra renew/rebind. Adjust the state after that.\r
     //\r
     // Don't timeout the lease, only count the life if user is\r
     // requesting extra renew/rebind. Adjust the state after that.\r
     //\r
-    if (DhcpSb->ExtraRefresh) {\r
+    if (DhcpSb->ExtraRefresh != 0) {\r
       return ;\r
     }\r
 \r
       return ;\r
     }\r
 \r
index 1caba3ad9e249f7bdf8c24fa1a7dfc2e71625cfa..c041ba87ed8cd66ba791431c5ea224f58d624c22 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -34,18 +34,21 @@ Abstract:
 #include <Library/MemoryAllocationLib.h>\r
 \r
 \r
 #include <Library/MemoryAllocationLib.h>\r
 \r
 \r
-enum {\r
-  DHCP_WAIT_OFFER         = 3,              // Time to wait the offers\r
-  DHCP_DEFAULT_LEASE      = 7 *24 *60 *60,  // Seven days as default.\r
-  DHCP_SERVER_PORT        = 67,\r
-  DHCP_CLIENT_PORT        = 68,\r
 \r
 \r
+#define DHCP_WAIT_OFFER                 3  // Time to wait the offers\r
+#define DHCP_DEFAULT_LEASE  7 *24 *60 *60  // Seven days as default.\r
+#define DHCP_SERVER_PORT               67\r
+#define DHCP_CLIENT_PORT               68\r
+\r
+typedef enum {\r
   //\r
   // BOOTP header "op" field\r
   //\r
   BOOTP_REQUEST           = 1,\r
   //\r
   // BOOTP header "op" field\r
   //\r
   BOOTP_REQUEST           = 1,\r
-  BOOTP_REPLY             = 2,\r
+  BOOTP_REPLY             = 2\r
+} DHCP_OP_TYPE;\r
 \r
 \r
+typedef enum {\r
   //\r
   // DHCP message types\r
   //\r
   //\r
   // DHCP message types\r
   //\r
@@ -56,21 +59,38 @@ enum {
   DHCP_MSG_ACK            = 5,\r
   DHCP_MSG_NAK            = 6,\r
   DHCP_MSG_RELEASE        = 7,\r
   DHCP_MSG_ACK            = 5,\r
   DHCP_MSG_NAK            = 6,\r
   DHCP_MSG_RELEASE        = 7,\r
-  DHCP_MSG_INFORM         = 8,\r
+  DHCP_MSG_INFORM         = 8\r
+} DHCP_MSG_TYPE;\r
 \r
 \r
+typedef enum {\r
   //\r
   // DHCP notify user type\r
   //\r
   DHCP_NOTIFY_COMPLETION  = 1,\r
   DHCP_NOTIFY_RENEWREBIND,\r
   DHCP_NOTIFY_ALL\r
   //\r
   // DHCP notify user type\r
   //\r
   DHCP_NOTIFY_COMPLETION  = 1,\r
   DHCP_NOTIFY_RENEWREBIND,\r
   DHCP_NOTIFY_ALL\r
-};\r
+} DHCP_NOTIFY_TYPE;\r
 \r
 #define DHCP_IS_BOOTP(Parameter)  (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))\r
 \r
 #define DHCP_CONNECTED(State)     \\r
   (((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))\r
 \r
 \r
 #define DHCP_IS_BOOTP(Parameter)  (((Parameter) == NULL) || ((Parameter)->DhcpType == 0))\r
 \r
 #define DHCP_CONNECTED(State)     \\r
   (((State) == Dhcp4Bound) || ((State) == (Dhcp4Renewing)) || ((State) == Dhcp4Rebinding))\r
 \r
+/**\r
+  Set the DHCP state. If CallUser is true, it will try to notify\r
+  the user before change the state by DhcpNotifyUser. It returns\r
+  EFI_ABORTED if the user return EFI_ABORTED, otherwise, it returns\r
+  EFI_SUCCESS. If CallUser is FALSE, it isn't necessary to test\r
+  the return value of this function.\r
+\r
+  @param  DhcpSb                The DHCP service instance\r
+  @param  State                 The new DHCP state to change to\r
+  @param  CallUser              Whether we need to call user\r
+\r
+  @retval EFI_SUCCESS           The state is changed\r
+  @retval EFI_ABORTED           The user asks to abort the DHCP process.\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpSetState (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpSetState (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -78,6 +98,24 @@ DhcpSetState (
   IN BOOLEAN                CallUser\r
   );\r
 \r
   IN BOOLEAN                CallUser\r
   );\r
 \r
+/**\r
+  Build and transmit a DHCP message according to the current states.\r
+  This function implement the Table 5. of RFC 2131. Always transits\r
+  the state (as defined in Figure 5. of the same RFC) before sending\r
+  a DHCP message. The table is adjusted accordingly.\r
+\r
+  @param  DhcpSb                The DHCP service instance\r
+  @param  Seed                  The seed packet which the new packet is based on\r
+  @param  Para                  The DHCP parameter of the Seed packet\r
+  @param  Type                  The message type to send\r
+  @param  Msg                   The human readable message to include in the packet\r
+                                sent.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resources for the packet\r
+  @retval EFI_ACCESS_DENIED     Failed to transmit the packet through UDP\r
+  @retval EFI_SUCCESS           The message is sent\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpSendMessage (\r
   IN DHCP_SERVICE           *DhcpSb,\r
 EFI_STATUS\r
 DhcpSendMessage (\r
   IN DHCP_SERVICE           *DhcpSb,\r
@@ -87,6 +125,19 @@ DhcpSendMessage (
   IN UINT8                  *Msg\r
   );\r
 \r
   IN UINT8                  *Msg\r
   );\r
 \r
+/**\r
+  Each DHCP service has three timer. Two of them are count down timer.\r
+  One for the packet retransmission. The other is to collect the offers.\r
+  The third timer increaments the lease life which is compared to T1, T2,\r
+  and lease to determine the time to renew and rebind the lease.\r
+  DhcpOnTimerTick will be called once every second.\r
+\r
+  @param  Event                 The timer event\r
+  @param  Context               The context, which is the DHCP service instance.\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 DhcpOnTimerTick (\r
 VOID\r
 EFIAPI\r
 DhcpOnTimerTick (\r
@@ -94,6 +145,18 @@ DhcpOnTimerTick (
   IN VOID                   *Context\r
   );\r
 \r
   IN VOID                   *Context\r
   );\r
 \r
+/**\r
+  Handle the received DHCP packets. This function drivers the DHCP\r
+  state machine.\r
+\r
+  @param  UdpPacket             The UDP packets received.\r
+  @param  Points                The local/remote UDP access points\r
+  @param  IoStatus              The status of the UDP receive\r
+  @param  Context               The opaque parameter to the function.\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 DhcpInput (\r
   NET_BUF                   *UdpPacket,\r
 VOID\r
 DhcpInput (\r
   NET_BUF                   *UdpPacket,\r
@@ -102,16 +165,44 @@ DhcpInput (
   VOID                      *Context\r
   );\r
 \r
   VOID                      *Context\r
   );\r
 \r
+/**\r
+  Send an initial DISCOVER or REQUEST message according to the\r
+  DHCP service's current state.\r
+\r
+  @param  DhcpSb                The DHCP service instance\r
+\r
+  @retval EFI_SUCCESS           The request has been sent\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpInitRequest (\r
   IN DHCP_SERVICE           *DhcpSb\r
   );\r
 \r
 EFI_STATUS\r
 DhcpInitRequest (\r
   IN DHCP_SERVICE           *DhcpSb\r
   );\r
 \r
+/**\r
+  Clean up the DHCP related states, IoStatus isn't reset.\r
+\r
+  @param  DhcpSb                The DHCP instance service.\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 DhcpCleanLease (\r
   IN DHCP_SERVICE           *DhcpSb\r
   );\r
 \r
 VOID\r
 DhcpCleanLease (\r
   IN DHCP_SERVICE           *DhcpSb\r
   );\r
 \r
+/**\r
+  Release the net buffer when packet is sent.\r
+\r
+  @param  UdpPacket             The UDP packets received.\r
+  @param  Points                The local/remote UDP access points\r
+  @param  IoStatus              The status of the UDP receive\r
+  @param  Context               The opaque parameter to the function.\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 DhcpOnPacketSent (\r
   NET_BUF                   *Packet,\r
 VOID\r
 DhcpOnPacketSent (\r
   NET_BUF                   *Packet,\r
index 04a40074e3cd060e8ca920d9a81418c48590ca0f..b2d2505bd54b7caa2b5bdf39215956256733b0b9 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -27,9 +27,7 @@ Abstract:
 // to validate a dhcp message. Refere the comments of the\r
 // DHCP_OPTION_FORMAT structure.\r
 //\r
 // to validate a dhcp message. Refere the comments of the\r
 // DHCP_OPTION_FORMAT structure.\r
 //\r
-STATIC\r
-DHCP_OPTION_FORMAT\r
-DhcpOptionFormats [] = {\r
+STATIC 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
   {DHCP_TAG_ROUTER,         DHCP_OPTION_IP,     1, -1 , TRUE},\r
   {DHCP_TAG_NETMASK,        DHCP_OPTION_IP,     1, 1  , TRUE},\r
   {DHCP_TAG_TIME_OFFSET,    DHCP_OPTION_INT32,  1, 1  , FALSE},\r
   {DHCP_TAG_ROUTER,         DHCP_OPTION_IP,     1, -1 , TRUE},\r
@@ -127,7 +125,6 @@ DhcpOptionFormats [] = {
   @return The point to the option's format, NULL if not found.\r
 \r
 **/\r
   @return The point to the option's format, NULL if not found.\r
 \r
 **/\r
-STATIC\r
 DHCP_OPTION_FORMAT *\r
 DhcpFindOptionFormat (\r
   IN UINT8                  Tag\r
 DHCP_OPTION_FORMAT *\r
 DhcpFindOptionFormat (\r
   IN UINT8                  Tag\r
@@ -168,7 +165,6 @@ DhcpFindOptionFormat (
   @return TRUE is the option is valid, otherwise FALSE.\r
 \r
 **/\r
   @return TRUE is the option is valid, otherwise FALSE.\r
 \r
 **/\r
-STATIC\r
 BOOLEAN\r
 DhcpOptionIsValid (\r
   IN DHCP_OPTION_FORMAT     *Format,\r
 BOOLEAN\r
 DhcpOptionIsValid (\r
   IN DHCP_OPTION_FORMAT     *Format,\r
@@ -249,7 +245,6 @@ DhcpOptionIsValid (
   @retval EFI_INVALID_PARAMETER  The DHCP option is mal-formated\r
 \r
 **/\r
   @retval EFI_INVALID_PARAMETER  The DHCP option is mal-formated\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpGetParameter (\r
   IN UINT8                  Tag,\r
 EFI_STATUS\r
 DhcpGetParameter (\r
   IN UINT8                  Tag,\r
@@ -323,7 +318,6 @@ DhcpGetParameter (
   @retval EFI_INVALID_PARAMETER  The options are mal-formated.\r
 \r
 **/\r
   @retval EFI_INVALID_PARAMETER  The options are mal-formated.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpIterateBufferOptions (\r
   IN  UINT8                 *Buffer,\r
 EFI_STATUS\r
 DhcpIterateBufferOptions (\r
   IN  UINT8                 *Buffer,\r
@@ -468,7 +462,6 @@ DhcpIterateOptions (
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS.\r
 \r
 **/\r
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpGetOptionLen (\r
   IN UINT8                  Tag,\r
 EFI_STATUS\r
 DhcpGetOptionLen (\r
   IN UINT8                  Tag,\r
@@ -499,7 +492,6 @@ DhcpGetOptionLen (
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS\r
 \r
 **/\r
   @retval EFI_SUCCESS            It always returns EFI_SUCCESS\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 DhcpFillOption (\r
   IN UINT8                  Tag,\r
 EFI_STATUS\r
 DhcpFillOption (\r
   IN UINT8                  Tag,\r
index 9db2e0a721167d4faae3a22735b1e57bb82e3279..d3c596c9793944e861ec1bd2a5a127d71642a117 100644 (file)
@@ -27,7 +27,7 @@ Abstract:
 //\r
 // DHCP option tags (types)\r
 //\r
 //\r
 // DHCP option tags (types)\r
 //\r
-enum {\r
+typedef enum {\r
   //\r
   // RFC1497 vendor extensions\r
   //\r
   //\r
   // RFC1497 vendor extensions\r
   //\r
@@ -132,12 +132,12 @@ enum {
   DHCP_TAG_T2              = 59,         // Rebinding (T2) Time Value\r
   DHCP_TAG_VENDOR_CLASS    = 60,         // Vendor class identifier\r
   DHCP_TAG_CLIENT_ID       = 61          // Client-identifier\r
   DHCP_TAG_T2              = 59,         // Rebinding (T2) Time Value\r
   DHCP_TAG_VENDOR_CLASS    = 60,         // Vendor class identifier\r
   DHCP_TAG_CLIENT_ID       = 61          // Client-identifier\r
-};\r
+} DHCP_TAGS;\r
 \r
 \r
-enum {\r
-  DHCP_OPTION_MAGIC        = 0x63538263, // Network byte order\r
-  DHCP_MAX_OPTIONS         = 256,\r
+#define DHCP_OPTION_MAGIC      0x63538263 // Network byte order\r
+#define DHCP_MAX_OPTIONS              256\r
 \r
 \r
+typedef enum {\r
   //\r
   // DHCP option types, this is used to validate the DHCP options.\r
   //\r
   //\r
   // DHCP option types, this is used to validate the DHCP options.\r
   //\r
@@ -146,15 +146,17 @@ enum {
   DHCP_OPTION_INT16,\r
   DHCP_OPTION_INT32,\r
   DHCP_OPTION_IP,\r
   DHCP_OPTION_INT16,\r
   DHCP_OPTION_INT32,\r
   DHCP_OPTION_IP,\r
-  DHCP_OPTION_IPPAIR,\r
+  DHCP_OPTION_IPPAIR\r
+} DHCP_OPTION_TYPE; \r
 \r
 \r
+typedef enum {\r
   //\r
   // Value of DHCP overload option\r
   //\r
   DHCP_OVERLOAD_FILENAME   = 1,\r
   DHCP_OVERLOAD_SVRNAME    = 2,\r
   DHCP_OVERLOAD_BOTH       = 3\r
   //\r
   // Value of DHCP overload option\r
   //\r
   DHCP_OVERLOAD_FILENAME   = 1,\r
   DHCP_OVERLOAD_SVRNAME    = 2,\r
   DHCP_OVERLOAD_BOTH       = 3\r
-};\r
+} DHCP_OVERLOAD_TYPE;\r
 \r
 //\r
 // The DHCP option structure. This structure extends the EFI_DHCP_OPTION\r
 \r
 //\r
 // The DHCP option structure. This structure extends the EFI_DHCP_OPTION\r
@@ -225,6 +227,21 @@ EFI_STATUS
   IN VOID                   *Context\r
   );\r
 \r
   IN VOID                   *Context\r
   );\r
 \r
+/**\r
+  Iterate through a DHCP message to visit each option. First inspect\r
+  all the options in the OPTION field. Then if overloaded, inspect\r
+  the options in FILENAME and SERVERNAME fields. One option may be\r
+  encoded in several places. See RFC 3396 Encoding Long Options in DHCP\r
+\r
+  @param  Packet                 The DHCP packet to check the options for\r
+  @param  Check                  The callback function to be called for each option\r
+                                 found\r
+  @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
+\r
+**/\r
 EFI_STATUS\r
 DhcpIterateOptions (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
 EFI_STATUS\r
 DhcpIterateOptions (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
@@ -232,12 +249,51 @@ DhcpIterateOptions (
   IN  VOID                  *Context\r
   );\r
 \r
   IN  VOID                  *Context\r
   );\r
 \r
+/**\r
+  Validate the packet's options. If necessary, allocate\r
+  and fill in the interested parameters.\r
+\r
+  @param  Packet                 The packet to validate the options\r
+  @param  Para                   The variable to save the DHCP parameters.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory to validate the packet.\r
+  @retval EFI_INVALID_PARAMETER  The options are mal-formated\r
+  @retval EFI_SUCCESS            The options are parsed into OptionPoint\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpValidateOptions (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
   OUT DHCP_PARAMETER        **Para          OPTIONAL\r
   );\r
 \r
 EFI_STATUS\r
 DhcpValidateOptions (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
   OUT DHCP_PARAMETER        **Para          OPTIONAL\r
   );\r
 \r
+/**\r
+  Parse the options of a DHCP packet. It supports RFC 3396: Encoding\r
+  Long Options in DHCP. That is, it will combine all the option value\r
+  of all the occurances of each option.\r
+  A little bit of implemenation:\r
+  It adopts the "Key indexed counting" algorithm. First, it allocates\r
+  an array of 256 DHCP_OPTION_COUNTs because DHCP option tag is encoded\r
+  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
+  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
+  buffer.\r
+\r
+  @param  Packet                 The DHCP packet to parse the options\r
+  @param  Count                  The number of valid dhcp options present in the\r
+                                 packet\r
+  @param  OptionPoint            The array that contains the DHCP options. Caller\r
+                                 should free it.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory to parse the packet.\r
+  @retval EFI_INVALID_PARAMETER  The options are mal-formated\r
+  @retval EFI_SUCCESS            The options are parsed into OptionPoint\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpParseOption (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
 EFI_STATUS\r
 DhcpParseOption (\r
   IN  EFI_DHCP4_PACKET      *Packet,\r
@@ -245,6 +301,18 @@ DhcpParseOption (
   OUT DHCP_OPTION           **OptionPoint\r
   );\r
 \r
   OUT DHCP_OPTION           **OptionPoint\r
   );\r
 \r
+/**\r
+  Append an option to the memory, if the option is longer than\r
+  255 bytes, splits it into several options.\r
+\r
+  @param  Buf                    The buffer to append the option to\r
+  @param  Tag                    The option's tag\r
+  @param  DataLen                The length of the option's data\r
+  @param  Data                   The option's data\r
+\r
+  @return The position to append the next option\r
+\r
+**/\r
 UINT8 *\r
 DhcpAppendOption (\r
   IN UINT8                  *Buf,\r
 UINT8 *\r
 DhcpAppendOption (\r
   IN UINT8                  *Buf,\r
@@ -253,6 +321,22 @@ DhcpAppendOption (
   IN UINT8                  *Data\r
   );\r
 \r
   IN UINT8                  *Data\r
   );\r
 \r
+/**\r
+  Build a new DHCP packet from a seed packet. Options may be deleted or\r
+  appended. The caller should free the NewPacket when finished using it.\r
+\r
+  @param  SeedPacket             The seed packet to start with\r
+  @param  DeleteCount            The number of options to delete\r
+  @param  DeleteList             The options to delete from the packet\r
+  @param  AppendCount            The number of options to append\r
+  @param  AppendList             The options to append to the packet\r
+  @param  NewPacket              The new packet, allocated and built by this\r
+                                 function.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory\r
+  @retval EFI_SUCCESS            The packet is build.\r
+\r
+**/\r
 EFI_STATUS\r
 DhcpBuild (\r
   IN  EFI_DHCP4_PACKET         *SeedPacket,\r
 EFI_STATUS\r
 DhcpBuild (\r
   IN  EFI_DHCP4_PACKET         *SeedPacket,\r
index b6a82612cc21870af3e7211cde2373edf5341528..d75edcdb73111ed4234e6187a96d188f64166300 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2008, Intel Corporation\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
 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
@@ -299,29 +299,23 @@ DpcDispatchDpc (
   return ReturnStatus;\r
 }\r
 \r
   return ReturnStatus;\r
 }\r
 \r
+/**\r
+  The entry point for DPC driver which installs the EFI_DPC_PROTOCOL onto a new handle.\r
+\r
+  @param  ImageHandle            The image handle of the driver.\r
+  @param  SystemTable            The system table.\r
+\r
+  @retval EFI_SUCCES             The DPC queues were initialized and the EFI_DPC_PROTOCOL was\r
+                                 installed onto a new handle.\r
+  @retval Others                 Failed to install EFI_DPC_PROTOCOL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 DpcDriverEntryPoint (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 EFI_STATUS\r
 EFIAPI\r
 DpcDriverEntryPoint (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The entry point for DPC driver which installs the EFI_DPC_PROTOCOL onto a new handle.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The image handle of the driver.\r
-  SystemTable - The system table.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - The DPC queues were initialized and the EFI_DPC_PROTOCOL was\r
-                installed onto a new handle.\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       Index;\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       Index;\r
index be006a8eb7b009ce940989f3dad7cefa5aaeb0aa..736299bec026fa1ff9caa1410ce14c31080aab5e 100644 (file)
@@ -24,6 +24,16 @@ Abstract:
 \r
 IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];\r
 \r
 \r
 IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];\r
 \r
+/**\r
+  Callback function when DHCP process finished. It will save the\r
+  retrieved IP configure parameter from DHCP to the NVRam.\r
+\r
+  @param  Event                  The callback event\r
+  @param  Context                Opaque context to the callback\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 Ip4ConfigOnDhcp4Complete (\r
 VOID\r
 EFIAPI\r
 Ip4ConfigOnDhcp4Complete (\r
@@ -44,7 +54,6 @@ Ip4ConfigOnDhcp4Complete (
   @retval EFI_SUCCESS            The name or address of the NIC are returned.\r
 \r
 **/\r
   @retval EFI_SUCCESS            The name or address of the NIC are returned.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 EfiNicIp4ConfigGetName (\r
 EFI_STATUS\r
 EFIAPI\r
 EfiNicIp4ConfigGetName (\r
@@ -733,7 +742,7 @@ Ip4ConfigCleanDhcp4 (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Clean up all the configuration parameters\r
+  Clean up all the configuration parameters.\r
 \r
   @param  Instance               The IP4 configure instance\r
 \r
 \r
   @param  Instance               The IP4 configure instance\r
 \r
index 4400c8e06ea8903952c4c8881323db46aaa07756..46e9f890d58bfc07f65729cbb4db5f8981736483 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -42,18 +42,20 @@ Abstract:
 \r
 typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\r
 \r
 \r
 typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\r
 \r
-enum {\r
+typedef enum {\r
   IP4_CONFIG_STATE_IDLE         = 0,\r
   IP4_CONFIG_STATE_STARTED,\r
   IP4_CONFIG_STATE_IDLE         = 0,\r
   IP4_CONFIG_STATE_STARTED,\r
-  IP4_CONFIG_STATE_CONFIGURED,\r
+  IP4_CONFIG_STATE_CONFIGURED\r
+} IP4_CONFIG_STATE;\r
 \r
 \r
-  IP4_PROTO_ICMP                = 0x01,\r
-  IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),\r
+#define IP4_PROTO_ICMP                 0x01\r
+#define IP4_CONFIG_INSTANCE_SIGNATURE  EFI_SIGNATURE_32 ('I', 'P', '4', 'C')\r
 \r
 \r
+typedef enum {\r
   DHCP_TAG_PARA_LIST            = 55,\r
   DHCP_TAG_NETMASK              = 1,\r
   DHCP_TAG_ROUTER               = 3\r
   DHCP_TAG_PARA_LIST            = 55,\r
   DHCP_TAG_NETMASK              = 1,\r
   DHCP_TAG_ROUTER               = 3\r
-};\r
+} DHCP_TAGS;\r
 \r
 //\r
 // Configure the DHCP to request the routers and netmask\r
 \r
 //\r
 // Configure the DHCP to request the routers and netmask\r
@@ -121,11 +123,27 @@ extern IP4_CONFIG_INSTANCE           *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIAB
 extern EFI_IP4_CONFIG_PROTOCOL       mIp4ConfigProtocolTemplate;\r
 extern EFI_NIC_IP4_CONFIG_PROTOCOL   mNicIp4ConfigProtocolTemplate;\r
 \r
 extern EFI_IP4_CONFIG_PROTOCOL       mIp4ConfigProtocolTemplate;\r
 extern EFI_NIC_IP4_CONFIG_PROTOCOL   mNicIp4ConfigProtocolTemplate;\r
 \r
+/**\r
+  Release all the DHCP related resources.\r
+\r
+  @param  This                   The IP4 configure instance\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 Ip4ConfigCleanDhcp4 (\r
   IN IP4_CONFIG_INSTANCE        *This\r
   );\r
 \r
 VOID\r
 Ip4ConfigCleanDhcp4 (\r
   IN IP4_CONFIG_INSTANCE        *This\r
   );\r
 \r
+/**\r
+  Clean up all the configuration parameters.\r
+\r
+  @param  Instance               The IP4 configure instance\r
+\r
+  @return None\r
+\r
+**/\r
 VOID\r
 Ip4ConfigCleanConfig (\r
   IN IP4_CONFIG_INSTANCE        *Instance\r
 VOID\r
 Ip4ConfigCleanConfig (\r
   IN IP4_CONFIG_INSTANCE        *Instance\r
index 7f0149fa009bf0efcba0fd84fc3aa48a1db4c29d..34dc96f0cae965c1c7b0812bce5108ac4852aeb1 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation\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
 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
@@ -60,30 +60,22 @@ EfiIp4ConfigUnload (
   return NetLibDefaultUnload (ImageHandle);\r
 }\r
 \r
   return NetLibDefaultUnload (ImageHandle);\r
 }\r
 \r
+/**\r
+  The entry point for IP4 config driver which install the driver\r
+  binding and component name protocol on its image.\r
+\r
+  @param  ImageHandle            The image handle of the driver.\r
+  @param  SystemTable            The system table.\r
 \r
 \r
+  @retval EFI_SUCCES             All the related protocols are installed on the driver.\r
+  @retval Others                 Failed to install protocols.\r
+\r
+**/\r
 EFI_STATUS\r
 Ip4ConfigDriverEntryPoint (\r
   IN EFI_HANDLE             ImageHandle,\r
   IN EFI_SYSTEM_TABLE       *SystemTable\r
   )\r
 EFI_STATUS\r
 Ip4ConfigDriverEntryPoint (\r
   IN EFI_HANDLE             ImageHandle,\r
   IN EFI_SYSTEM_TABLE       *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The entry point for IP4 config driver which install the driver\r
-  binding and component name protocol on its image.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The Image handle of the driver\r
-  SystemTable - The system table\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - All the related protocols are installed on the driver\r
-  Others      - Failed to install the protocol\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
index 65c2f840aa644b3534f70d656233494dcd251f8f..72c3a72e2f4b3890b80e55369db8e74e51616b2f 100644 (file)
@@ -91,7 +91,7 @@ Ip4ConfigIsValid (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Read the ip4 configure variable from the EFI variable\r
+  Read the ip4 configure variable from the EFI variable.\r
 \r
   None\r
 \r
 \r
   None\r
 \r
@@ -186,7 +186,7 @@ ON_ERROR:
 **/\r
 EFI_STATUS\r
 Ip4ConfigWriteVariable (\r
 **/\r
 EFI_STATUS\r
 Ip4ConfigWriteVariable (\r
-  IN IP4_CONFIG_VARIABLE    * Config        OPTIONAL\r
+  IN IP4_CONFIG_VARIABLE    *Config        OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                Status;\r
   )\r
 {\r
   EFI_STATUS                Status;\r
index 953f6edf960963dc5cc8fe2058d413b61f571104..4b146274234e857881140f0bd5c2eb992ed70d2e 100644 (file)
@@ -45,27 +45,81 @@ Abstract:
   (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \\r
    NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))\r
 \r
   (((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \\r
    NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))\r
 \r
+/**\r
+  Check whether the configure parameter is valid.\r
+\r
+  @param  NicConfig    The configure parameter to check\r
+\r
+  @return TRUE if the parameter is valid for the interface, otherwise FALSE.\r
+\r
+**/\r
 BOOLEAN\r
 Ip4ConfigIsValid (\r
   IN NIC_IP4_CONFIG_INFO    *NicConfig\r
   );\r
 \r
 BOOLEAN\r
 Ip4ConfigIsValid (\r
   IN NIC_IP4_CONFIG_INFO    *NicConfig\r
   );\r
 \r
+/**\r
+  Read the ip4 configure variable from the EFI variable.\r
+\r
+  None\r
+\r
+  @return The IP4 configure read if it is there and is valid, otherwise NULL\r
+\r
+**/\r
 IP4_CONFIG_VARIABLE *\r
 Ip4ConfigReadVariable (\r
   VOID\r
   );\r
 \r
 IP4_CONFIG_VARIABLE *\r
 Ip4ConfigReadVariable (\r
   VOID\r
   );\r
 \r
+/**\r
+  Write the IP4 configure variable to the NVRAM. If Config\r
+  is NULL, remove the variable.\r
+\r
+  @param  Config       The IP4 configure data to write\r
+\r
+  @retval EFI_SUCCESS  The variable is written to the NVRam\r
+  @retval Others       Failed to write the variable.\r
+\r
+**/\r
 EFI_STATUS\r
 Ip4ConfigWriteVariable (\r
   IN IP4_CONFIG_VARIABLE    *Config       OPTIONAL\r
   );\r
 \r
 EFI_STATUS\r
 Ip4ConfigWriteVariable (\r
   IN IP4_CONFIG_VARIABLE    *Config       OPTIONAL\r
   );\r
 \r
+/**\r
+  Locate the IP4 configure parameters from the variable.If a\r
+  configuration is found, copy it to a newly allocated block\r
+  of memory to avoid the alignment problem. Caller should\r
+  release the memory after use.\r
+\r
+  @param  Variable     The IP4 configure variable to search in\r
+  @param  NicAddr      The interface address to check\r
+\r
+  @return The point to the NIC's IP4 configure info if it is found\r
+  @return in the IP4 variable, otherwise NULL.\r
+\r
+**/\r
 NIC_IP4_CONFIG_INFO *\r
 Ip4ConfigFindNicVariable (\r
   IN IP4_CONFIG_VARIABLE    *Variable,\r
   IN NIC_ADDR               *NicAddr\r
   );\r
 \r
 NIC_IP4_CONFIG_INFO *\r
 Ip4ConfigFindNicVariable (\r
   IN IP4_CONFIG_VARIABLE    *Variable,\r
   IN NIC_ADDR               *NicAddr\r
   );\r
 \r
+/**\r
+  Modify the configuration parameter for the NIC in the variable.\r
+  If Config is NULL, old configuration will be remove from the new\r
+  variable. Otherwise, append it or replace the old one.\r
+\r
+  @param  Variable     The IP4 variable to change\r
+  @param  NicAddr      The interface to search\r
+  @param  Config       The new configuration parameter (NULL to remove the old)\r
+\r
+  @return The new IP4_CONFIG_VARIABLE variable if the new variable has at\r
+  @return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.\r
+  @return Return NULL either because failed to locate memory for new variable\r
+  @return or the only NIC configure is removed from the Variable.\r
+\r
+**/\r
 IP4_CONFIG_VARIABLE *\r
 Ip4ConfigModifyVariable (\r
   IN IP4_CONFIG_VARIABLE    *Variable,    OPTIONAL\r
 IP4_CONFIG_VARIABLE *\r
 Ip4ConfigModifyVariable (\r
   IN IP4_CONFIG_VARIABLE    *Variable,    OPTIONAL\r