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