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