4 * Copyright (C) 2002 Cisco Systems, Inc.
5 * maintained by linux-iscsi-devel@lists.sourceforge.net
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * See the file COPYING included with this distribution for more details.
27 #include "auth.h" /* for the username and password sizes */
29 #include "iscsi_proto.h"
30 #include "iscsi_net_util.h"
32 /* ISIDs now have a typed naming authority in them. We use an OUI */
33 #define DRIVER_ISID_0 0x00
34 #define DRIVER_ISID_1 0x02
35 #define DRIVER_ISID_2 0x3D
37 /* number of possible connections per session */
38 #define ISCSI_CONN_MAX 1
39 /* max len of interface */
40 #define ISCSI_MAX_IFACE_LEN 65
42 /* the following structures store the options set in the config file.
43 * a structure is defined for each logically-related group of options.
44 * if you are adding a new option, first check if it should belong
45 * to one of the existing groups. If it does, add it. If not, define
49 /* all authentication-related options should be added to this structure.
50 * this structure is per-session, and can be configured
51 * by TargetName but not Subnet.
53 struct iscsi_auth_config
{
54 unsigned int authmethod
;
55 char username
[AUTH_STR_MAX_LEN
];
56 unsigned char password
[AUTH_STR_MAX_LEN
];
57 unsigned int password_length
;
58 char username_in
[AUTH_STR_MAX_LEN
];
59 unsigned char password_in
[AUTH_STR_MAX_LEN
];
60 unsigned int password_in_length
;
63 /* all per-connection timeouts go in this structure.
64 * this structure is per-portal, and can be configured
65 * both by TargetName and Subnet.
67 struct iscsi_connection_timeout_config
{
72 int noop_out_interval
;
76 /* all per-session timeouts go in this structure.
77 * this structure is per-session, and can be configured
78 * by TargetName but not by Subnet.
80 struct iscsi_session_timeout_config
{
81 int replacement_timeout
;
84 /* all error handling timeouts go in this structure.
85 * this structure is per-portal, and can be configured
86 * both by TargetName and Subnet.
88 struct iscsi_error_timeout_config
{
90 int host_reset_timeout
;
92 int tgt_reset_timeout
;
95 /* all TCP options go in this structure.
96 * this structure is per-portal, and can be configured
97 * both by TargetName and Subnet.
99 struct iscsi_tcp_config
{
101 int type_of_service
; /* try to set IP TOS bits */
104 struct iscsi_conn_operational_config
{
105 int MaxRecvDataSegmentLength
;
106 int MaxXmitDataSegmentLength
;
113 /* all iSCSI operational params go in this structure.
114 * this structure is per-portal, and can be configured
115 * both by TargetName and Subnet.
117 struct iscsi_session_operational_config
{
119 int DataSequenceInOrder
;
123 int FirstBurstLength
;
125 int DefaultTime2Wait
;
126 int DefaultTime2Retain
;
128 int MaxOutstandingR2T
;
133 #define CONFIG_DIGEST_NEVER 0
134 #define CONFIG_DIGEST_ALWAYS 1
135 #define CONFIG_DIGEST_PREFER_ON 2
136 #define CONFIG_DIGEST_PREFER_OFF 3
138 struct iscsi_sendtargets_config
{
141 int discoveryd_poll_inval
;
142 struct iscsi_auth_config auth
;
143 struct iscsi_connection_timeout_config conn_timeo
;
144 struct iscsi_conn_operational_config conn_conf
;
145 struct iscsi_session_operational_config session_conf
;
148 struct iscsi_isns_config
{
150 int discoveryd_poll_inval
;
153 struct iscsi_slp_config
{
155 char *interfaces
; /* for multicast, list of interfaces names,
156 * "all", or "none" */
158 struct iscsi_auth_config auth
;
161 typedef enum iscsi_startup
{
162 ISCSI_STARTUP_MANUAL
,
163 ISCSI_STARTUP_AUTOMATIC
,
164 ISCSI_STARTUP_ONBOOT
,
167 typedef enum discovery_type
{
168 DISCOVERY_TYPE_SENDTARGETS
,
170 DISCOVERY_TYPE_OFFLOAD_SENDTARGETS
,
172 DISCOVERY_TYPE_STATIC
,
176 typedef struct conn_rec
{
177 iscsi_startup_e startup
;
178 char address
[NI_MAXHOST
];
180 struct iscsi_tcp_config tcp
;
181 struct iscsi_connection_timeout_config timeo
;
182 struct iscsi_conn_operational_config iscsi
;
185 typedef struct session_rec
{
188 int xmit_thread_priority
;
191 int initial_login_retry_max
;
193 struct iscsi_auth_config auth
;
194 struct iscsi_session_timeout_config timeo
;
195 struct iscsi_error_timeout_config err_timeo
;
196 struct iscsi_session_operational_config iscsi
;
197 struct session_info
*info
;
200 * This is a flag passed to iscsid. If set, multiple sessions are
201 * allowed to be initiated on this record
203 unsigned char multiple
;
206 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
207 #define ISCSI_MAX_STR_LEN 80
209 typedef struct iface_rec
{
210 struct list_head list
;
211 /* iscsi iface record name */
212 char name
[ISCSI_MAX_IFACE_LEN
];
214 /* network layer iface name (eth0) */
215 char netdev
[IFNAMSIZ
];
216 char ipaddress
[NI_MAXHOST
];
217 char subnet_mask
[NI_MAXHOST
];
218 char gateway
[NI_MAXHOST
];
219 char bootproto
[ISCSI_MAX_STR_LEN
];
220 char ipv6_linklocal
[NI_MAXHOST
];
221 char ipv6_router
[NI_MAXHOST
];
222 char ipv6_autocfg
[NI_MAXHOST
];
223 char linklocal_autocfg
[NI_MAXHOST
];
224 char router_autocfg
[NI_MAXHOST
];
226 uint8_t vlan_priority
;
227 char vlan_state
[ISCSI_MAX_STR_LEN
];
228 char state
[ISCSI_MAX_STR_LEN
]; /* 0 = disable,
233 * TODO: we may have to make this bigger and interconnect
234 * specific for infinniband
236 char hwaddress
[ISCSI_HWADDRESS_BUF_SIZE
];
237 char transport_name
[ISCSI_TRANSPORT_NAME_MAXLEN
];
239 * This is only used for boot now, but the iser guys
240 * can use this for their virtualization idea.
242 char alias
[TARGET_NAME_MAXLEN
+ 1];
243 char iname
[TARGET_NAME_MAXLEN
+ 1];
246 typedef struct node_rec
{
247 struct list_head list
;
248 char name
[TARGET_NAME_MAXLEN
];
250 iscsi_startup_e startup
;
252 session_rec_t session
;
253 conn_rec_t conn
[ISCSI_CONN_MAX
];
255 discovery_type_e disc_type
;
256 char disc_address
[NI_MAXHOST
];
260 typedef struct discovery_rec
{
261 iscsi_startup_e startup
;
262 discovery_type_e type
;
263 char address
[NI_MAXHOST
];
266 struct iscsi_sendtargets_config sendtargets
;
267 struct iscsi_slp_config slp
;
268 struct iscsi_isns_config isns
;
272 #endif /* CONFIG_H */