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 /* 22*1a1a84a3SPeter Dunlap * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte 26fcf3ce44SJohn Forte #ifndef _ISCSIADM_H 27fcf3ce44SJohn Forte #define _ISCSIADM_H 28fcf3ce44SJohn Forte 29fcf3ce44SJohn Forte #ifdef __cplusplus 30fcf3ce44SJohn Forte extern "C" { 31fcf3ce44SJohn Forte #endif 32fcf3ce44SJohn Forte 33*1a1a84a3SPeter Dunlap #include <sys/iscsi_protocol.h> 34fcf3ce44SJohn Forte #include <sys/scsi/adapters/iscsi_if.h> 35fcf3ce44SJohn Forte #include <ima.h> 36fcf3ce44SJohn Forte 37fcf3ce44SJohn Forte #include <cmdparse.h> 38fcf3ce44SJohn Forte 39fcf3ce44SJohn Forte #define ADD SUBCOMMAND(0) 40fcf3ce44SJohn Forte #define LIST SUBCOMMAND(1) 41fcf3ce44SJohn Forte #define MODIFY SUBCOMMAND(2) 42fcf3ce44SJohn Forte #define REMOVE SUBCOMMAND(3) 43fcf3ce44SJohn Forte 44fcf3ce44SJohn Forte #define TARGET OBJECT(0) 45fcf3ce44SJohn Forte #define NODE OBJECT(1) 46fcf3ce44SJohn Forte #define INITIATOR OBJECT(2) 47fcf3ce44SJohn Forte #define STATIC_CONFIG OBJECT(3) 48fcf3ce44SJohn Forte #define DISCOVERY_ADDRESS OBJECT(4) 49fcf3ce44SJohn Forte #define DISCOVERY OBJECT(5) 50fcf3ce44SJohn Forte #define TARGET_PARAM OBJECT(6) 51fcf3ce44SJohn Forte #define ISNS_SERVER_ADDRESS OBJECT(7) 52fcf3ce44SJohn Forte 53fcf3ce44SJohn Forte #define DATA_SEQ_IN_ORDER 0x01 54fcf3ce44SJohn Forte #define DEFAULT_TIME_2_RETAIN 0x02 55fcf3ce44SJohn Forte #define DEFAULT_TIME_2_WAIT 0x03 56fcf3ce44SJohn Forte #define FIRST_BURST_LENGTH 0x04 57fcf3ce44SJohn Forte #define IMMEDIATE_DATA 0x05 58fcf3ce44SJohn Forte #define INITIAL_R2T 0x06 59fcf3ce44SJohn Forte #define MAX_BURST_LENGTH 0x07 60fcf3ce44SJohn Forte #define DATA_PDU_IN_ORDER 0x08 61fcf3ce44SJohn Forte #define MAX_OUTSTANDING_R2T 0x09 62fcf3ce44SJohn Forte #define MAX_RECV_DATA_SEG_LEN 0x0a 63fcf3ce44SJohn Forte #define HEADER_DIGEST 0x0b 64fcf3ce44SJohn Forte #define DATA_DIGEST 0x0c 65fcf3ce44SJohn Forte #define MAX_CONNECTIONS 0x0d 66fcf3ce44SJohn Forte #define ERROR_RECOVERY_LEVEL 0x0e 67fcf3ce44SJohn Forte 68fcf3ce44SJohn Forte #define AUTH_NAME 0x01 69fcf3ce44SJohn Forte #define AUTH_PASSWORD 0x02 70fcf3ce44SJohn Forte 71fcf3ce44SJohn Forte #define ISCSIADM_ARG_ENABLE "enable" 72fcf3ce44SJohn Forte #define ISCSIADM_ARG_DISABLE "disable" 73fcf3ce44SJohn Forte /* 74fcf3ce44SJohn Forte * This object type is not defined by IMA. 75fcf3ce44SJohn Forte */ 76fcf3ce44SJohn Forte #define SUN_IMA_OBJECT_TYPE_CONN 13 /* Currently not defined in IMA */ 77fcf3ce44SJohn Forte #define SUN_IMA_NODE_ALIAS_LEN 256 78fcf3ce44SJohn Forte 79fcf3ce44SJohn Forte #define MAKE_IMA_ERROR(x) ((IMA_STATUS)(IMA_STATUS_ERROR | (x))) 80fcf3ce44SJohn Forte #define SUN_IMA_SYSTEM_ERROR(status) (((IMA_STATUS)(status) & \ 81fcf3ce44SJohn Forte (IMA_STATUS)SUN_IMA_ERROR_SYSTEM_ERROR) == 0x8FFF0000 \ 82fcf3ce44SJohn Forte ? IMA_TRUE : IMA_FALSE) 83fcf3ce44SJohn Forte #define SUN_GET_SYSTEM_ERROR(x) (((IMA_STATUS)(x) & 0x0000FFFF)) 84fcf3ce44SJohn Forte #define SUN_IMA_ERROR_SYSTEM_ERROR MAKE_IMA_ERROR(0x0fff0000) 85fcf3ce44SJohn Forte 86fcf3ce44SJohn Forte typedef struct _parameterTbl { 87fcf3ce44SJohn Forte char *name; 88fcf3ce44SJohn Forte int val; 89fcf3ce44SJohn Forte } parameterTbl_t; 90fcf3ce44SJohn Forte 91fcf3ce44SJohn Forte /* 92fcf3ce44SJohn Forte * The following interfaces are not defined in IMA 1.1. Some of them 93fcf3ce44SJohn Forte * are requirement candidates for the next IMA release. 94fcf3ce44SJohn Forte */ 95fcf3ce44SJohn Forte 96fcf3ce44SJohn Forte #define SUN_IMA_MAX_DIGEST_ALGORITHMS 2 /* NONE and CRC 32 */ 97fcf3ce44SJohn Forte #define SUN_IMA_IP_ADDRESS_PORT_LEN 256 98fcf3ce44SJohn Forte #define SUN_IMA_MAX_RADIUS_SECRET_LEN 128 99fcf3ce44SJohn Forte 100fcf3ce44SJohn Forte /* Currently not defined in IMA_TARGET_DISCOVERY_METHOD enum */ 101fcf3ce44SJohn Forte #define IMA_TARGET_DISCOVERY_METHOD_UNKNOWN 0 102fcf3ce44SJohn Forte 103fcf3ce44SJohn Forte typedef enum 104fcf3ce44SJohn Forte { 105fcf3ce44SJohn Forte SUN_IMA_DIGEST_NONE = 0, 106fcf3ce44SJohn Forte SUN_IMA_DIGEST_CRC32 = 1 107fcf3ce44SJohn Forte } SUN_IMA_DIGEST_ALGORITHM; 108fcf3ce44SJohn Forte 109fcf3ce44SJohn Forte typedef struct _SUN_IMA_DIGEST_ALGORITHM_VALUE 110fcf3ce44SJohn Forte { 111fcf3ce44SJohn Forte IMA_UINT defaultAlgorithmCount; 112fcf3ce44SJohn Forte SUN_IMA_DIGEST_ALGORITHM defaultAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 113fcf3ce44SJohn Forte 114fcf3ce44SJohn Forte IMA_BOOL currentValid; 115fcf3ce44SJohn Forte IMA_UINT currentAlgorithmCount; 116fcf3ce44SJohn Forte SUN_IMA_DIGEST_ALGORITHM currentAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 117fcf3ce44SJohn Forte 118fcf3ce44SJohn Forte IMA_BOOL negotiatedValid; 119fcf3ce44SJohn Forte IMA_UINT negotiatedAlgorithmCount; 120fcf3ce44SJohn Forte SUN_IMA_DIGEST_ALGORITHM 121fcf3ce44SJohn Forte negotiatedAlgorithms[SUN_IMA_MAX_DIGEST_ALGORITHMS]; 122fcf3ce44SJohn Forte } SUN_IMA_DIGEST_ALGORITHM_VALUE; 123fcf3ce44SJohn Forte 124fcf3ce44SJohn Forte typedef struct _SUN_IMA_DISC_ADDR_PROP_LIST 125fcf3ce44SJohn Forte { 126fcf3ce44SJohn Forte IMA_UINT discAddrCount; 127fcf3ce44SJohn Forte IMA_DISCOVERY_ADDRESS_PROPERTIES props[1]; 128fcf3ce44SJohn Forte } SUN_IMA_DISC_ADDR_PROP_LIST; 129fcf3ce44SJohn Forte 130fcf3ce44SJohn Forte typedef struct _SUN_IMA_RADIUS_CONFIG 131fcf3ce44SJohn Forte { 132fcf3ce44SJohn Forte char hostnameIpAddress[SUN_IMA_IP_ADDRESS_PORT_LEN]; 133fcf3ce44SJohn Forte IMA_BOOL isIpv6; 134fcf3ce44SJohn Forte IMA_UINT16 port; 135fcf3ce44SJohn Forte IMA_BOOL sharedSecretValid; 136fcf3ce44SJohn Forte IMA_UINT sharedSecretLength; 137fcf3ce44SJohn Forte IMA_BYTE sharedSecret[SUN_IMA_MAX_RADIUS_SECRET_LEN]; 138fcf3ce44SJohn Forte } SUN_IMA_RADIUS_CONFIG; 139fcf3ce44SJohn Forte 140fcf3ce44SJohn Forte 141fcf3ce44SJohn Forte typedef struct _SUN_IMA_DISC_ADDRESS_KEY 142fcf3ce44SJohn Forte { 143fcf3ce44SJohn Forte IMA_NODE_NAME name; 144fcf3ce44SJohn Forte IMA_ADDRESS_KEY address; 145fcf3ce44SJohn Forte IMA_UINT16 tpgt; 146fcf3ce44SJohn Forte } SUN_IMA_DISC_ADDRESS_KEY; 147fcf3ce44SJohn Forte 148fcf3ce44SJohn Forte typedef struct _SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES 149fcf3ce44SJohn Forte { 150fcf3ce44SJohn Forte IMA_UINT keyCount; 151fcf3ce44SJohn Forte SUN_IMA_DISC_ADDRESS_KEY keys[1]; 152fcf3ce44SJohn Forte } SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES; 153fcf3ce44SJohn Forte 154fcf3ce44SJohn Forte typedef struct _SUN_IMA_TARGET_ADDRESS 155fcf3ce44SJohn Forte { 156fcf3ce44SJohn Forte IMA_TARGET_ADDRESS imaStruct; 157fcf3ce44SJohn Forte IMA_BOOL defaultTpgt; /* If true, tpgt becomes irrelvant */ 158fcf3ce44SJohn Forte IMA_UINT16 tpgt; 159fcf3ce44SJohn Forte } SUN_IMA_TARGET_ADDRESS; 160fcf3ce44SJohn Forte 161fcf3ce44SJohn Forte typedef struct _SUN_IMA_STATIC_DISCOVERY_TARGET 162fcf3ce44SJohn Forte { 163fcf3ce44SJohn Forte IMA_NODE_NAME targetName; 164fcf3ce44SJohn Forte SUN_IMA_TARGET_ADDRESS targetAddress; 165fcf3ce44SJohn Forte } SUN_IMA_STATIC_DISCOVERY_TARGET; 166fcf3ce44SJohn Forte 167fcf3ce44SJohn Forte typedef struct _SUN_IMA_STATIC_DISCOVERY_TARGET_PROPERTIES 168fcf3ce44SJohn Forte { 169fcf3ce44SJohn Forte IMA_OID associatedNodeOid; 170fcf3ce44SJohn Forte IMA_OID associatedLhbaOid; 171fcf3ce44SJohn Forte SUN_IMA_STATIC_DISCOVERY_TARGET staticTarget; 172fcf3ce44SJohn Forte } SUN_IMA_STATIC_DISCOVERY_TARGET_PROPERTIES; 173fcf3ce44SJohn Forte 174fcf3ce44SJohn Forte typedef struct _SUN_IMA_CONN_PROPERTIES { 175fcf3ce44SJohn Forte IMA_UINT32 connectionID; 176fcf3ce44SJohn Forte IMA_ADDRESS_KEY local; 177fcf3ce44SJohn Forte IMA_ADDRESS_KEY peer; 178fcf3ce44SJohn Forte 179fcf3ce44SJohn Forte IMA_BOOL valuesValid; 180fcf3ce44SJohn Forte IMA_UINT32 defaultTime2Retain; 181fcf3ce44SJohn Forte IMA_UINT32 defaultTime2Wait; 182fcf3ce44SJohn Forte IMA_UINT32 errorRecoveryLevel; 183fcf3ce44SJohn Forte IMA_UINT32 firstBurstLength; 184fcf3ce44SJohn Forte IMA_UINT32 maxBurstLength; 185fcf3ce44SJohn Forte IMA_UINT32 maxConnections; 186fcf3ce44SJohn Forte IMA_UINT32 maxOutstandingR2T; 187fcf3ce44SJohn Forte IMA_UINT32 maxRecvDataSegmentLength; 188fcf3ce44SJohn Forte 189fcf3ce44SJohn Forte IMA_BOOL dataPduInOrder; 190fcf3ce44SJohn Forte IMA_BOOL dataSequenceInOrder; 191fcf3ce44SJohn Forte IMA_BOOL immediateData; 192fcf3ce44SJohn Forte IMA_BOOL initialR2T; 193fcf3ce44SJohn Forte 194fcf3ce44SJohn Forte IMA_UINT headerDigest; 195fcf3ce44SJohn Forte IMA_UINT dataDigest; 196fcf3ce44SJohn Forte 197fcf3ce44SJohn Forte } SUN_IMA_CONN_PROPERTIES; 198fcf3ce44SJohn Forte 199fcf3ce44SJohn Forte 200fcf3ce44SJohn Forte #define SUN_IMA_LU_VENDOR_ID_LEN ISCSI_INQ_VID_BUF_LEN 201fcf3ce44SJohn Forte #define SUN_IMA_LU_PRODUCT_ID_LEN ISCSI_INQ_PID_BUF_LEN 202fcf3ce44SJohn Forte typedef struct _SUN_IMA_LU_PROPERTIES 203fcf3ce44SJohn Forte { 204fcf3ce44SJohn Forte IMA_LU_PROPERTIES imaProps; 205fcf3ce44SJohn Forte IMA_CHAR vendorId[SUN_IMA_LU_VENDOR_ID_LEN]; 206fcf3ce44SJohn Forte IMA_CHAR productId[SUN_IMA_LU_PRODUCT_ID_LEN]; 207fcf3ce44SJohn Forte } SUN_IMA_LU_PROPERTIES; 208fcf3ce44SJohn Forte 209fcf3ce44SJohn Forte typedef struct _SUN_IMA_TARGET_PROPERTIES 210fcf3ce44SJohn Forte { 211fcf3ce44SJohn Forte IMA_TARGET_PROPERTIES imaProps; 212fcf3ce44SJohn Forte IMA_BOOL defaultTpgtConf; /* If true, tpgtConf is irrelevant */ 213fcf3ce44SJohn Forte IMA_UINT16 tpgtConf; 214fcf3ce44SJohn Forte IMA_BOOL defaultTpgtNego; /* If true, tpgtNego is not connected */ 215fcf3ce44SJohn Forte IMA_UINT16 tpgtNego; 216fcf3ce44SJohn Forte IMA_BYTE isid[ISCSI_ISID_LEN]; 217fcf3ce44SJohn Forte } SUN_IMA_TARGET_PROPERTIES; 218fcf3ce44SJohn Forte 219fcf3ce44SJohn Forte typedef struct _SUN_IMA_CONFIG_SESSIONS { 220fcf3ce44SJohn Forte /* True if sessions are bound to an interface */ 221fcf3ce44SJohn Forte IMA_BOOL bound; /* OUT */ 222fcf3ce44SJohn Forte /* 223fcf3ce44SJohn Forte * Memory allocated from caller. In addition 224fcf3ce44SJohn Forte * on a Set this is the number of configured 225fcf3ce44SJohn Forte * sessions. 226fcf3ce44SJohn Forte */ 227fcf3ce44SJohn Forte IMA_UINT in; /* IN */ 228fcf3ce44SJohn Forte /* Number of Configured sessions on Get */ 229fcf3ce44SJohn Forte IMA_UINT out; /* OUT */ 230fcf3ce44SJohn Forte IMA_ADDRESS_KEY bindings[1]; /* IN/OUT */ 231fcf3ce44SJohn Forte } SUN_IMA_CONFIG_SESSIONS; 232fcf3ce44SJohn Forte 233fcf3ce44SJohn Forte typedef struct _SUN_IMA_STATIC_TARGET_PROPERTIES 234fcf3ce44SJohn Forte { 235fcf3ce44SJohn Forte IMA_OID associatedNodeOid; 236fcf3ce44SJohn Forte IMA_OID associatedLhbaOid; 237fcf3ce44SJohn Forte SUN_IMA_STATIC_DISCOVERY_TARGET staticTarget; 238fcf3ce44SJohn Forte } SUN_IMA_STATIC_TARGET_PROPERTIES; 239fcf3ce44SJohn Forte 240fcf3ce44SJohn Forte #ifdef __cplusplus 241fcf3ce44SJohn Forte } 242fcf3ce44SJohn Forte #endif 243fcf3ce44SJohn Forte 244fcf3ce44SJohn Forte #endif /* _ISCSIADM_H */ 245