]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfigNVDataStruc.h
Refine soma code to make code run safely.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiConfigNVDataStruc.h
index 768547a31476bcfdb9c6827033407d686e327e85..d51af3a92f4ad1f19e840ae96f2f8e0e01b9caa9 100644 (file)
@@ -1,7 +1,8 @@
-/*++\r
+/** @file\r
+  Define NVData structures used by the iSCSI configuration component\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
 http://opensource.org/licenses/bsd-license.php\r
@@ -9,15 +10,7 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  IScsiConfigNVDataStruc.h\r
\r
-Abstract:\r
\r
-  NVData structure used by the iSCSI configuration component.\r
-\r
---*/\r
+**/\r
 \r
 #ifndef _ISCSI_NVDATASTRUC_H_\r
 #define _ISCSI_NVDATASTRUC_H_\r
@@ -37,7 +30,8 @@ Abstract:
 //\r
 // Vfr has a limit on the size, it's 255 bytes.\r
 //\r
-#define ISCSI_NAME_IFR_MAX_SIZE   126\r
+#define ISCSI_NAME_IFR_MIN_SIZE   4\r
+#define ISCSI_NAME_IFR_MAX_SIZE   223\r
 \r
 #define IP_MIN_SIZE               7\r
 #define IP_MAX_SIZE               15\r
@@ -54,6 +48,7 @@ Abstract:
 #define TARGET_PORT_MAX_NUM       65535\r
 \r
 #define DEVICE_ENTRY_LABEL        0x1234\r
+#define LABEL_END                 0xffff\r
 \r
 #define KEY_INITIATOR_NAME        0x101\r
 #define KEY_DHCP_ENABLE           0x102\r
@@ -72,13 +67,18 @@ Abstract:
 #define KEY_DEVICE_ENTRY_BASE     0x1000\r
 \r
 #define ISCSI_LUN_STR_MAX_LEN     21\r
-#define ISCSI_CHAP_SECRET_MIN_LEN 13\r
-#define ISCSI_CHAP_SECRET_MAX_LEN 17\r
+#define ISCSI_CHAP_SECRET_MIN_LEN 12\r
+#define ISCSI_CHAP_SECRET_MAX_LEN 16\r
+//\r
+//  ISCSI_CHAP_SECRET_STORAGE = ISCSI_CHAP_SECRET_MAX_LEN + sizeof (NULL-Terminator)\r
+//\r
+#define ISCSI_CHAP_SECRET_STORAGE 17\r
+\r
 #define ISCSI_CHAP_NAME_MAX_LEN   126\r
 \r
 #pragma pack(1)\r
 typedef struct {\r
-  CHAR16  InitiatorName[ISCSI_NAME_IFR_MAX_SIZE];\r
+  CHAR16  InitiatorName[ISCSI_NAME_MAX_SIZE];\r
 \r
   UINT8   Enabled;\r
 \r
@@ -87,7 +87,7 @@ typedef struct {
   CHAR16  SubnetMask[IP4_STR_MAX_SIZE];\r
   CHAR16  Gateway[IP4_STR_MAX_SIZE];\r
 \r
-  CHAR16  TargetName[ISCSI_NAME_IFR_MAX_SIZE];\r
+  CHAR16  TargetName[ISCSI_NAME_MAX_SIZE];\r
   CHAR16  TargetIp[IP4_STR_MAX_SIZE];\r
   UINT16  TargetPort;\r
   CHAR16  BootLun[ISCSI_LUN_STR_MAX_LEN];\r
@@ -95,9 +95,9 @@ typedef struct {
 \r
   UINT8   CHAPType;\r
   CHAR16  CHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
-  CHAR16  CHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r
+  CHAR16  CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
   CHAR16  ReverseCHAPName[ISCSI_CHAP_NAME_MAX_LEN];\r
-  CHAR16  ReverseCHAPSecret[ISCSI_CHAP_SECRET_MAX_LEN];\r
+  CHAR16  ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];\r
 } ISCSI_CONFIG_IFR_NVDATA;\r
 #pragma pack()\r
 \r