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