17836SJohn.Forte@Sun.COM /* 27836SJohn.Forte@Sun.COM * CDDL HEADER START 37836SJohn.Forte@Sun.COM * 47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 77836SJohn.Forte@Sun.COM * 87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 117836SJohn.Forte@Sun.COM * and limitations under the License. 127836SJohn.Forte@Sun.COM * 137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187836SJohn.Forte@Sun.COM * 197836SJohn.Forte@Sun.COM * CDDL HEADER END 207836SJohn.Forte@Sun.COM */ 217836SJohn.Forte@Sun.COM /* 228656SPeter.Dunlap@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237836SJohn.Forte@Sun.COM * Use is subject to license terms. 247836SJohn.Forte@Sun.COM */ 257836SJohn.Forte@Sun.COM 267836SJohn.Forte@Sun.COM #ifndef _ISCSIADM_H 277836SJohn.Forte@Sun.COM #define _ISCSIADM_H 287836SJohn.Forte@Sun.COM 297836SJohn.Forte@Sun.COM #ifdef __cplusplus 307836SJohn.Forte@Sun.COM extern "C" { 317836SJohn.Forte@Sun.COM #endif 327836SJohn.Forte@Sun.COM 338656SPeter.Dunlap@Sun.COM #include <sys/iscsi_protocol.h> 347836SJohn.Forte@Sun.COM #include <sys/scsi/adapters/iscsi_if.h> 357836SJohn.Forte@Sun.COM #include <ima.h> 367836SJohn.Forte@Sun.COM 377836SJohn.Forte@Sun.COM #include <cmdparse.h> 387836SJohn.Forte@Sun.COM 397836SJohn.Forte@Sun.COM #define ADD SUBCOMMAND(0) 407836SJohn.Forte@Sun.COM #define LIST SUBCOMMAND(1) 417836SJohn.Forte@Sun.COM #define MODIFY SUBCOMMAND(2) 427836SJohn.Forte@Sun.COM #define REMOVE SUBCOMMAND(3) 437836SJohn.Forte@Sun.COM 447836SJohn.Forte@Sun.COM #define TARGET OBJECT(0) 457836SJohn.Forte@Sun.COM #define NODE OBJECT(1) 467836SJohn.Forte@Sun.COM #define INITIATOR OBJECT(2) 477836SJohn.Forte@Sun.COM #define STATIC_CONFIG OBJECT(3) 487836SJohn.Forte@Sun.COM #define DISCOVERY_ADDRESS OBJECT(4) 497836SJohn.Forte@Sun.COM #define DISCOVERY OBJECT(5) 507836SJohn.Forte@Sun.COM #define TARGET_PARAM OBJECT(6) 517836SJohn.Forte@Sun.COM #define ISNS_SERVER_ADDRESS OBJECT(7) 527836SJohn.Forte@Sun.COM 537836SJohn.Forte@Sun.COM #define DATA_SEQ_IN_ORDER 0x01 547836SJohn.Forte@Sun.COM #define DEFAULT_TIME_2_RETAIN 0x02 557836SJohn.Forte@Sun.COM #define DEFAULT_TIME_2_WAIT 0x03 567836SJohn.Forte@Sun.COM #define FIRST_BURST_LENGTH 0x04 577836SJohn.Forte@Sun.COM #define IMMEDIATE_DATA 0x05 587836SJohn.Forte@Sun.COM #define INITIAL_R2T 0x06 597836SJohn.Forte@Sun.COM #define MAX_BURST_LENGTH 0x07 607836SJohn.Forte@Sun.COM #define DATA_PDU_IN_ORDER 0x08 617836SJohn.Forte@Sun.COM #define MAX_OUTSTANDING_R2T 0x09 627836SJohn.Forte@Sun.COM #define MAX_RECV_DATA_SEG_LEN 0x0a 637836SJohn.Forte@Sun.COM #define HEADER_DIGEST 0x0b 647836SJohn.Forte@Sun.COM #define DATA_DIGEST 0x0c 657836SJohn.Forte@Sun.COM #define MAX_CONNECTIONS 0x0d 667836SJohn.Forte@Sun.COM #define ERROR_RECOVERY_LEVEL 0x0e 67*10156SZhang.Yi@Sun.COM #define RECV_LOGIN_RSP_TIMEOUT 0x0f 68*10156SZhang.Yi@Sun.COM #define CONN_LOGIN_MAX 0x10 69*10156SZhang.Yi@Sun.COM #define POLLING_LOGIN_DELAY 0x11 707836SJohn.Forte@Sun.COM 717836SJohn.Forte@Sun.COM #define AUTH_NAME 0x01 727836SJohn.Forte@Sun.COM #define AUTH_PASSWORD 0x02 737836SJohn.Forte@Sun.COM 747836SJohn.Forte@Sun.COM #define ISCSIADM_ARG_ENABLE "enable" 757836SJohn.Forte@Sun.COM #define ISCSIADM_ARG_DISABLE "disable" 767836SJohn.Forte@Sun.COM /* 777836SJohn.Forte@Sun.COM * This object type is not defined by IMA. 787836SJohn.Forte@Sun.COM */ 797836SJohn.Forte@Sun.COM #define SUN_IMA_OBJECT_TYPE_CONN 13 /* Currently not defined in IMA */ 807836SJohn.Forte@Sun.COM #define SUN_IMA_NODE_ALIAS_LEN 256 817836SJohn.Forte@Sun.COM 827836SJohn.Forte@Sun.COM #define MAKE_IMA_ERROR(x) ((IMA_STATUS)(IMA_STATUS_ERROR | (x))) 837836SJohn.Forte@Sun.COM #define SUN_IMA_SYSTEM_ERROR(status) (((IMA_STATUS)(status) & \ 847836SJohn.Forte@Sun.COM (IMA_STATUS)SUN_IMA_ERROR_SYSTEM_ERROR) == 0x8FFF0000 \ 857836SJohn.Forte@Sun.COM ? IMA_TRUE : IMA_FALSE) 867836SJohn.Forte@Sun.COM #define SUN_GET_SYSTEM_ERROR(x) (((IMA_STATUS)(x) & 0x0000FFFF)) 877836SJohn.Forte@Sun.COM #define SUN_IMA_ERROR_SYSTEM_ERROR MAKE_IMA_ERROR(0x0fff0000) 887836SJohn.Forte@Sun.COM 897836SJohn.Forte@Sun.COM typedef struct _parameterTbl { 907836SJohn.Forte@Sun.COM char *name; 917836SJohn.Forte@Sun.COM int val; 927836SJohn.Forte@Sun.COM } parameterTbl_t; 937836SJohn.Forte@Sun.COM 947836SJohn.Forte@Sun.COM /* 957836SJohn.Forte@Sun.COM * The following interfaces are not defined in IMA 1.1. Some of them 967836SJohn.Forte@Sun.COM * are requirement candidates for the next IMA release. 977836SJohn.Forte@Sun.COM */ 987836SJohn.Forte@Sun.COM 997836SJohn.Forte@Sun.COM #define SUN_IMA_MAX_DIGEST_ALGORITHMS 2 /* NONE and CRC 32 */ 1007836SJohn.Forte@Sun.COM #define SUN_IMA_IP_ADDRESS_PORT_LEN 256 1017836SJohn.Forte@Sun.COM #define SUN_IMA_MAX_RADIUS_SECRET_LEN 128 1027836SJohn.Forte@Sun.COM 1037836SJohn.Forte@Sun.COM /* Currently not defined in IMA_TARGET_DISCOVERY_METHOD enum */ 1047836SJohn.Forte@Sun.COM #define IMA_TARGET_DISCOVERY_METHOD_UNKNOWN 0 1057836SJohn.Forte@Sun.COM 1067836SJohn.Forte@Sun.COM typedef enum 1077836SJohn.Forte@Sun.COM { 1087836SJohn.Forte@Sun.COM SUN_IMA_DIGEST_NONE = 0, 1097836SJohn.Forte@Sun.COM SUN_IMA_DIGEST_CRC32 = 1 1107836SJohn.Forte@Sun.COM } SUN_IMA_DIGEST_ALGORITHM; 1117836SJohn.Forte@Sun.COM 1127836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_DIGEST_ALGORITHM_VALUE 1137836SJohn.Forte@Sun.COM { 1147836SJohn.Forte@Sun.COM IMA_UINT defaultAlgorithmCount; 1157836SJohn.Forte@Sun.COM SUN_IMA_DIGEST_ALGORITHM defaultAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 1167836SJohn.Forte@Sun.COM 1177836SJohn.Forte@Sun.COM IMA_BOOL currentValid; 1187836SJohn.Forte@Sun.COM IMA_UINT currentAlgorithmCount; 1197836SJohn.Forte@Sun.COM SUN_IMA_DIGEST_ALGORITHM currentAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 1207836SJohn.Forte@Sun.COM 1217836SJohn.Forte@Sun.COM IMA_BOOL negotiatedValid; 1227836SJohn.Forte@Sun.COM IMA_UINT negotiatedAlgorithmCount; 1237836SJohn.Forte@Sun.COM SUN_IMA_DIGEST_ALGORITHM 1247836SJohn.Forte@Sun.COM negotiatedAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 1257836SJohn.Forte@Sun.COM } SUN_IMA_DIGEST_ALGORITHM_VALUE; 1267836SJohn.Forte@Sun.COM 1277836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_DISC_ADDR_PROP_LIST 1287836SJohn.Forte@Sun.COM { 1297836SJohn.Forte@Sun.COM IMA_UINT discAddrCount; 1307836SJohn.Forte@Sun.COM IMA_DISCOVERY_ADDRESS_PROPERTIES props[1]; 1317836SJohn.Forte@Sun.COM } SUN_IMA_DISC_ADDR_PROP_LIST; 1327836SJohn.Forte@Sun.COM 1337836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_RADIUS_CONFIG 1347836SJohn.Forte@Sun.COM { 1357836SJohn.Forte@Sun.COM char hostnameIpAddress[SUN_IMA_IP_ADDRESS_PORT_LEN]; 1367836SJohn.Forte@Sun.COM IMA_BOOL isIpv6; 1377836SJohn.Forte@Sun.COM IMA_UINT16 port; 1387836SJohn.Forte@Sun.COM IMA_BOOL sharedSecretValid; 1397836SJohn.Forte@Sun.COM IMA_UINT sharedSecretLength; 1407836SJohn.Forte@Sun.COM IMA_BYTE sharedSecret[SUN_IMA_MAX_RADIUS_SECRET_LEN]; 1417836SJohn.Forte@Sun.COM } SUN_IMA_RADIUS_CONFIG; 1427836SJohn.Forte@Sun.COM 1437836SJohn.Forte@Sun.COM 1447836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_DISC_ADDRESS_KEY 1457836SJohn.Forte@Sun.COM { 1467836SJohn.Forte@Sun.COM IMA_NODE_NAME name; 1477836SJohn.Forte@Sun.COM IMA_ADDRESS_KEY address; 1487836SJohn.Forte@Sun.COM IMA_UINT16 tpgt; 1497836SJohn.Forte@Sun.COM } SUN_IMA_DISC_ADDRESS_KEY; 1507836SJohn.Forte@Sun.COM 1517836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES 1527836SJohn.Forte@Sun.COM { 1537836SJohn.Forte@Sun.COM IMA_UINT keyCount; 1547836SJohn.Forte@Sun.COM SUN_IMA_DISC_ADDRESS_KEY keys[1]; 1557836SJohn.Forte@Sun.COM } SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES; 1567836SJohn.Forte@Sun.COM 1577836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_TARGET_ADDRESS 1587836SJohn.Forte@Sun.COM { 1597836SJohn.Forte@Sun.COM IMA_TARGET_ADDRESS imaStruct; 1607836SJohn.Forte@Sun.COM IMA_BOOL defaultTpgt; /* If true, tpgt becomes irrelvant */ 1617836SJohn.Forte@Sun.COM IMA_UINT16 tpgt; 1627836SJohn.Forte@Sun.COM } SUN_IMA_TARGET_ADDRESS; 1637836SJohn.Forte@Sun.COM 1647836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_STATIC_DISCOVERY_TARGET 1657836SJohn.Forte@Sun.COM { 1667836SJohn.Forte@Sun.COM IMA_NODE_NAME targetName; 1677836SJohn.Forte@Sun.COM SUN_IMA_TARGET_ADDRESS targetAddress; 1687836SJohn.Forte@Sun.COM } SUN_IMA_STATIC_DISCOVERY_TARGET; 1697836SJohn.Forte@Sun.COM 1707836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_STATIC_DISCOVERY_TARGET_PROPERTIES 1717836SJohn.Forte@Sun.COM { 1727836SJohn.Forte@Sun.COM IMA_OID associatedNodeOid; 1737836SJohn.Forte@Sun.COM IMA_OID associatedLhbaOid; 1747836SJohn.Forte@Sun.COM SUN_IMA_STATIC_DISCOVERY_TARGET staticTarget; 1757836SJohn.Forte@Sun.COM } SUN_IMA_STATIC_DISCOVERY_TARGET_PROPERTIES; 1767836SJohn.Forte@Sun.COM 1777836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_CONN_PROPERTIES { 1787836SJohn.Forte@Sun.COM IMA_UINT32 connectionID; 1797836SJohn.Forte@Sun.COM IMA_ADDRESS_KEY local; 1807836SJohn.Forte@Sun.COM IMA_ADDRESS_KEY peer; 1817836SJohn.Forte@Sun.COM 1827836SJohn.Forte@Sun.COM IMA_BOOL valuesValid; 1837836SJohn.Forte@Sun.COM IMA_UINT32 defaultTime2Retain; 1847836SJohn.Forte@Sun.COM IMA_UINT32 defaultTime2Wait; 1857836SJohn.Forte@Sun.COM IMA_UINT32 errorRecoveryLevel; 1867836SJohn.Forte@Sun.COM IMA_UINT32 firstBurstLength; 1877836SJohn.Forte@Sun.COM IMA_UINT32 maxBurstLength; 1887836SJohn.Forte@Sun.COM IMA_UINT32 maxConnections; 1897836SJohn.Forte@Sun.COM IMA_UINT32 maxOutstandingR2T; 1907836SJohn.Forte@Sun.COM IMA_UINT32 maxRecvDataSegmentLength; 1917836SJohn.Forte@Sun.COM 1927836SJohn.Forte@Sun.COM IMA_BOOL dataPduInOrder; 1937836SJohn.Forte@Sun.COM IMA_BOOL dataSequenceInOrder; 1947836SJohn.Forte@Sun.COM IMA_BOOL immediateData; 1957836SJohn.Forte@Sun.COM IMA_BOOL initialR2T; 1967836SJohn.Forte@Sun.COM 1977836SJohn.Forte@Sun.COM IMA_UINT headerDigest; 1987836SJohn.Forte@Sun.COM IMA_UINT dataDigest; 1997836SJohn.Forte@Sun.COM 2007836SJohn.Forte@Sun.COM } SUN_IMA_CONN_PROPERTIES; 2017836SJohn.Forte@Sun.COM 2027836SJohn.Forte@Sun.COM 2037836SJohn.Forte@Sun.COM #define SUN_IMA_LU_VENDOR_ID_LEN ISCSI_INQ_VID_BUF_LEN 2047836SJohn.Forte@Sun.COM #define SUN_IMA_LU_PRODUCT_ID_LEN ISCSI_INQ_PID_BUF_LEN 2057836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_LU_PROPERTIES 2067836SJohn.Forte@Sun.COM { 2077836SJohn.Forte@Sun.COM IMA_LU_PROPERTIES imaProps; 2087836SJohn.Forte@Sun.COM IMA_CHAR vendorId[SUN_IMA_LU_VENDOR_ID_LEN]; 2097836SJohn.Forte@Sun.COM IMA_CHAR productId[SUN_IMA_LU_PRODUCT_ID_LEN]; 2107836SJohn.Forte@Sun.COM } SUN_IMA_LU_PROPERTIES; 2117836SJohn.Forte@Sun.COM 2127836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_TARGET_PROPERTIES 2137836SJohn.Forte@Sun.COM { 2147836SJohn.Forte@Sun.COM IMA_TARGET_PROPERTIES imaProps; 2157836SJohn.Forte@Sun.COM IMA_BOOL defaultTpgtConf; /* If true, tpgtConf is irrelevant */ 2167836SJohn.Forte@Sun.COM IMA_UINT16 tpgtConf; 2177836SJohn.Forte@Sun.COM IMA_BOOL defaultTpgtNego; /* If true, tpgtNego is not connected */ 2187836SJohn.Forte@Sun.COM IMA_UINT16 tpgtNego; 2197836SJohn.Forte@Sun.COM IMA_BYTE isid[ISCSI_ISID_LEN]; 2207836SJohn.Forte@Sun.COM } SUN_IMA_TARGET_PROPERTIES; 2217836SJohn.Forte@Sun.COM 2227836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_CONFIG_SESSIONS { 2237836SJohn.Forte@Sun.COM /* True if sessions are bound to an interface */ 2247836SJohn.Forte@Sun.COM IMA_BOOL bound; /* OUT */ 2257836SJohn.Forte@Sun.COM /* 2267836SJohn.Forte@Sun.COM * Memory allocated from caller. In addition 2277836SJohn.Forte@Sun.COM * on a Set this is the number of configured 2287836SJohn.Forte@Sun.COM * sessions. 2297836SJohn.Forte@Sun.COM */ 2307836SJohn.Forte@Sun.COM IMA_UINT in; /* IN */ 2317836SJohn.Forte@Sun.COM /* Number of Configured sessions on Get */ 2327836SJohn.Forte@Sun.COM IMA_UINT out; /* OUT */ 2337836SJohn.Forte@Sun.COM IMA_ADDRESS_KEY bindings[1]; /* IN/OUT */ 2347836SJohn.Forte@Sun.COM } SUN_IMA_CONFIG_SESSIONS; 2357836SJohn.Forte@Sun.COM 2367836SJohn.Forte@Sun.COM typedef struct _SUN_IMA_STATIC_TARGET_PROPERTIES 2377836SJohn.Forte@Sun.COM { 2387836SJohn.Forte@Sun.COM IMA_OID associatedNodeOid; 2397836SJohn.Forte@Sun.COM IMA_OID associatedLhbaOid; 2407836SJohn.Forte@Sun.COM SUN_IMA_STATIC_DISCOVERY_TARGET staticTarget; 2417836SJohn.Forte@Sun.COM } SUN_IMA_STATIC_TARGET_PROPERTIES; 2427836SJohn.Forte@Sun.COM 2437836SJohn.Forte@Sun.COM #ifdef __cplusplus 2447836SJohn.Forte@Sun.COM } 2457836SJohn.Forte@Sun.COM #endif 2467836SJohn.Forte@Sun.COM 2477836SJohn.Forte@Sun.COM #endif /* _ISCSIADM_H */ 248