• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Define NVData structures used by the iSCSI configuration component.
3 
4 Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _ISCSI_NVDATASTRUC_H_
16 #define _ISCSI_NVDATASTRUC_H_
17 
18 #include <Guid/IScsiConfigHii.h>
19 
20 #define VAR_EQ_TEST_NAME          0x100
21 #define CONFIGURATION_VARSTORE_ID 0x6666
22 
23 #define FORMID_MAIN_FORM          1
24 #define FORMID_MAC_FORM           2
25 #define FORMID_ATTEMPT_FORM       3
26 #define FORMID_ORDER_FORM         4
27 #define FORMID_DELETE_FORM        5
28 
29 #define ISCSI_NAME_IFR_MIN_SIZE   4
30 #define ISCSI_NAME_IFR_MAX_SIZE   223
31 #define ISCSI_NAME_MAX_SIZE       224
32 
33 #define ATTEMPT_NAME_MAX_SIZE     96
34 #define ATTEMPT_NAME_SIZE         10
35 
36 #define CONNECT_MIN_RETRY         0
37 #define CONNECT_MAX_RETRY         16
38 
39 #define CONNECT_MIN_TIMEOUT       100
40 #define CONNECT_MAX_TIMEOUT       20000
41 #define CONNECT_DEFAULT_TIMEOUT   1000
42 
43 #define ISCSI_MAX_ATTEMPTS_NUM    255
44 
45 #define ISCSI_DISABLED            0
46 #define ISCSI_ENABLED             1
47 #define ISCSI_ENABLED_FOR_MPIO    2
48 
49 #define IP_MODE_IP4               0
50 #define IP_MODE_IP6               1
51 #define IP_MODE_AUTOCONFIG        2
52 
53 #define ISCSI_AUTH_TYPE_NONE      0
54 #define ISCSI_AUTH_TYPE_CHAP      1
55 #define ISCSI_AUTH_TYPE_KRB       2
56 
57 #define IP4_MIN_SIZE              7
58 #define IP4_MAX_SIZE              15
59 #define IP4_STR_MAX_SIZE          16
60 
61 //
62 // Macros used for an IPv4 or an IPv6 address.
63 //
64 #define IP_MIN_SIZE               2
65 #define IP_MAX_SIZE               39
66 #define IP_STR_MAX_SIZE           40
67 
68 #define LUN_MIN_SIZE              1
69 #define LUN_MAX_SIZE              20
70 
71 #define ISCSI_CHAP_UNI            0
72 #define ISCSI_CHAP_MUTUAL         1
73 
74 #define TARGET_PORT_MIN_NUM       0
75 #define TARGET_PORT_MAX_NUM       65535
76 #define LABEL_END                 0xffff
77 
78 #define KEY_INITIATOR_NAME        0x101
79 #define KEY_DHCP_ENABLE           0x102
80 #define KEY_LOCAL_IP              0x103
81 #define KEY_SUBNET_MASK           0x104
82 #define KEY_GATE_WAY              0x105
83 #define KEY_TARGET_IP             0x106
84 #define KEY_CHAP_NAME             0x107
85 #define KEY_CHAP_SECRET           0x108
86 #define KEY_REVERSE_CHAP_NAME     0x109
87 #define KEY_REVERSE_CHAP_SECRET   0x10a
88 #define KEY_SAVE_CHANGES          0x10b
89 #define KEY_TARGET_NAME           0x10c
90 #define KEY_BOOT_LUN              0x10d
91 
92 #define KEY_ADD_ATTEMPT           0x10e
93 #define KEY_SAVE_ATTEMPT_CONFIG   0x10f
94 #define KEY_ORDER_ATTEMPT_CONFIG  0x110
95 #define KEY_SAVE_ORDER_CHANGES    0x111
96 #define KEY_IGNORE_ORDER_CHANGES  0x112
97 #define KEY_ATTEMPT_NAME          0x113
98 #define KEY_SAVE_DELETE_ATTEMPT   0x114
99 #define KEY_IGNORE_DELETE_ATTEMPT 0x115
100 #define KEY_DELETE_ATTEMPT        0x116
101 
102 #define KEY_IP_MODE               0x11c
103 #define KEY_AUTH_TYPE             0x11d
104 #define KEY_CONFIG_ISID           0x11e
105 
106 #define ATTEMPT_ENTRY_LABEL       0x9000
107 #define KEY_ATTEMPT_ENTRY_BASE    0xa000
108 #define KEY_DE_ATTEMPT_ENTRY_BASE 0xb000
109 
110 #define KEY_DEVICE_ENTRY_BASE     0x1000
111 #define KEY_MAC_ENTRY_BASE        0x2000
112 #define MAC_ENTRY_LABEL           0x3000
113 #define ORDER_ENTRY_LABEL         0x4000
114 #define DELETE_ENTRY_LABEL        0x5000
115 #define CONFIG_OPTION_OFFSET      0x9000
116 
117 #define ISCSI_LUN_STR_MAX_LEN     21
118 #define ISCSI_CHAP_SECRET_MIN_LEN 12
119 #define ISCSI_CHAP_SECRET_MAX_LEN 16
120 //
121 // ISCSI_CHAP_SECRET_STORAGE = ISCSI_CHAP_SECRET_MAX_LEN + sizeof (NULL-Terminator)
122 //
123 #define ISCSI_CHAP_SECRET_STORAGE 17
124 #define ISCSI_CHAP_NAME_MAX_LEN   126
125 #define ISCSI_CHAP_NAME_STORAGE   127
126 
127 #define KERBEROS_SECRET_MIN_LEN   12
128 #define KERBEROS_SECRET_MAX_LEN   16
129 #define KERBEROS_SECRET_STORAGE   17
130 #define KERBEROS_NAME_MAX_LEN     96
131 #define KERBEROS_KDC_PORT_MIN_NUM 0
132 #define KERBEROS_KDC_PORT_MAX_NUM 65535
133 
134 #define ISID_CONFIGURABLE_MIN_LEN 6
135 #define ISID_CONFIGURABLE_MAX_LEN 12
136 #define ISID_CONFIGURABLE_STORAGE 13
137 
138 #pragma pack(1)
139 typedef struct _ISCSI_CONFIG_IFR_NVDATA {
140   CHAR16  InitiatorName[ISCSI_NAME_MAX_SIZE];
141   CHAR16  AttemptName[ATTEMPT_NAME_MAX_SIZE];
142 
143   UINT8   Enabled;
144   UINT8   IpMode;
145 
146   UINT8   ConnectRetryCount;
147   UINT8   Padding1;
148   UINT16  ConnectTimeout; // Timeout value in milliseconds.
149 
150   UINT8   InitiatorInfoFromDhcp;
151   UINT8   TargetInfoFromDhcp;
152   CHAR16  LocalIp[IP4_STR_MAX_SIZE];
153   CHAR16  SubnetMask[IP4_STR_MAX_SIZE];
154   CHAR16  Gateway[IP4_STR_MAX_SIZE];
155 
156   CHAR16  TargetName[ISCSI_NAME_MAX_SIZE];
157   CHAR16  TargetIp[IP_STR_MAX_SIZE];
158   UINT16  TargetPort;
159   CHAR16  BootLun[ISCSI_LUN_STR_MAX_LEN];
160 
161   UINT8   AuthenticationType;
162 
163   UINT8   CHAPType;
164   CHAR16  CHAPName[ISCSI_CHAP_NAME_STORAGE];
165   CHAR16  CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
166   CHAR16  ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
167   CHAR16  ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
168 
169   BOOLEAN MutualRequired;
170   UINT8   Padding2;
171   CHAR16  KerberosUserName[KERBEROS_NAME_MAX_LEN];
172   CHAR16  KerberosUserSecret[KERBEROS_SECRET_STORAGE];
173   CHAR16  KerberosKDCName[KERBEROS_NAME_MAX_LEN];
174   CHAR16  KerberosKDCRealm[KERBEROS_NAME_MAX_LEN];
175   CHAR16  KerberosKDCIp[IP_STR_MAX_SIZE];
176   UINT16  KerberosKDCPort;
177 
178   UINT8   DynamicOrderedList[ISCSI_MAX_ATTEMPTS_NUM];
179   UINT8   DeleteAttemptList[ISCSI_MAX_ATTEMPTS_NUM];
180 
181   CHAR16  IsId[ISID_CONFIGURABLE_STORAGE];
182 } ISCSI_CONFIG_IFR_NVDATA;
183 #pragma pack()
184 
185 #endif
186