-/*++\r
+/** @file\r
+ iSCSI DHCP related configuration routines.\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2007, 2009, Intel Corporation.<BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- IScsiDhcp.c\r
+**/\r
\r
-Abstract:\r
-\r
- iSCSI DHCP related configuration routines.\r
+#include "IScsiImpl.h"\r
\r
---*/\r
+/**\r
+ Extract the Root Path option and get the required target information.\r
\r
-#include "IScsiImpl.h"\r
+ @param[in] RootPath The RootPath.\r
+ @param[in] Length Length of the RootPath option payload.\r
+ @param[in, out] ConfigNvData The iSCSI session configuration data read from nonvolatile device.\r
\r
-STATIC\r
+ @retval EFI_SUCCESS All required information is extracted from the RootPath option.\r
+ @retval EFI_NOT_FOUND The RootPath is not an iSCSI RootPath.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval EFI_INVALID_PARAMETER The RootPath is mal-formatted.\r
+**/\r
EFI_STATUS\r
IScsiDhcpExtractRootPath (\r
- IN CHAR8 *RootPath,\r
- IN UINT8 Length,\r
- IN ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData\r
+ IN CHAR8 *RootPath,\r
+ IN UINT8 Length,\r
+ IN OUT ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extract the Root Path option and get the required target information.\r
- \r
-Arguments:\r
-\r
- RootPath - The RootPath.\r
- Length - Length of the RootPath option payload.\r
- ConfigNvData - The iSCSI session configuration data read from nonvolatile device.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - All required information is extracted from the RootPath option.\r
- EFI_NOT_FOUND - The RootPath is not an iSCSI RootPath.\r
- EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
- EFI_INVALID_PARAMETER - The RootPath is mal-formatted.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT8 IScsiRootPathIdLen;\r
CHAR8 *TmpStr;\r
ISCSI_ROOT_PATH_FIELD Fields[RP_FIELD_IDX_MAX];\r
ISCSI_ROOT_PATH_FIELD *Field;\r
- UINT32 FieldIndex;\r
+ RP_FIELD_IDX FieldIndex;\r
UINT8 Index;\r
\r
//\r
TmpStr[Length] = '\0';\r
\r
Index = 0;\r
- FieldIndex = 0;\r
+ FieldIndex = RP_FIELD_IDX_SERVERNAME;\r
ZeroMem (&Fields[0], sizeof (Fields));\r
\r
//\r
// Extract the fields in the Root Path option string.\r
//\r
- for (FieldIndex = 0; (FieldIndex < RP_FIELD_IDX_MAX) && (Index < Length); FieldIndex++) {\r
+ for (FieldIndex = RP_FIELD_IDX_SERVERNAME; (FieldIndex < RP_FIELD_IDX_MAX) && (Index < Length); FieldIndex++) {\r
if (TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) {\r
Fields[FieldIndex].Str = &TmpStr[Index];\r
}\r
Status = EFI_INVALID_PARAMETER;\r
goto ON_EXIT;\r
}\r
-\r
- if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||\r
+ \r
+ if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||\r
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||\r
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)\r
) {\r
return Status;\r
}\r
\r
-STATIC\r
+/**\r
+ The callback function registerd to the DHCP4 instance which is used to select\r
+ the qualified DHCP OFFER.\r
+ \r
+ @param[in] This The DHCP4 protocol.\r
+ @param[in] Context The context set when configuring the DHCP4 protocol.\r
+ @param[in] CurrentState The current state of the DHCP4 protocol.\r
+ @param[in] Dhcp4Event The event occurs in the current state.\r
+ @param[in] Packet The DHCP packet that is to be sent or already received. \r
+ @param[out] NewPacket The packet used to replace the above Packet.\r
+ \r
+ @retval EFI_SUCCESS Either the DHCP OFFER is qualified or we're not intereseted\r
+ in the Dhcp4Event.\r
+ @retval EFI_NOT_READY The DHCP OFFER packet doesn't match our requirements.\r
+ @retval Others Other errors as indicated.\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
IScsiDhcpSelectOffer (\r
IN EFI_DHCP4_PROTOCOL * This,\r
IN VOID *Context,\r
IN EFI_DHCP4_PACKET * Packet, OPTIONAL\r
OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- The callback function registerd to the DHCP4 instance which is used to select\r
- the qualified DHCP OFFER.\r
- \r
-Arguments:\r
-\r
- This - The DHCP4 protocol.\r
- Context - The context set when configuring the DHCP4 protocol.\r
- CurrentState - The current state of the DHCP4 protocol.\r
- Dhcp4Event - The event occurs in the current state.\r
- Packet - The DHCP packet that is to be sent or already received.\r
- NewPackt - The packet used to replace the above Packet.\r
-\r
-Returns:\r
-\r
- EFI_NOT_READY - The DHCP OFFER packet doesn't match our requirements.\r
- EFI_SUCCESS - Either the DHCP OFFER is qualified or we're not intereseted\r
- in the Dhcp4Event.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT32 OptionCount;\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-IScsiParseDhcpAck (\r
- IN EFI_DHCP4_PROTOCOL *Dhcp4,\r
- IN ISCSI_SESSION_CONFIG_DATA *ConfigData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
Parse the DHCP ACK to get the address configuration and DNS information.\r
- \r
-Arguments:\r
\r
- Dhcp4 - The DHCP4 protocol.\r
- ConfigData - The session configuration data.\r
+ @param[in] Dhcp4 The DHCP4 protocol.\r
+ @param[in, out] ConfigData The session configuration data.\r
\r
-Returns:\r
-\r
- EFI_SUCCESS - The DNS information is got from the DHCP ACK.\r
- EFI_NO_MAPPING - DHCP failed to acquire address and other information.\r
- EFI_INVALID_PARAMETER - The DHCP ACK's DNS option is mal-formatted.\r
- EFI_DEVICE_ERROR - Some unexpected error happened.\r
-\r
---*/\r
+ @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
+ @retval EFI_NO_MAPPING DHCP failed to acquire address and other information.\r
+ @retval EFI_INVALID_PARAMETER The DHCP ACK's DNS option is mal-formatted.\r
+ @retval EFI_DEVICE_ERROR Other errors as indicated.\r
+**/\r
+EFI_STATUS\r
+IScsiParseDhcpAck (\r
+ IN EFI_DHCP4_PROTOCOL *Dhcp4,\r
+ IN OUT ISCSI_SESSION_CONFIG_DATA *ConfigData\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_DHCP4_MODE_DATA Dhcp4ModeData;\r
return Status;\r
}\r
\r
+/**\r
+ Parse the DHCP ACK to get the address configuration and DNS information.\r
+ \r
+ @param[in] Image The handle of the driver image.\r
+ @param[in] Controller The handle of the controller;\r
+ @param[in, out] ConfigData The session configuration data.\r
+\r
+ @retval EFI_SUCCESS The DNS information is got from the DHCP ACK.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval Others Other errors as indicated.\r
+**/\r
EFI_STATUS\r
IScsiDoDhcp (\r
- IN EFI_HANDLE Image,\r
- IN EFI_HANDLE Controller,\r
- IN ISCSI_SESSION_CONFIG_DATA *ConfigData\r
+ IN EFI_HANDLE Image,\r
+ IN EFI_HANDLE Controller,\r
+ IN OUT ISCSI_SESSION_CONFIG_DATA *ConfigData\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Parse the DHCP ACK to get the address configuration and DNS information.\r
- \r
-Arguments:\r
-\r
- Image - The handle of the driver image.\r
- Controller - The handle of the controller;\r
- ConfigData - The session configuration data.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - The DNS information is got from the DHCP ACK.\r
- EFI_NO_MAPPING - DHCP failed to acquire address and other information.\r
- EFI_INVALID_PARAMETER - The DHCP ACK's DNS option is mal-formatted.\r
- EFI_DEVICE_ERROR - Some unexpected error happened.\r
-\r
---*/\r
{\r
EFI_HANDLE Dhcp4Handle;\r
EFI_DHCP4_PROTOCOL *Dhcp4;\r