summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4ConfigDxe
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 07:20:33 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-30 07:20:33 +0000
commit7bce0c5a0eb806a55d7231b05769d0efc71cdc59 (patch)
tree77078ca79b96fb4f426e501beca674c627c30247 /MdeModulePkg/Universal/Network/Ip4ConfigDxe
parent4611e327f49b245d7efcefbbff2070ab9ed0fc8b (diff)
downloadedk2-7bce0c5a0eb806a55d7231b05769d0efc71cdc59.zip
edk2-7bce0c5a0eb806a55d7231b05769d0efc71cdc59.tar.gz
edk2-7bce0c5a0eb806a55d7231b05769d0efc71cdc59.tar.bz2
Clean codes per ECC.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5384 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4ConfigDxe')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c13
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h30
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c30
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c4
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h54
5 files changed, 102 insertions, 29 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
index be006a8..736299b 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
@@ -24,6 +24,16 @@ Abstract:
IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
+/**
+ Callback function when DHCP process finished. It will save the
+ retrieved IP configure parameter from DHCP to the NVRam.
+
+ @param Event The callback event
+ @param Context Opaque context to the callback
+
+ @return None
+
+**/
VOID
EFIAPI
Ip4ConfigOnDhcp4Complete (
@@ -44,7 +54,6 @@ Ip4ConfigOnDhcp4Complete (
@retval EFI_SUCCESS The name or address of the NIC are returned.
**/
-STATIC
EFI_STATUS
EFIAPI
EfiNicIp4ConfigGetName (
@@ -733,7 +742,7 @@ Ip4ConfigCleanDhcp4 (
/**
- Clean up all the configuration parameters
+ Clean up all the configuration parameters.
@param Instance The IP4 configure instance
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
index 4400c8e..46e9f89 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -42,18 +42,20 @@ Abstract:
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
-enum {
+typedef enum {
IP4_CONFIG_STATE_IDLE = 0,
IP4_CONFIG_STATE_STARTED,
- IP4_CONFIG_STATE_CONFIGURED,
+ IP4_CONFIG_STATE_CONFIGURED
+} IP4_CONFIG_STATE;
- IP4_PROTO_ICMP = 0x01,
- IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
+#define IP4_PROTO_ICMP 0x01
+#define IP4_CONFIG_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('I', 'P', '4', 'C')
+typedef enum {
DHCP_TAG_PARA_LIST = 55,
DHCP_TAG_NETMASK = 1,
DHCP_TAG_ROUTER = 3
-};
+} DHCP_TAGS;
//
// Configure the DHCP to request the routers and netmask
@@ -121,11 +123,27 @@ extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIAB
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
+/**
+ Release all the DHCP related resources.
+
+ @param This The IP4 configure instance
+
+ @return None
+
+**/
VOID
Ip4ConfigCleanDhcp4 (
IN IP4_CONFIG_INSTANCE *This
);
+/**
+ Clean up all the configuration parameters.
+
+ @param Instance The IP4 configure instance
+
+ @return None
+
+**/
VOID
Ip4ConfigCleanConfig (
IN IP4_CONFIG_INSTANCE *Instance
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
index 7f0149f..34dc96f 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -60,30 +60,22 @@ EfiIp4ConfigUnload (
return NetLibDefaultUnload (ImageHandle);
}
+/**
+ The entry point for IP4 config driver which install the driver
+ binding and component name protocol on its image.
+
+ @param ImageHandle The image handle of the driver.
+ @param SystemTable The system table.
+ @retval EFI_SUCCES All the related protocols are installed on the driver.
+ @retval Others Failed to install protocols.
+
+**/
EFI_STATUS
Ip4ConfigDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-/*++
-
-Routine Description:
-
- The entry point for IP4 config driver which install the driver
- binding and component name protocol on its image.
-
-Arguments:
-
- ImageHandle - The Image handle of the driver
- SystemTable - The system table
-
-Returns:
-
- EFI_SUCCESS - All the related protocols are installed on the driver
- Others - Failed to install the protocol
-
---*/
{
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
index 65c2f84..72c3a72 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
@@ -91,7 +91,7 @@ Ip4ConfigIsValid (
/**
- Read the ip4 configure variable from the EFI variable
+ Read the ip4 configure variable from the EFI variable.
None
@@ -186,7 +186,7 @@ ON_ERROR:
**/
EFI_STATUS
Ip4ConfigWriteVariable (
- IN IP4_CONFIG_VARIABLE * Config OPTIONAL
+ IN IP4_CONFIG_VARIABLE *Config OPTIONAL
)
{
EFI_STATUS Status;
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
index 953f6ed..4b14627 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.h
@@ -45,27 +45,81 @@ Abstract:
(((Nic1)->Type == (Nic2)->Type) && ((Nic1)->Len == (Nic2)->Len) && \
NET_MAC_EQUAL (&(Nic1)->MacAddr, &(Nic2)->MacAddr, (Nic1)->Len))
+/**
+ Check whether the configure parameter is valid.
+
+ @param NicConfig The configure parameter to check
+
+ @return TRUE if the parameter is valid for the interface, otherwise FALSE.
+
+**/
BOOLEAN
Ip4ConfigIsValid (
IN NIC_IP4_CONFIG_INFO *NicConfig
);
+/**
+ Read the ip4 configure variable from the EFI variable.
+
+ None
+
+ @return The IP4 configure read if it is there and is valid, otherwise NULL
+
+**/
IP4_CONFIG_VARIABLE *
Ip4ConfigReadVariable (
VOID
);
+/**
+ Write the IP4 configure variable to the NVRAM. If Config
+ is NULL, remove the variable.
+
+ @param Config The IP4 configure data to write
+
+ @retval EFI_SUCCESS The variable is written to the NVRam
+ @retval Others Failed to write the variable.
+
+**/
EFI_STATUS
Ip4ConfigWriteVariable (
IN IP4_CONFIG_VARIABLE *Config OPTIONAL
);
+/**
+ Locate the IP4 configure parameters from the variable.If a
+ configuration is found, copy it to a newly allocated block
+ of memory to avoid the alignment problem. Caller should
+ release the memory after use.
+
+ @param Variable The IP4 configure variable to search in
+ @param NicAddr The interface address to check
+
+ @return The point to the NIC's IP4 configure info if it is found
+ @return in the IP4 variable, otherwise NULL.
+
+**/
NIC_IP4_CONFIG_INFO *
Ip4ConfigFindNicVariable (
IN IP4_CONFIG_VARIABLE *Variable,
IN NIC_ADDR *NicAddr
);
+/**
+ Modify the configuration parameter for the NIC in the variable.
+ If Config is NULL, old configuration will be remove from the new
+ variable. Otherwise, append it or replace the old one.
+
+ @param Variable The IP4 variable to change
+ @param NicAddr The interface to search
+ @param Config The new configuration parameter (NULL to remove the old)
+
+ @return The new IP4_CONFIG_VARIABLE variable if the new variable has at
+ @return least one NIC configure and no EFI_OUT_OF_RESOURCES failure.
+ @return Return NULL either because failed to locate memory for new variable
+ @return or the only NIC configure is removed from the Variable.
+
+**/
IP4_CONFIG_VARIABLE *
Ip4ConfigModifyVariable (
IN IP4_CONFIG_VARIABLE *Variable, OPTIONAL