1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
22*904e51f6SJack Meng  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23fcf3ce44SJohn Forte  */
24fcf3ce44SJohn Forte 
25fcf3ce44SJohn Forte #ifndef _ISCSI_IF_H
26fcf3ce44SJohn Forte #define	_ISCSI_IF_H
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte #ifdef __cplusplus
29fcf3ce44SJohn Forte extern "C" {
30fcf3ce44SJohn Forte #endif
31fcf3ce44SJohn Forte 
32fcf3ce44SJohn Forte #ifdef _KERNEL
33fcf3ce44SJohn Forte #include <sys/types.h>
34fcf3ce44SJohn Forte #include <sys/strsubr.h>	/* for prototype of kstrgetmsg */
35fcf3ce44SJohn Forte #include <sys/socket.h>
36fcf3ce44SJohn Forte #include <sys/socketvar.h>	/* for struct sonode */
37fcf3ce44SJohn Forte #endif
38fcf3ce44SJohn Forte #include <netinet/in.h>
39fcf3ce44SJohn Forte #include <sys/scsi/impl/uscsi.h>
401a1a84a3SPeter Dunlap #include <sys/iscsi_protocol.h>
41fcf3ce44SJohn Forte 
42fcf3ce44SJohn Forte /*
43fcf3ce44SJohn Forte  * Each of the top level structures have a version field as
44fcf3ce44SJohn Forte  * the first member. That version value will be set by the
45fcf3ce44SJohn Forte  * caller. The consumer of the structure will check to see
46fcf3ce44SJohn Forte  * if the version is correct.
47fcf3ce44SJohn Forte  */
48fcf3ce44SJohn Forte #define	ISCSI_INTERFACE_VERSION			3
49fcf3ce44SJohn Forte 
50fcf3ce44SJohn Forte /*
51fcf3ce44SJohn Forte  * Login parameter values are used instead of ascii text
52fcf3ce44SJohn Forte  * between the IMA plug-in and kernel.
53fcf3ce44SJohn Forte  */
54fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DATA_SEQUENCE_IN_ORDER	0x0000  /* bool */
55fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_IMMEDIATE_DATA		0x0001  /* bool */
56fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_INITIAL_R2T			0x0002  /* bool */
57fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DATA_PDU_IN_ORDER		0x0003  /* bool */
58fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_HEADER_DIGEST			0x0004	/* int */
59fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DATA_DIGEST			0x0005	/* int */
60fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_RETAIN		0x0006  /* int */
61fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_WAIT		0x0007  /* int */
62fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_MAX_RECV_DATA_SEGMENT_LENGTH	0x0008  /* int */
63fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_FIRST_BURST_LENGTH		0x0009  /* int */
64fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_MAX_BURST_LENGTH		0x000A  /* int */
65fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_MAX_CONNECTIONS		0x000B  /* int */
66fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_OUTSTANDING_R2T		0x000C  /* int */
67fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_ERROR_RECOVERY_LEVEL		0x000D  /* int */
68fcf3ce44SJohn Forte /*
69fcf3ce44SJohn Forte  * number of login parameters - needs to be updated when new parameter added
70fcf3ce44SJohn Forte  */
71fcf3ce44SJohn Forte #define	ISCSI_NUM_LOGIN_PARAM				0x000E
72fcf3ce44SJohn Forte 
73fcf3ce44SJohn Forte /*
74fcf3ce44SJohn Forte  * Used internally by the persistent store code. Currently a bitmap is kept of
75fcf3ce44SJohn Forte  * which params are currently set. This allows for quick a look up instead of
76fcf3ce44SJohn Forte  * cycling through the possible entries. Using an unsigned int as the bitmap we
77fcf3ce44SJohn Forte  * can have parameter numbers up through 31. Since the current only has 22
78fcf3ce44SJohn Forte  * we're okay.
79fcf3ce44SJohn Forte  */
80fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_DB_ENTRY			0x0020
81fcf3ce44SJohn Forte /*
82fcf3ce44SJohn Forte  * Special case. When this parameter value is set in iscsi_param_set_t
83fcf3ce44SJohn Forte  * the member s_value (type iscsi_param_set_t) is not used.
84fcf3ce44SJohn Forte  * The name field contains the InitiatorName for the system which
85fcf3ce44SJohn Forte  * should be used for all future sessions.
86fcf3ce44SJohn Forte  */
87fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_INITIATOR_NAME		0x0021
88fcf3ce44SJohn Forte #define	ISCSI_LOGIN_PARAM_INITIATOR_ALIAS		0x0022
89fcf3ce44SJohn Forte 
90fcf3ce44SJohn Forte #define	ISCSI_DEVCTL		"devctl"
91fcf3ce44SJohn Forte #define	ISCSI_DRIVER_DEVCTL	"/devices/iscsi:" ISCSI_DEVCTL
92fcf3ce44SJohn Forte 
93fcf3ce44SJohn Forte /*
94fcf3ce44SJohn Forte  * ioctls supported by the driver.
95fcf3ce44SJohn Forte  */
96fcf3ce44SJohn Forte #define	ISCSI_IOCTL		(('i' << 24) | ('S' << 16) | ('C' << 8))
97fcf3ce44SJohn Forte #define	ISCSI_CREATE_OID		(ISCSI_IOCTL | 2)
98fcf3ce44SJohn Forte #define	ISCSI_LOGIN			(ISCSI_IOCTL | 3)
99fcf3ce44SJohn Forte #define	ISCSI_LOGOUT			(ISCSI_IOCTL | 4)
100fcf3ce44SJohn Forte #define	ISCSI_PARAM_GET			(ISCSI_IOCTL | 5)
101fcf3ce44SJohn Forte #define	ISCSI_PARAM_SET			(ISCSI_IOCTL | 6)
102fcf3ce44SJohn Forte #define	ISCSI_TARGET_PARAM_CLEAR	(ISCSI_IOCTL | 8)
103fcf3ce44SJohn Forte #define	ISCSI_TARGET_OID_LIST_GET	(ISCSI_IOCTL | 9)
104fcf3ce44SJohn Forte #define	ISCSI_TARGET_PROPS_GET		(ISCSI_IOCTL | 10)
105fcf3ce44SJohn Forte #define	ISCSI_TARGET_PROPS_SET		(ISCSI_IOCTL | 11)
106fcf3ce44SJohn Forte #define	ISCSI_TARGET_ADDRESS_GET	(ISCSI_IOCTL | 12)
107fcf3ce44SJohn Forte #define	ISCSI_CHAP_SET			(ISCSI_IOCTL | 13)
108fcf3ce44SJohn Forte #define	ISCSI_CHAP_GET			(ISCSI_IOCTL | 14)
109fcf3ce44SJohn Forte #define	ISCSI_CHAP_CLEAR		(ISCSI_IOCTL | 15)
110fcf3ce44SJohn Forte #define	ISCSI_STATIC_GET		(ISCSI_IOCTL | 16)
111fcf3ce44SJohn Forte #define	ISCSI_STATIC_SET		(ISCSI_IOCTL | 17)
112fcf3ce44SJohn Forte #define	ISCSI_STATIC_CLEAR		(ISCSI_IOCTL | 18)
113fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_SET		(ISCSI_IOCTL | 19)
114fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_GET		(ISCSI_IOCTL | 20)
115fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_CLEAR		(ISCSI_IOCTL | 21)
116fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_PROPS		(ISCSI_IOCTL | 22)
117fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_ADDR_SET	(ISCSI_IOCTL | 23)
118fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_ADDR_LIST_GET	(ISCSI_IOCTL | 24)
119fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_ADDR_CLEAR	(ISCSI_IOCTL | 25)
120fcf3ce44SJohn Forte #define	ISCSI_RADIUS_SET		(ISCSI_IOCTL | 26)
121fcf3ce44SJohn Forte #define	ISCSI_RADIUS_GET		(ISCSI_IOCTL | 27)
122fcf3ce44SJohn Forte #define	ISCSI_LUN_OID_LIST_GET		(ISCSI_IOCTL | 29)
123fcf3ce44SJohn Forte #define	ISCSI_LUN_PROPS_GET		(ISCSI_IOCTL | 30)
124fcf3ce44SJohn Forte #define	ISCSI_CONN_OID_LIST_GET		(ISCSI_IOCTL | 31)
125fcf3ce44SJohn Forte #define	ISCSI_CONN_PROPS_GET		(ISCSI_IOCTL | 32)
126fcf3ce44SJohn Forte #define	ISCSI_USCSI			(ISCSI_IOCTL | 33)
1274246c8e9SJack Meng #define	ISCSI_SMF_ONLINE		(ISCSI_IOCTL | 34)
128fcf3ce44SJohn Forte #define	ISCSI_DISCOVERY_EVENTS		(ISCSI_IOCTL | 35)
129fcf3ce44SJohn Forte #define	ISCSI_AUTH_SET			(ISCSI_IOCTL | 36)
130fcf3ce44SJohn Forte #define	ISCSI_AUTH_GET			(ISCSI_IOCTL | 37)
131fcf3ce44SJohn Forte #define	ISCSI_AUTH_CLEAR		(ISCSI_IOCTL | 38)
132fcf3ce44SJohn Forte #define	ISCSI_SENDTGTS_GET		(ISCSI_IOCTL | 39)
133fcf3ce44SJohn Forte #define	ISCSI_ISNS_SERVER_ADDR_SET	(ISCSI_IOCTL | 40)
134fcf3ce44SJohn Forte #define	ISCSI_ISNS_SERVER_ADDR_LIST_GET	(ISCSI_IOCTL | 41)
135fcf3ce44SJohn Forte #define	ISCSI_ISNS_SERVER_ADDR_CLEAR	(ISCSI_IOCTL | 42)
136fcf3ce44SJohn Forte #define	ISCSI_ISNS_SERVER_GET		(ISCSI_IOCTL | 43)
137fcf3ce44SJohn Forte #define	ISCSI_GET_CONFIG_SESSIONS	(ISCSI_IOCTL | 44)
138fcf3ce44SJohn Forte #define	ISCSI_SET_CONFIG_SESSIONS	(ISCSI_IOCTL | 45)
139fcf3ce44SJohn Forte #define	ISCSI_INIT_NODE_NAME_SET	(ISCSI_IOCTL | 46)
1406cefaae1SJack Meng #define	ISCSI_IS_ACTIVE			(ISCSI_IOCTL | 47)
1416cefaae1SJack Meng #define	ISCSI_BOOTPROP_GET		(ISCSI_IOCTL | 48)
1424246c8e9SJack Meng #define	ISCSI_SMF_OFFLINE		(ISCSI_IOCTL | 49)
1434246c8e9SJack Meng #define	ISCSI_SMF_GET			(ISCSI_IOCTL | 50)
144aff4bce5Syi zhang - Sun Microsystems - Beijing China #define	ISCSI_TUNABLE_PARAM_GET		(ISCSI_IOCTL | 51)
145aff4bce5Syi zhang - Sun Microsystems - Beijing China #define	ISCSI_TUNABLE_PARAM_SET		(ISCSI_IOCTL | 52)
146*904e51f6SJack Meng #define	ISCSI_TARGET_REENUM		(ISCSI_IOCTL | 53)
147fcf3ce44SJohn Forte #define	ISCSI_DB_DUMP			(ISCSI_IOCTL | 100) /* DBG */
148fcf3ce44SJohn Forte 
149fcf3ce44SJohn Forte /*
150fcf3ce44SJohn Forte  * Misc. defines
151fcf3ce44SJohn Forte  */
152fcf3ce44SJohn Forte #define	ISCSI_CHAP_NAME_LEN			512
153fcf3ce44SJohn Forte #define	ISCSI_CHAP_SECRET_LEN			16
154fcf3ce44SJohn Forte #define	ISCSI_TGT_OID_LIST			0x0001
155fcf3ce44SJohn Forte #define	ISCSI_STATIC_TGT_OID_LIST		0x0002
156fcf3ce44SJohn Forte #define	ISCSI_TGT_PARAM_OID_LIST		0x0004
157fcf3ce44SJohn Forte #define	ISCSI_SESS_PARAM			0x0001
158fcf3ce44SJohn Forte #define	ISCSI_CONN_PARAM			0x0002
159fcf3ce44SJohn Forte 
160fcf3ce44SJohn Forte /* digest level defines */
161fcf3ce44SJohn Forte #define	ISCSI_DIGEST_NONE		0
162fcf3ce44SJohn Forte #define	ISCSI_DIGEST_CRC32C		1
163fcf3ce44SJohn Forte #define	ISCSI_DIGEST_CRC32C_NONE	2 /* offer both, prefer CRC32C */
164fcf3ce44SJohn Forte #define	ISCSI_DIGEST_NONE_CRC32C	3 /* offer both, prefer None */
165fcf3ce44SJohn Forte 
166fcf3ce44SJohn Forte /*
167fcf3ce44SJohn Forte  * A last error associated with each target session is returned in the
168fcf3ce44SJohn Forte  * iscsi_target_t structure.
169fcf3ce44SJohn Forte  */
170fcf3ce44SJohn Forte typedef enum iscsi_error {
171fcf3ce44SJohn Forte 	NoError, AuthenticationError, LoginParamError, ConnectionReset
172fcf3ce44SJohn Forte } iscsi_error_t;
173fcf3ce44SJohn Forte 
174fcf3ce44SJohn Forte /*
175fcf3ce44SJohn Forte  * The values associated with each enum is based on the IMA specification.
176fcf3ce44SJohn Forte  */
177fcf3ce44SJohn Forte typedef enum	iSCSIDiscoveryMethod {
178fcf3ce44SJohn Forte 	iSCSIDiscoveryMethodUnknown	= 0,
179fcf3ce44SJohn Forte 	iSCSIDiscoveryMethodStatic	= 1,
180fcf3ce44SJohn Forte 	iSCSIDiscoveryMethodSLP		= 2,
181fcf3ce44SJohn Forte 	iSCSIDiscoveryMethodISNS	= 4,
1826cefaae1SJack Meng 	iSCSIDiscoveryMethodSendTargets	= 8,
1836cefaae1SJack Meng 	/*
1846cefaae1SJack Meng 	 * Since there is no specification about boot discovery method,
1856cefaae1SJack Meng 	 * we should leave a value gap in case of other discovery
1866cefaae1SJack Meng 	 * methods added.
1876cefaae1SJack Meng 	 */
1886cefaae1SJack Meng 	iSCSIDiscoveryMethodBoot	= 128
189fcf3ce44SJohn Forte } iSCSIDiscoveryMethod_t;
190fcf3ce44SJohn Forte #define	ISCSI_ALL_DISCOVERY_METHODS	(iSCSIDiscoveryMethodStatic |	\
191fcf3ce44SJohn Forte 					iSCSIDiscoveryMethodSLP |	\
192fcf3ce44SJohn Forte 					iSCSIDiscoveryMethodISNS |	\
193fcf3ce44SJohn Forte 					iSCSIDiscoveryMethodSendTargets)
194fcf3ce44SJohn Forte 
195fcf3ce44SJohn Forte /*
196fcf3ce44SJohn Forte  * Before anything can be done to a target it must have an OID.
197fcf3ce44SJohn Forte  */
198fcf3ce44SJohn Forte typedef struct iscsi_oid {
199fcf3ce44SJohn Forte 	uint32_t		o_vers;				/* In */
200fcf3ce44SJohn Forte 	uchar_t			o_name[ISCSI_MAX_NAME_LEN];	/* In */
201fcf3ce44SJohn Forte 	/*
202fcf3ce44SJohn Forte 	 * tpgt is only 16 bits per spec.  use 32 in ioctl to reduce
203fcf3ce44SJohn Forte 	 * packing issue.  Also -1 tpgt denotes default value.  iSCSI
204fcf3ce44SJohn Forte 	 * stack will detemermine tpgt during login.
205fcf3ce44SJohn Forte 	 */
206fcf3ce44SJohn Forte 	int			o_tpgt;				/* In */
207fcf3ce44SJohn Forte 	uint32_t		o_oid;				/* Out */
208fcf3ce44SJohn Forte } iscsi_oid_t;
209fcf3ce44SJohn Forte #define	ISCSI_OID_NOTSET	0
210fcf3ce44SJohn Forte #define	ISCSI_INITIATOR_OID	1	/* Other OIDs follow > 1 */
211fcf3ce44SJohn Forte #define	ISCSI_DEFAULT_TPGT	-1
212fcf3ce44SJohn Forte 
213fcf3ce44SJohn Forte /*
214fcf3ce44SJohn Forte  * iSCSI Login Parameters - Reference iscsi draft for
215fcf3ce44SJohn Forte  * definitions of the below login params.
216fcf3ce44SJohn Forte  */
217fcf3ce44SJohn Forte typedef struct iscsi_login_params {
218fcf3ce44SJohn Forte 	boolean_t	immediate_data;
219fcf3ce44SJohn Forte 	boolean_t	initial_r2t;
220fcf3ce44SJohn Forte 	int		first_burst_length;	/* range: 512 - 2**24-1 */
221fcf3ce44SJohn Forte 	int		max_burst_length;	/* range: 512 - 2**24-1 */
222fcf3ce44SJohn Forte 	boolean_t	data_pdu_in_order;
223fcf3ce44SJohn Forte 	boolean_t	data_sequence_in_order;
224fcf3ce44SJohn Forte 	int		default_time_to_wait;
225fcf3ce44SJohn Forte 	int		default_time_to_retain;
226fcf3ce44SJohn Forte 	int		header_digest;
227fcf3ce44SJohn Forte 	int		data_digest;
228fcf3ce44SJohn Forte 	int		max_recv_data_seg_len;	/* range: 512 - 2**24-1 */
229fcf3ce44SJohn Forte 	int		max_xmit_data_seg_len;	/* range: 512 - 2**24-1 */
230fcf3ce44SJohn Forte 	int		max_connections;
231fcf3ce44SJohn Forte 	int		max_outstanding_r2t;
232fcf3ce44SJohn Forte 	int		error_recovery_level;
233fcf3ce44SJohn Forte 	boolean_t	ifmarker;
234fcf3ce44SJohn Forte 	boolean_t	ofmarker;
235fcf3ce44SJohn Forte } iscsi_login_params_t;
236fcf3ce44SJohn Forte 
237aff4bce5Syi zhang - Sun Microsystems - Beijing China #define		ISCSI_TUNABLE_PARAM_RX_TIMEOUT_VALUE		0x0001
238aff4bce5Syi zhang - Sun Microsystems - Beijing China #define		ISCSI_TUNABLE_PARAM_CONN_LOGIN_MAX		0x0002
239aff4bce5Syi zhang - Sun Microsystems - Beijing China #define		ISCSI_TUNABLE_PARAM_LOGIN_POLLING_DELAY		0x0004
240aff4bce5Syi zhang - Sun Microsystems - Beijing China 
241fcf3ce44SJohn Forte /*
242fcf3ce44SJohn Forte  * Once parameters have been set via ISCSI_SET_PARAM the login is initiated
243fcf3ce44SJohn Forte  * by sending an ISCSI_LOGIN ioctl with the following structure filled in.
244fcf3ce44SJohn Forte  */
245fcf3ce44SJohn Forte typedef struct entry {
246fcf3ce44SJohn Forte 	int			e_vers;
247fcf3ce44SJohn Forte 	uint32_t		e_oid;
248fcf3ce44SJohn Forte 	union {
249fcf3ce44SJohn Forte 		struct in_addr		u_in4;
250fcf3ce44SJohn Forte 		struct in6_addr		u_in6;
251fcf3ce44SJohn Forte 	} e_u;
252fcf3ce44SJohn Forte 	/*
253fcf3ce44SJohn Forte 	 * e_insize indicates which of the previous structs is valid.
254fcf3ce44SJohn Forte 	 */
255fcf3ce44SJohn Forte 	int			e_insize;
256fcf3ce44SJohn Forte 	int			e_port;
257fcf3ce44SJohn Forte 	int			e_tpgt;
2586cefaae1SJack Meng 	/* e_boot should be true if a boot session is created. */
2596cefaae1SJack Meng 	boolean_t		e_boot;
260fcf3ce44SJohn Forte } entry_t;
261fcf3ce44SJohn Forte 
262fcf3ce44SJohn Forte /*
263fcf3ce44SJohn Forte  * Used when setting or gettnig the Initiator Name or Alias.
264fcf3ce44SJohn Forte  */
265fcf3ce44SJohn Forte typedef struct node_name {
266fcf3ce44SJohn Forte 	unsigned char		n_name[ISCSI_MAX_NAME_LEN];
267fcf3ce44SJohn Forte 	int			n_len;
268fcf3ce44SJohn Forte } node_name_t;
269fcf3ce44SJohn Forte 
270fcf3ce44SJohn Forte typedef struct	_iSCSIMinMaxValue {
271fcf3ce44SJohn Forte 	uint32_t		i_current,
272fcf3ce44SJohn Forte 				i_default,
273fcf3ce44SJohn Forte 				i_min,
274fcf3ce44SJohn Forte 				i_max,
275fcf3ce44SJohn Forte 				i_incr;
276fcf3ce44SJohn Forte } iscsi_int_info_t;
277fcf3ce44SJohn Forte 
278fcf3ce44SJohn Forte typedef struct	_iSCSIBoolValue {
279fcf3ce44SJohn Forte 	boolean_t		b_current,
280fcf3ce44SJohn Forte 				b_default;
281fcf3ce44SJohn Forte } iscsi_bool_info_t;
282fcf3ce44SJohn Forte 
283fcf3ce44SJohn Forte typedef struct	_iSCSIParamValueGet {
284fcf3ce44SJohn Forte 	boolean_t		v_valid,
285fcf3ce44SJohn Forte 				v_settable;
286fcf3ce44SJohn Forte 	iscsi_int_info_t	v_integer;
287fcf3ce44SJohn Forte 	iscsi_bool_info_t	v_bool;
288fcf3ce44SJohn Forte 	uchar_t			v_name[ISCSI_MAX_NAME_LEN];
289fcf3ce44SJohn Forte } iscsi_get_value_t;
290fcf3ce44SJohn Forte 
291fcf3ce44SJohn Forte typedef struct	_iSCSILoginParamGet {
292fcf3ce44SJohn Forte 	uint32_t		g_vers;				/* In */
293fcf3ce44SJohn Forte 	uint32_t		g_oid;				/* In */
294fcf3ce44SJohn Forte 	uint32_t		g_param;			/* Out */
295fcf3ce44SJohn Forte 	iscsi_get_value_t	g_value;			/* Out */
296fcf3ce44SJohn Forte 	uint32_t		g_conn_cid;			/* In */
297fcf3ce44SJohn Forte 
298fcf3ce44SJohn Forte 	/*
299fcf3ce44SJohn Forte 	 * To indicate whether session or connection related param is
300fcf3ce44SJohn Forte 	 * being requested.
301fcf3ce44SJohn Forte 	 */
302fcf3ce44SJohn Forte 	uint32_t		g_param_type;			/* In */
303fcf3ce44SJohn Forte } iscsi_param_get_t;
304fcf3ce44SJohn Forte 
305fcf3ce44SJohn Forte typedef struct	iscsi_set_value {
306fcf3ce44SJohn Forte 	uint32_t		v_integer;
307fcf3ce44SJohn Forte 	boolean_t		v_bool;
308fcf3ce44SJohn Forte 	uchar_t			v_name[ISCSI_MAX_NAME_LEN];
309fcf3ce44SJohn Forte } iscsi_set_value_t;
310fcf3ce44SJohn Forte 
311fcf3ce44SJohn Forte /*
312fcf3ce44SJohn Forte  * All of the members of this structure are set by the user agent and
313fcf3ce44SJohn Forte  * consumed by the driver.
314fcf3ce44SJohn Forte  */
315fcf3ce44SJohn Forte typedef struct	iSCSILoginParamSet {
316fcf3ce44SJohn Forte 	uint32_t		s_vers,
317fcf3ce44SJohn Forte 				s_oid;
318fcf3ce44SJohn Forte 	uint32_t		s_param;
319fcf3ce44SJohn Forte 	iscsi_set_value_t	s_value;
320fcf3ce44SJohn Forte } iscsi_param_set_t;
321fcf3ce44SJohn Forte 
322aff4bce5Syi zhang - Sun Microsystems - Beijing China /* Data structure used for tunable object parameters */
323aff4bce5Syi zhang - Sun Microsystems - Beijing China typedef struct _iSCSITunableValue {
324aff4bce5Syi zhang - Sun Microsystems - Beijing China 	uint32_t	v_integer;
325aff4bce5Syi zhang - Sun Microsystems - Beijing China 	boolean_t	v_bool;
326aff4bce5Syi zhang - Sun Microsystems - Beijing China 	uchar_t		v_name[ISCSI_MAX_NAME_LEN];
327aff4bce5Syi zhang - Sun Microsystems - Beijing China } iscsi_tunable_value_t;
328aff4bce5Syi zhang - Sun Microsystems - Beijing China 
329aff4bce5Syi zhang - Sun Microsystems - Beijing China typedef struct iSCSITunalbeParamObject {
330aff4bce5Syi zhang - Sun Microsystems - Beijing China 	boolean_t		t_set;
331aff4bce5Syi zhang - Sun Microsystems - Beijing China 	uint32_t		t_oid;
332aff4bce5Syi zhang - Sun Microsystems - Beijing China 	uint32_t		t_param;
333aff4bce5Syi zhang - Sun Microsystems - Beijing China 	iscsi_tunable_value_t	t_value;
334aff4bce5Syi zhang - Sun Microsystems - Beijing China } iscsi_tunable_object_t;
335aff4bce5Syi zhang - Sun Microsystems - Beijing China 
336fcf3ce44SJohn Forte /*
337fcf3ce44SJohn Forte  * Data in this structure is set by the user agent and consumed by
338fcf3ce44SJohn Forte  * the driver.
339fcf3ce44SJohn Forte  */
340fcf3ce44SJohn Forte typedef struct chap_props {
341fcf3ce44SJohn Forte 	uint32_t		c_vers,
342fcf3ce44SJohn Forte 				c_retries,
343fcf3ce44SJohn Forte 				c_oid;
344fcf3ce44SJohn Forte 	unsigned char		c_user[128];
345fcf3ce44SJohn Forte 	uint32_t		c_user_len;
346fcf3ce44SJohn Forte 	unsigned char		c_secret[16];
347fcf3ce44SJohn Forte 	uint32_t		c_secret_len;
348fcf3ce44SJohn Forte } iscsi_chap_props_t;
349fcf3ce44SJohn Forte 
350fcf3ce44SJohn Forte typedef enum	authMethod {
351fcf3ce44SJohn Forte 	authMethodNone  = 0x00,
352fcf3ce44SJohn Forte 	authMethodCHAP  = 0x01,
353fcf3ce44SJohn Forte 	authMethodSRP   = 0x02,
354fcf3ce44SJohn Forte 	authMethodKRB5  = 0x04,
355fcf3ce44SJohn Forte 	authMethodSPKM1 = 0x08,
356fcf3ce44SJohn Forte 	authMethodSPKM2 = 0x10
357fcf3ce44SJohn Forte } authMethod_t;
358fcf3ce44SJohn Forte 
359fcf3ce44SJohn Forte /*
360fcf3ce44SJohn Forte  * Data in this structure is set by the user agent and consumed by
361fcf3ce44SJohn Forte  * the driver.
362fcf3ce44SJohn Forte  */
363fcf3ce44SJohn Forte typedef struct auth_props {
364fcf3ce44SJohn Forte 	uint32_t a_vers;
365fcf3ce44SJohn Forte 	uint32_t a_oid;
366fcf3ce44SJohn Forte 	boolean_t a_bi_auth;
367fcf3ce44SJohn Forte 	authMethod_t a_auth_method;
368fcf3ce44SJohn Forte } iscsi_auth_props_t;
369fcf3ce44SJohn Forte 
370fcf3ce44SJohn Forte /*
371fcf3ce44SJohn Forte  * Data in this structure is set by the user agent and consumed by
372fcf3ce44SJohn Forte  * the driver.
373fcf3ce44SJohn Forte  */
374fcf3ce44SJohn Forte #define	MAX_RAD_SHARED_SECRET_LEN 128
375fcf3ce44SJohn Forte typedef struct radius_props {
376fcf3ce44SJohn Forte 	uint32_t		r_vers;
377fcf3ce44SJohn Forte 	uint32_t		r_oid;
378fcf3ce44SJohn Forte 	union {
379fcf3ce44SJohn Forte 		struct in_addr		u_in4;
380fcf3ce44SJohn Forte 		struct in6_addr		u_in6;
381fcf3ce44SJohn Forte 	} r_addr;
382fcf3ce44SJohn Forte 	/*
383fcf3ce44SJohn Forte 	 * r_insize indicates which of the previous structs is valid.
384fcf3ce44SJohn Forte 	 */
385fcf3ce44SJohn Forte 	int			r_insize;
386fcf3ce44SJohn Forte 
387fcf3ce44SJohn Forte 	uint32_t		r_port;
388fcf3ce44SJohn Forte 	uint8_t			r_shared_secret[MAX_RAD_SHARED_SECRET_LEN];
389fcf3ce44SJohn Forte 	boolean_t		r_radius_access;
390fcf3ce44SJohn Forte 	boolean_t		r_radius_config_valid;
391fcf3ce44SJohn Forte 	uint32_t		r_shared_secret_len;
392fcf3ce44SJohn Forte } iscsi_radius_props_t;
393fcf3ce44SJohn Forte 
394fcf3ce44SJohn Forte typedef struct	_IPAddress {
395fcf3ce44SJohn Forte 	union {
396fcf3ce44SJohn Forte 		struct in_addr	in4;
397fcf3ce44SJohn Forte 		struct in6_addr	in6;
398fcf3ce44SJohn Forte 	} i_addr;
399fcf3ce44SJohn Forte 	/* i_insize determines which is valid in the union above */
400fcf3ce44SJohn Forte 	int			i_insize;
401fcf3ce44SJohn Forte } iscsi_ipaddr_t;
402fcf3ce44SJohn Forte 
403fcf3ce44SJohn Forte typedef struct	_iSCSITargetAddressKey {
404fcf3ce44SJohn Forte 	iscsi_ipaddr_t		a_addr;
405fcf3ce44SJohn Forte 	uint32_t		a_port,
406fcf3ce44SJohn Forte 				a_oid;
407fcf3ce44SJohn Forte } iscsi_addr_t;
408fcf3ce44SJohn Forte 
409fcf3ce44SJohn Forte typedef struct	_iSCSITargetAddressKeyProperties {
410fcf3ce44SJohn Forte 	uint32_t		al_vers,			/* In */
411fcf3ce44SJohn Forte 				al_oid;				/* In */
412fcf3ce44SJohn Forte 	uint32_t		al_in_cnt;			/* In */
413fcf3ce44SJohn Forte 	uint32_t		al_out_cnt;			/* Out */
414fcf3ce44SJohn Forte 	uint32_t		al_tpgt;			/* Out */
415fcf3ce44SJohn Forte 	iscsi_addr_t		al_addrs[1];			/* Out */
416fcf3ce44SJohn Forte } iscsi_addr_list_t;
417fcf3ce44SJohn Forte 
418fcf3ce44SJohn Forte typedef struct	_iSCSITargetProperties {
419fcf3ce44SJohn Forte 	uint32_t		p_vers,				/* In */
420fcf3ce44SJohn Forte 				p_oid;				/* In */
421fcf3ce44SJohn Forte 	uchar_t			p_name[ISCSI_MAX_NAME_LEN];	/* Out */
422fcf3ce44SJohn Forte 	uint_t			p_name_len;			/* Out */
423fcf3ce44SJohn Forte 	uchar_t			p_alias[ISCSI_MAX_NAME_LEN];	/* Out */
424fcf3ce44SJohn Forte 	uint_t			p_alias_len;			/* Out */
425fcf3ce44SJohn Forte 	iSCSIDiscoveryMethod_t	p_discovery;			/* Out */
426fcf3ce44SJohn Forte 	boolean_t		p_connected;			/* Out */
427fcf3ce44SJohn Forte 	uint32_t		p_num_of_connections;		/* Out */
428fcf3ce44SJohn Forte 	/* ---- If connected == B_TRUE then lastErr has no meaning. ---- */
429fcf3ce44SJohn Forte 	iscsi_error_t		p_last_err;			/* Out */
430fcf3ce44SJohn Forte 	/*
431fcf3ce44SJohn Forte 	 * Target portal group tag = -1 value means default.
432fcf3ce44SJohn Forte 	 */
433fcf3ce44SJohn Forte 	int			p_tpgt_conf;			/* Out */
434fcf3ce44SJohn Forte 	int			p_tpgt_nego;			/* Out */
435fcf3ce44SJohn Forte 	uchar_t			p_isid[ISCSI_ISID_LEN];		/* Out */
436fcf3ce44SJohn Forte 	uchar_t			p_reserved[128];
437fcf3ce44SJohn Forte } iscsi_property_t;
438fcf3ce44SJohn Forte 
439fcf3ce44SJohn Forte typedef struct	_iSCSITargetDeviceList {
440fcf3ce44SJohn Forte 	uint32_t		tl_vers,			/* In */
441fcf3ce44SJohn Forte 				tl_in_cnt,			/* In */
442fcf3ce44SJohn Forte 				tl_tgt_list_type,		/* In */
443fcf3ce44SJohn Forte 				tl_out_cnt,			/* Out */
444fcf3ce44SJohn Forte 				tl_oid_list[1];			/* Out */
445fcf3ce44SJohn Forte } iscsi_target_list_t;
446fcf3ce44SJohn Forte 
447fcf3ce44SJohn Forte typedef struct	_iSCSIStaticTargetProperties {
448fcf3ce44SJohn Forte 	uint32_t		p_vers,				/* In */
449fcf3ce44SJohn Forte 				p_oid;				/* In */
450fcf3ce44SJohn Forte 	uchar_t			p_name[ISCSI_MAX_NAME_LEN];	/* Out */
451fcf3ce44SJohn Forte 	uint_t			p_name_len;			/* Out */
452fcf3ce44SJohn Forte 	iscsi_addr_list_t	p_addr_list;			/* Out */
453fcf3ce44SJohn Forte } iscsi_static_property_t;
454fcf3ce44SJohn Forte 
455fcf3ce44SJohn Forte typedef enum iscsi_lun_status {
456fcf3ce44SJohn Forte 	LunValid, LunDoesNotExist
457fcf3ce44SJohn Forte } iscsi_lun_status_t;
458fcf3ce44SJohn Forte 
459fcf3ce44SJohn Forte /*
460fcf3ce44SJohn Forte  * SCSI inquiry vendor and product identifier buffer length - these values are
461fcf3ce44SJohn Forte  * defined by the identifier length plus 1 byte for the
462fcf3ce44SJohn Forte  * null termination.
463fcf3ce44SJohn Forte  */
464fcf3ce44SJohn Forte #define	ISCSI_INQ_VID_BUF_LEN		9	/* 8 byte ID */
465fcf3ce44SJohn Forte #define	ISCSI_INQ_PID_BUF_LEN		17	/* 16 byte ID */
466fcf3ce44SJohn Forte 
467fcf3ce44SJohn Forte typedef struct iscsi_lun_props {
468fcf3ce44SJohn Forte 	uint32_t		lp_vers,			/* In */
469fcf3ce44SJohn Forte 				lp_tgt_oid,			/* In */
470fcf3ce44SJohn Forte 				lp_oid,				/* In */
471fcf3ce44SJohn Forte 				lp_num,				/* Out */
472fcf3ce44SJohn Forte 				lp_status;			/* Out */
473fcf3ce44SJohn Forte 	char			lp_pathname[MAXPATHLEN],	/* Out */
474fcf3ce44SJohn Forte 				lp_vid[ISCSI_INQ_VID_BUF_LEN],	/* Out */
475fcf3ce44SJohn Forte 				lp_pid[ISCSI_INQ_PID_BUF_LEN];	/* Out */
476fcf3ce44SJohn Forte 	time_t			lp_time_online;			/* Out */
477fcf3ce44SJohn Forte } iscsi_lun_props_t;
478fcf3ce44SJohn Forte 
479fcf3ce44SJohn Forte typedef struct iscsi_if_lun {
480fcf3ce44SJohn Forte 	uint32_t		l_tgt_oid,
481fcf3ce44SJohn Forte 				l_oid,
482fcf3ce44SJohn Forte 				l_num;
483fcf3ce44SJohn Forte } iscsi_if_lun_t;
484fcf3ce44SJohn Forte 
485fcf3ce44SJohn Forte typedef struct iscsi_lun_list {
486fcf3ce44SJohn Forte 	uint32_t		ll_vers;			/* In */
487fcf3ce44SJohn Forte 	boolean_t		ll_all_tgts;			/* In */
488fcf3ce44SJohn Forte 	uint32_t		ll_tgt_oid,			/* In */
489fcf3ce44SJohn Forte 				ll_in_cnt,			/* In */
490fcf3ce44SJohn Forte 				ll_out_cnt;			/* Out */
491fcf3ce44SJohn Forte 	iscsi_if_lun_t		ll_luns[1];			/* Out */
492fcf3ce44SJohn Forte } iscsi_lun_list_t;
493fcf3ce44SJohn Forte 
494fcf3ce44SJohn Forte typedef struct iscsi_conn_props {
495fcf3ce44SJohn Forte 	uint32_t		cp_vers,			/* In */
496fcf3ce44SJohn Forte 				cp_oid,				/* In */
497fcf3ce44SJohn Forte 				cp_cid,				/* In */
498fcf3ce44SJohn Forte 				cp_sess_oid;			/* In */
499fcf3ce44SJohn Forte 	union {
500fcf3ce44SJohn Forte 		struct	sockaddr_in	soa4;
501fcf3ce44SJohn Forte 		struct	sockaddr_in6	soa6;
502fcf3ce44SJohn Forte 	} cp_local;						/* Out */
503fcf3ce44SJohn Forte 	union {
504fcf3ce44SJohn Forte 		struct	sockaddr_in	soa4;
505fcf3ce44SJohn Forte 		struct	sockaddr_in6	soa6;
506fcf3ce44SJohn Forte 	} cp_peer;						/* Out */
507fcf3ce44SJohn Forte 
508fcf3ce44SJohn Forte 
509fcf3ce44SJohn Forte 	iscsi_login_params_t 	cp_params;
510fcf3ce44SJohn Forte 	boolean_t 		cp_params_valid;
511fcf3ce44SJohn Forte 
512fcf3ce44SJohn Forte } iscsi_conn_props_t;
513fcf3ce44SJohn Forte 
514fcf3ce44SJohn Forte typedef struct iscsi_if_conn {
515fcf3ce44SJohn Forte 	uint32_t		c_sess_oid,
516fcf3ce44SJohn Forte 				c_oid,
517fcf3ce44SJohn Forte 				c_cid;
518fcf3ce44SJohn Forte } iscsi_if_conn_t;
519fcf3ce44SJohn Forte 
520fcf3ce44SJohn Forte typedef struct iscsi_conn_list {
521fcf3ce44SJohn Forte 	uint32_t		cl_vers;			/* In */
522fcf3ce44SJohn Forte 	boolean_t		cl_all_sess;			/* In */
523fcf3ce44SJohn Forte 	uint32_t		cl_sess_oid,			/* In */
524fcf3ce44SJohn Forte 				cl_in_cnt,			/* In */
525fcf3ce44SJohn Forte 				cl_out_cnt;			/* Out */
526fcf3ce44SJohn Forte 	iscsi_if_conn_t		cl_list[1];			/* Out */
527fcf3ce44SJohn Forte } iscsi_conn_list_t;
528fcf3ce44SJohn Forte 
529fcf3ce44SJohn Forte typedef enum iSNSDiscoveryMethod {
530fcf3ce44SJohn Forte 	iSNSDiscoveryMethodStatic	= 0,
531fcf3ce44SJohn Forte 	iSNSDiscoveryMethodDHCP		= 1,
532fcf3ce44SJohn Forte 	iSNSDiscoveryMethodSLP		= 2
533fcf3ce44SJohn Forte } isns_method_t;
534fcf3ce44SJohn Forte 
535fcf3ce44SJohn Forte typedef struct iSCSIDiscoveryProperties {
536fcf3ce44SJohn Forte 	uint32_t		vers;
537fcf3ce44SJohn Forte 	boolean_t		iSNSDiscoverySettable;
538fcf3ce44SJohn Forte 	boolean_t		iSNSDiscoveryEnabled;
539fcf3ce44SJohn Forte 	isns_method_t		iSNSDiscoveryMethod;
540fcf3ce44SJohn Forte 	unsigned char		iSNSDomainName[256];
541fcf3ce44SJohn Forte 	boolean_t		SLPDiscoverySettable;
542fcf3ce44SJohn Forte 	boolean_t		SLPDiscoveryEnabled;
543fcf3ce44SJohn Forte 	boolean_t		StaticDiscoverySettable;
544fcf3ce44SJohn Forte 	boolean_t		StaticDiscoveryEnabled;
545fcf3ce44SJohn Forte 	boolean_t		SendTargetsDiscoverySettable;
546fcf3ce44SJohn Forte 	boolean_t		SendTargetsDiscoveryEnabled;
547fcf3ce44SJohn Forte } iSCSIDiscoveryProperties_t;
548fcf3ce44SJohn Forte 
549fcf3ce44SJohn Forte typedef struct iscsi_uscsi {
550fcf3ce44SJohn Forte 	uint32_t		iu_vers;
551fcf3ce44SJohn Forte 	uint32_t		iu_oid;
552fcf3ce44SJohn Forte 	int			iu_tpgt;
553fcf3ce44SJohn Forte 	uint32_t		iu_len;
554fcf3ce44SJohn Forte 	uint32_t		iu_lun;
555fcf3ce44SJohn Forte 	struct uscsi_cmd	iu_ucmd;
556fcf3ce44SJohn Forte } iscsi_uscsi_t;
557fcf3ce44SJohn Forte 
558fcf3ce44SJohn Forte #if defined(_SYSCALL32)
559fcf3ce44SJohn Forte typedef struct iscsi_uscsi32 {
560fcf3ce44SJohn Forte 	uint32_t		iu_vers;
561fcf3ce44SJohn Forte 	uint32_t		iu_oid;
562fcf3ce44SJohn Forte 	int			iu_tpgt;
563fcf3ce44SJohn Forte 	uint32_t		iu_len;
564fcf3ce44SJohn Forte 	uint32_t		iu_lun;
565fcf3ce44SJohn Forte 	struct uscsi_cmd32	iu_ucmd;
566fcf3ce44SJohn Forte } iscsi_uscsi32_t;
567fcf3ce44SJohn Forte #endif /* _SYSCALL32 */
568fcf3ce44SJohn Forte 
569fcf3ce44SJohn Forte typedef struct iscsi_sendtgts_entry {
570fcf3ce44SJohn Forte 	/* ---- Node name, NULL terminated UTF-8 string ---- */
571fcf3ce44SJohn Forte 	uchar_t			ste_name[ISCSI_MAX_NAME_LEN];
572fcf3ce44SJohn Forte 
573fcf3ce44SJohn Forte 	iscsi_addr_t		ste_ipaddr;
574fcf3ce44SJohn Forte 	int			ste_tpgt;
575fcf3ce44SJohn Forte } iscsi_sendtgts_entry_t;
576fcf3ce44SJohn Forte 
577fcf3ce44SJohn Forte typedef struct iscsi_sendtgts_list {
578fcf3ce44SJohn Forte 	entry_t			stl_entry;			/* In */
579fcf3ce44SJohn Forte 	uint32_t		stl_in_cnt,			/* In */
580fcf3ce44SJohn Forte 				stl_out_cnt;			/* Out */
581fcf3ce44SJohn Forte 	iscsi_sendtgts_entry_t	stl_list[1];			/* Out */
582fcf3ce44SJohn Forte } iscsi_sendtgts_list_t;
583fcf3ce44SJohn Forte 
584fcf3ce44SJohn Forte typedef struct iscsi_statictgt_entry {
585fcf3ce44SJohn Forte 	entry_t			te_entry;			/* In */
586fcf3ce44SJohn Forte 	uchar_t			te_name[ISCSI_MAX_NAME_LEN];	/* In */
587fcf3ce44SJohn Forte } iscsi_target_entry_t;
588fcf3ce44SJohn Forte 
589fcf3ce44SJohn Forte /* iSNS Draft - section 4.1.1. */
590fcf3ce44SJohn Forte typedef struct isns_portal_group {
591fcf3ce44SJohn Forte 	uint8_t pg_iscsi_name[ISCSI_MAX_NAME_LEN];
592fcf3ce44SJohn Forte 	union {
593fcf3ce44SJohn Forte 		in_addr_t	u_ip4;
594fcf3ce44SJohn Forte 		in6_addr_t	u_ip6;
595fcf3ce44SJohn Forte 	} pg_ip_addr;
596fcf3ce44SJohn Forte 	int	insize;
597fcf3ce44SJohn Forte 
598fcf3ce44SJohn Forte 	in_port_t pg_port;
599fcf3ce44SJohn Forte 	uint16_t pg_tag;
600fcf3ce44SJohn Forte 
601fcf3ce44SJohn Forte 	iscsi_ipaddr_t	isns_server_ip;
602fcf3ce44SJohn Forte 	uint32_t	isns_server_port;
603fcf3ce44SJohn Forte } isns_portal_group_t;
604fcf3ce44SJohn Forte 
605fcf3ce44SJohn Forte typedef struct isns_portal_group_list {
606fcf3ce44SJohn Forte 	uint32_t		pg_in_cnt,
607fcf3ce44SJohn Forte 				pg_out_cnt;
608fcf3ce44SJohn Forte 	isns_portal_group_t	pg_list[1];
609fcf3ce44SJohn Forte } isns_portal_group_list_t;
610fcf3ce44SJohn Forte 
611fcf3ce44SJohn Forte typedef struct isns_server_portal_group_list {
612fcf3ce44SJohn Forte 	iscsi_addr_t		    addr;
613fcf3ce44SJohn Forte 	isns_portal_group_list_t    addr_port_list;
614fcf3ce44SJohn Forte } isns_server_portal_group_list_t;
615fcf3ce44SJohn Forte 
616fcf3ce44SJohn Forte #define	ISCSI_MIN_CONFIG_SESSIONS	1
617fcf3ce44SJohn Forte /* lowered max config sessions due to ct_power_cnt >= 0 assert */
618fcf3ce44SJohn Forte #define	ISCSI_MAX_CONFIG_SESSIONS	4
619fcf3ce44SJohn Forte 
620fcf3ce44SJohn Forte typedef struct iscsi_config_sess {
621fcf3ce44SJohn Forte 	uint32_t	ics_ver;
622fcf3ce44SJohn Forte 	uint32_t	ics_oid;
623fcf3ce44SJohn Forte 	boolean_t	ics_bound;
624fcf3ce44SJohn Forte 	uint_t		ics_in;
625fcf3ce44SJohn Forte 	uint_t		ics_out;
626fcf3ce44SJohn Forte 	iscsi_ipaddr_t	ics_bindings[1];
627fcf3ce44SJohn Forte } iscsi_config_sess_t;
628fcf3ce44SJohn Forte 
629*904e51f6SJack Meng /* iscsi re-enumeration */
630*904e51f6SJack Meng typedef struct iscsi_reen {
631*904e51f6SJack Meng 	uint32_t	re_ver;
632*904e51f6SJack Meng 	uint32_t	re_oid;
633*904e51f6SJack Meng } iscsi_reen_t;
634*904e51f6SJack Meng 
6356cefaae1SJack Meng /* iscsi booting prop */
636*904e51f6SJack Meng typedef struct iscsi_boot_property {
6376cefaae1SJack Meng 	node_name_t	ini_name;
6386cefaae1SJack Meng 	node_name_t	tgt_name;
6396cefaae1SJack Meng 	iscsi_auth_props_t	auth;
6406cefaae1SJack Meng 	iscsi_chap_props_t	ini_chap;
6416cefaae1SJack Meng 	iscsi_chap_props_t	tgt_chap;
6426cefaae1SJack Meng 	int iscsiboot;
6436cefaae1SJack Meng 	boolean_t hba_mpxio_enabled;
6446cefaae1SJack Meng } iscsi_boot_property_t;
6456cefaae1SJack Meng 
646fcf3ce44SJohn Forte #define	ISCSI_SESSION_CONFIG_SIZE(SIZE)		\
647fcf3ce44SJohn Forte 	(sizeof (iscsi_config_sess_t) +		\
648fcf3ce44SJohn Forte 	((SIZE - 1) * sizeof (iscsi_ipaddr_t)))
649fcf3ce44SJohn Forte 
650fcf3ce44SJohn Forte /*
651fcf3ce44SJohn Forte  * Event class and subclass information
652fcf3ce44SJohn Forte  */
653fcf3ce44SJohn Forte #define	EC_ISCSI			"EC_iSCSI"
654fcf3ce44SJohn Forte #define	ESC_ISCSI_STATIC_START		"ESC_static_start"
655fcf3ce44SJohn Forte #define	ESC_ISCSI_STATIC_END		"ESC_static_end"
656fcf3ce44SJohn Forte #define	ESC_ISCSI_SEND_TARGETS_START	"ESC_send_targets_start"
657fcf3ce44SJohn Forte #define	ESC_ISCSI_SEND_TARGETS_END	"ESC_send_targets_end"
658fcf3ce44SJohn Forte #define	ESC_ISCSI_SLP_START		"ESC_slp_start"
659fcf3ce44SJohn Forte #define	ESC_ISCSI_SLP_END		"ESC_slp_end"
660fcf3ce44SJohn Forte #define	ESC_ISCSI_ISNS_START		"ESC_isns_start"
661fcf3ce44SJohn Forte #define	ESC_ISCSI_ISNS_END		"ESC_isns_end"
662fcf3ce44SJohn Forte #define	ESC_ISCSI_PROP_CHANGE		"ESC_prop_change"
663fcf3ce44SJohn Forte 
664fcf3ce44SJohn Forte #ifdef _KERNEL
665fcf3ce44SJohn Forte /* ---- iscsi_utils.c ---- */
666fcf3ce44SJohn Forte extern int		iscsid_open(char *, int, int);
667fcf3ce44SJohn Forte extern int		iscsid_close(int);
668fcf3ce44SJohn Forte extern int		iscsid_remove(char *filename);
669fcf3ce44SJohn Forte extern int		iscsid_rename(char *oldname, char *newname);
670fcf3ce44SJohn Forte extern ssize_t		iscsid_write(int, void *, ssize_t);
671fcf3ce44SJohn Forte extern ssize_t		iscsid_read(int, void *, ssize_t);
672fcf3ce44SJohn Forte extern ssize_t		iscsid_sendto(struct sonode *, void *, size_t,
673fcf3ce44SJohn Forte     struct sockaddr *, socklen_t);
674fcf3ce44SJohn Forte extern ssize_t		iscsid_recvfrom(struct sonode *, void *buffer,
675fcf3ce44SJohn Forte     size_t len);
676fcf3ce44SJohn Forte extern int		iscsid_errno;
677fcf3ce44SJohn Forte #endif
678fcf3ce44SJohn Forte 
679fcf3ce44SJohn Forte /*
680fcf3ce44SJohn Forte  * Function prototypes for those routines found in the common code
681fcf3ce44SJohn Forte  */
682fcf3ce44SJohn Forte /* ---- utils.c ---- */
683fcf3ce44SJohn Forte extern boolean_t	utils_iqn_create(char *, int);
684fcf3ce44SJohn Forte extern char		*prt_bitmap(int, char *, char *, int);
685fcf3ce44SJohn Forte extern char		*utils_map_param(int);
686fcf3ce44SJohn Forte extern boolean_t	parse_addr_port_tpgt(char *in, char **addr,
687fcf3ce44SJohn Forte 			    int *type, char **port, char **tpgt);
688fcf3ce44SJohn Forte 
689fcf3ce44SJohn Forte #ifdef __cplusplus
690fcf3ce44SJohn Forte }
691fcf3ce44SJohn Forte #endif
692fcf3ce44SJohn Forte 
693fcf3ce44SJohn Forte #endif /* _ISCSI_IF_H */
694