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