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