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