summaryrefslogtreecommitdiff
path: root/NetworkPkg/IScsiDxe/IScsiConfigNVDataStruc.h
blob: 9024b398dbe29025a5f35901b992ea04a6adb371 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/** @file
  Define NVData structures used by the iSCSI configuration component.

Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
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
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef _ISCSI_NVDATASTRUC_H_
#define _ISCSI_NVDATASTRUC_H_

#include <Guid/IScsiConfigHii.h>

#define VAR_EQ_TEST_NAME          0x100
#define CONFIGURATION_VARSTORE_ID 0x6666

#define FORMID_MAIN_FORM          1
#define FORMID_MAC_FORM           2
#define FORMID_ATTEMPT_FORM       3
#define FORMID_ORDER_FORM         4
#define FORMID_DELETE_FORM        5

#define ISCSI_NAME_IFR_MIN_SIZE   4
#define ISCSI_NAME_IFR_MAX_SIZE   223
#define ISCSI_NAME_MAX_SIZE       224

#define ATTEMPT_NAME_MAX_SIZE     96
#define ATTEMPT_NAME_SIZE         10

#define CONNECT_MIN_RETRY         0
#define CONNECT_MAX_RETRY         16

#define CONNECT_MIN_TIMEOUT       100
#define CONNECT_MAX_TIMEOUT       20000
#define CONNECT_DEFAULT_TIMEOUT   1000

#define ISCSI_MAX_ATTEMPTS_NUM    255

#define ISCSI_DISABLED            0
#define ISCSI_ENABLED             1
#define ISCSI_ENABLED_FOR_MPIO    2

#define IP_MODE_IP4               0
#define IP_MODE_IP6               1
#define IP_MODE_AUTOCONFIG        2

#define ISCSI_AUTH_TYPE_NONE      0
#define ISCSI_AUTH_TYPE_CHAP      1
#define ISCSI_AUTH_TYPE_KRB       2

#define IP4_MIN_SIZE              7
#define IP4_MAX_SIZE              15
#define IP4_STR_MAX_SIZE          16

//
// Macros used for an IPv4 or an IPv6 address.
//
#define IP_MIN_SIZE               2
#define IP_MAX_SIZE               39
#define IP_STR_MAX_SIZE           40

#define LUN_MIN_SIZE              1
#define LUN_MAX_SIZE              20

#define ISCSI_CHAP_UNI            1
#define ISCSI_CHAP_MUTUAL         2

#define TARGET_PORT_MIN_NUM       0
#define TARGET_PORT_MAX_NUM       65535
#define LABEL_END                 0xffff

#define KEY_INITIATOR_NAME        0x101
#define KEY_DHCP_ENABLE           0x102
#define KEY_LOCAL_IP              0x103
#define KEY_SUBNET_MASK           0x104
#define KEY_GATE_WAY              0x105
#define KEY_TARGET_IP             0x106
#define KEY_CHAP_NAME             0x107
#define KEY_CHAP_SECRET           0x108
#define KEY_REVERSE_CHAP_NAME     0x109
#define KEY_REVERSE_CHAP_SECRET   0x10a
#define KEY_SAVE_CHANGES          0x10b
#define KEY_TARGET_NAME           0x10c
#define KEY_BOOT_LUN              0x10d

#define KEY_ADD_ATTEMPT           0x10e
#define KEY_SAVE_ATTEMPT_CONFIG   0x10f
#define KEY_ORDER_ATTEMPT_CONFIG  0x110
#define KEY_SAVE_ORDER_CHANGES    0x111
#define KEY_IGNORE_ORDER_CHANGES  0x112
#define KEY_ATTEMPT_NAME          0x113
#define KEY_SAVE_DELETE_ATTEMPT   0x114
#define KEY_IGNORE_DELETE_ATTEMPT 0x115
#define KEY_DELETE_ATTEMPT        0x116

#define KEY_IP_MODE               0x11c
#define KEY_AUTH_TYPE             0x11d
#define KEY_CONFIG_ISID           0x11e

#define ATTEMPT_ENTRY_LABEL       0x9000
#define KEY_ATTEMPT_ENTRY_BASE    0xa000
#define KEY_DE_ATTEMPT_ENTRY_BASE 0xb000

#define KEY_DEVICE_ENTRY_BASE     0x1000
#define KEY_MAC_ENTRY_BASE        0x2000
#define MAC_ENTRY_LABEL           0x3000
#define ORDER_ENTRY_LABEL         0x4000
#define DELETE_ENTRY_LABEL        0x5000
#define CONFIG_OPTION_OFFSET      0x9000

#define ISCSI_LUN_STR_MAX_LEN     21
#define ISCSI_CHAP_SECRET_MIN_LEN 12
#define ISCSI_CHAP_SECRET_MAX_LEN 16
//
// ISCSI_CHAP_SECRET_STORAGE = ISCSI_CHAP_SECRET_MAX_LEN + sizeof (NULL-Terminator)
//
#define ISCSI_CHAP_SECRET_STORAGE 17
#define ISCSI_CHAP_NAME_MAX_LEN   126
#define ISCSI_CHAP_NAME_STORAGE   127

#define KERBEROS_SECRET_MIN_LEN   12
#define KERBEROS_SECRET_MAX_LEN   16
#define KERBEROS_SECRET_STORAGE   17
#define KERBEROS_NAME_MAX_LEN     96
#define KERBEROS_KDC_PORT_MIN_NUM 0
#define KERBEROS_KDC_PORT_MAX_NUM 65535

#define ISID_CONFIGURABLE_MIN_LEN 6
#define ISID_CONFIGURABLE_MAX_LEN 12
#define ISID_CONFIGURABLE_STORAGE 13

#pragma pack(1)
typedef struct _ISCSI_CONFIG_IFR_NVDATA {
  CHAR16  InitiatorName[ISCSI_NAME_MAX_SIZE];
  CHAR16  AttemptName[ATTEMPT_NAME_MAX_SIZE];

  UINT8   Enabled;
  UINT8   IpMode;

  UINT8   ConnectRetryCount;
  UINT8   Padding1;
  UINT16  ConnectTimeout; // Timeout value in milliseconds.

  UINT8   InitiatorInfoFromDhcp;
  UINT8   TargetInfoFromDhcp;
  CHAR16  LocalIp[IP4_STR_MAX_SIZE];
  CHAR16  SubnetMask[IP4_STR_MAX_SIZE];
  CHAR16  Gateway[IP4_STR_MAX_SIZE];

  CHAR16  TargetName[ISCSI_NAME_MAX_SIZE];
  CHAR16  TargetIp[IP_STR_MAX_SIZE];
  UINT16  TargetPort;
  CHAR16  BootLun[ISCSI_LUN_STR_MAX_LEN];

  UINT8   AuthenticationType;

  UINT8   CHAPType;
  CHAR16  CHAPName[ISCSI_CHAP_NAME_STORAGE];
  CHAR16  CHAPSecret[ISCSI_CHAP_SECRET_STORAGE];
  CHAR16  ReverseCHAPName[ISCSI_CHAP_NAME_STORAGE];
  CHAR16  ReverseCHAPSecret[ISCSI_CHAP_SECRET_STORAGE];

  BOOLEAN MutualRequired;
  UINT8   Padding2;
  CHAR16  KerberosUserName[KERBEROS_NAME_MAX_LEN];
  CHAR16  KerberosUserSecret[KERBEROS_SECRET_STORAGE];
  CHAR16  KerberosKDCName[KERBEROS_NAME_MAX_LEN];
  CHAR16  KerberosKDCRealm[KERBEROS_NAME_MAX_LEN];
  CHAR16  KerberosKDCIp[IP_STR_MAX_SIZE];
  UINT16  KerberosKDCPort;

  UINT8   DynamicOrderedList[ISCSI_MAX_ATTEMPTS_NUM];
  UINT8   DeleteAttemptList[ISCSI_MAX_ATTEMPTS_NUM];

  CHAR16  IsId[ISID_CONFIGURABLE_STORAGE];
} ISCSI_CONFIG_IFR_NVDATA;
#pragma pack()

#endif