summaryrefslogtreecommitdiff
path: root/usr/src/lib/libima/common/ima.h
blob: c3119c4a1537e6b692432a4c52e3068c98330c66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/******************************************************************************
 *
 * Description
 *  Ima.h - general header file for client
 *       and library developers
 *
 * License:
 *  The contents of this file are subject to the SNIA Public License
 *  Version 1.0 (the "License"); you may not use this file except in
 *  compliance with the License. You may obtain a copy of the License at
 *
 *  /http://www.snia.org/English/Resources/Code/OpenSource.html
 *
 *  Software distributed under the License is distributed on an "AS IS"
 *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 *  the License for the specific language governing rights and limitations
 *  under the License.
 *
 * The Original Code is  SNIA HBA API and IMA general header file
 *
 * The Initial Developer of the Original Code is:
 *      Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
 *      David Dillard       VERITAS Software        david.dillard@veritas.com
 *
 * Contributor(s):
 *  Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com)
 *  Dave Wysochanski, Network Appliance, Inc. (davidw@netapp.com)
 *
 ******************************************************************************
 *
 *   Changes:
 *  09/24/2003 Initial Draft
 *  (for other changes... see the CVS logs)
 *  12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery().
 *             lower case the computer name as iscsi name in
 *             IMA_GenerateNodeName().
 *  03/01/2004 Brought up to date with respect to IMA v1.0.1; made formatting
 *             changes - lines to 80 cols - for readability.
 *
 *  01/21/2005 Updated to support IMA 1.1.3.
 *****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

#ifndef IMA_H
#define IMA_H

#include <time.h>
#include <wchar.h>


/* Library version string */
#define HBA_LIBVERSION 2

#define	IMA_MAX_CALLBACK_PER_PLUGIN	64
#define IMA_MAX_NUM_PLUGINS		32

/* DLL imports for WIN32 operation */
#ifdef WIN32
#ifdef IMA_EXPORTS
#define IMA_API __declspec(dllexport)
#else
#define IMA_API __declspec(dllimport)
#endif
#else
#define IMA_API
#endif

/* OS specific definitions */

#ifdef WIN32
typedef unsigned char   IMA_UINT8;  // Unsigned  8 bits
typedef char            IMA_INT8;   // Signed    8 bits
typedef unsigned short  IMA_UINT16; // Unsigned 16 bits
typedef short           IMA_INT16;  // Signed   16 bits
typedef unsigned int    IMA_UINT32; // Unsigned 32 bits
typedef int             IMA_INT32;  // Signed   32 bits
typedef void*           IMA_PVOID;  // Pointer  to void
typedef IMA_UINT32      IMA_VOID32; // Opaque   32 bits


/* Don't confuse, _WIN32 with WIN32... OK, how do you accompish that */
#ifdef _WIN32
typedef __int64             IMA_INT64;
typedef unsigned __int64    IMA_UINT64;
#else
typedef struct {
    TN_UINT32   lo_val;
    TN_UINT32   hi_val;
} IMA_INT64;

typedef struct {
    TN_UINT32   lo_val;
    TN_UINT32   hi_val;
} IMA_UINT64;
#endif  /*  #ifdef _WIN32   */


#else

/* Note this section needs to be cleaned up for various Unix platforms */
typedef unsigned char   IMA_UINT8;  /* Unsigned  8 bits */
typedef char            IMA_INT8;   /* Signed    8 bits */
typedef unsigned short  IMA_UINT16; /* Unsigned 16 bits */
typedef short           IMA_INT16;  /* Signed   16 bits */
typedef unsigned int    IMA_UINT32; /* Unsigned 32 bits */
typedef int             IMA_INT32;  /* Signed   32 bits */
typedef void*           IMA_PVOID;  /* Pointer  to void */
typedef IMA_UINT32      IMA_VOID32; /* Opaque   32 bits */
typedef long long       IMA_INT64;
typedef long long       IMA_UINT64;

#endif  /*  #ifdef WIN32 */



/**
*******************************************************************************
*
* Generic IMA Constant Definitions
*
*******************************************************************************
*/
#define RL_LIBRARY_SEQNUM           0
#define RL_SHARED_NODE_SEQNUM       0

/**
* Value which can be assigned to an IMA_BOOL and or an IMA_XBOOL.
*/
#define IMA_TRUE        1

/**
* Value which can be assigned to an IMA_BOOL and or an IMA_XBOOL.
*/
#define IMA_FALSE       0

/**
* Value which can be assigned to an IMA_XBOOL.
*/
#define IMA_UNKNOWN     0xFFFFFFFF



/**
*******************************************************************************
*
* Base IMA Type Definitions
*
* @note Types that have a specific size must be defined ImaOsTypes.h which is
*       an OS specific include file which is included by this file.
*
*******************************************************************************
*/

/**
* A character.
*/
typedef char IMA_CHAR;

/**
* A wide character.
*/
typedef wchar_t IMA_WCHAR;

/**
* An integer.  Spec states this is 32 bits on 32-bit systems, and 64-bit
* on 64-bit systems.
*/
typedef unsigned long IMA_UINT;

/**
* A boolean.
*/
typedef IMA_UINT32 IMA_BOOL;

/**
* An extended boolean: can have the values @ref IMA_TRUE, @ref IMA_FALSE, and
* @ref IMA_UNKNOWN.
*/
typedef IMA_UINT32 IMA_XBOOL;

/**
* A date and time.
*/
typedef struct tm IMA_DATETIME;

typedef unsigned char IMA_BYTE;

/**
*******************************************************************************
*
* Constants and macros declarations related to IMA_STATUS
*
*******************************************************************************
*/
#ifdef SOLARIS
typedef IMA_UINT IMA_STATUS;

#define	IMA_STATUS_SUCCESS		0x00000000
#define	IMA_STATUS_ERROR		0x80000000

#define	IMA_SUCCESS(status) (((IMA_STATUS)(status) & \
	    (IMA_STATUS)IMA_STATUS_ERROR) == 0 ? IMA_TRUE : IMA_FALSE)
#define	IMA_ERROR(status)   (((IMA_STATUS)(status) & \
	    (IMA_STATUS)IMA_STATUS_ERROR) == 0x8000000 ? IMA_TRUE : IMA_FALSE)

#define	MAKE_IMA_STATUS(x)	((IMA_STATUS)(x))
#define	MAKE_IMA_ERROR(x)	((IMA_STATUS)(IMA_STATUS_ERROR | (x)))
#define	GET_SYSTEM_ERROR(x)	(((IMA_STATUS)(x) & 0x0000FFFF))

#define	IMA_STATUS_REBOOT_NECESSARY		MAKE_IMA_STATUS(0x01)
#define	IMA_STATUS_INCONSISTENT_NODE_PROPERTIES	MAKE_IMA_STATUS(0x02)
#define	IMA_STATUS_SCSI_STATUS_CONDITION_MET	MAKE_IMA_STATUS(0x100)

#define	IMA_ERROR_NOT_SUPPORTED			MAKE_IMA_ERROR(0x01)
#define	IMA_ERROR_INSUFFICIENT_MEMORY		MAKE_IMA_ERROR(0x02)
#define	IMA_ERROR_LAST_PRIMARY_DISCOVERY_METHOD	MAKE_IMA_ERROR(0x03)
#define	IMA_ERROR_UNEXPECTED_OS_ERROR		MAKE_IMA_ERROR(0x04)
#define	IMA_ERROR_SYNC_TIMEOUT			MAKE_IMA_ERROR(0x05)
#define	IMA_ERROR_LU_EXPOSED			MAKE_IMA_ERROR(0x06)
#define	IMA_ERROR_LU_NOT_EXPOSED		MAKE_IMA_ERROR(0x07)
#define	IMA_ERROR_LU_IN_USE			MAKE_IMA_ERROR(0x08)
#define	IMA_ERROR_TARGET_TIMEOUT		MAKE_IMA_ERROR(0x09)
#define	IMA_ERROR_LOGIN_REJECTED		MAKE_IMA_ERROR(0x0A)
#define	IMA_ERROR_STATS_COLLECTION_NOT_ENABLED	MAKE_IMA_ERROR(0x0B)
#define	IMA_ERROR_SCSI_STATUS_CHECK_CONDITION	MAKE_IMA_ERROR(0x100)
#define	IMA_ERROR_SCSI_STATUS_BUSY		MAKE_IMA_ERROR(0x101)
#define	IMA_ERROR_SCSI_STATUS_RESERVATION_CONFLICT  	MAKE_IMA_ERROR(0x102)
#define	IMA_ERROR_SCSI_STATUS_TASK_SET_FULL	MAKE_IMA_ERROR(0x103)
#define	IMA_ERROR_SCSI_STATUS_ACA_ACTIVE	MAKE_IMA_ERROR(0x104)
#define	IMA_ERROR_SCSI_STATUS_TASK_ABORTED	MAKE_IMA_ERROR(0x105)
#define	IMA_ERROR_INVALID_PARAMETER		MAKE_IMA_ERROR(0x40000000)
#define	IMA_ERROR_INVALID_OBJECT_TYPE		MAKE_IMA_ERROR(0x40000001)
#define	IMA_ERROR_INCORRECT_OBJECT_TYPE		MAKE_IMA_ERROR(0x40000002)
#define	IMA_ERROR_OBJECT_NOT_FOUND		MAKE_IMA_ERROR(0x40000003)
#define	IMA_ERROR_NAME_TOO_LONG			MAKE_IMA_ERROR(0x40000004)
#define	IMA_ERROR_UNKNOWN_ERROR			MAKE_IMA_ERROR(0x0fffffff)

#else

typedef enum {
    IMA_STATUS_SUCCESS                      = 0x00000000,
    IMA_STATUS_REBOOT_NECESSARY             = 0x00000001,
    IMA_STATUS_INCONSISTENT_NODE_PROPERTIES = 0x00000002,
    IMA_STATUS_SCSI_STATUS_CONDITION_MET    = 0x00000100,

    IMA_STATUS_ERROR                        = 0x80000000,
    IMA_ERROR_NOT_SUPPORTED                 = 0x80000001,
    IMA_ERROR_INSUFFICIENT_MEMORY           = 0x80000002,
    IMA_ERROR_LAST_PRIMARY_DISCOVERY_METHOD = 0x80000003,
    IMA_ERROR_UNEXPECTED_OS_ERROR           = 0x80000004,
    IMA_ERROR_SYNC_TIMEOUT                  = 0x80000005,
    IMA_ERROR_LU_EXPOSED                    = 0x80000006,
    IMA_ERROR_LU_NOT_EXPOSED                = 0x80000007,
    IMA_ERROR_LU_IN_USE                     = 0x80000008,
    IMA_ERROR_TARGET_TIMEOUT                = 0x80000009,
    IMA_ERROR_LOGIN_REJECTED                = 0x8000000A,
    IMA_ERROR_STATS_COLLECTION_NOT_ENABLED  = 0x8000000B,
    IMA_ERROR_SCSI_STATUS_CHECK_CONDITION      = 0x80000100,
    IMA_ERROR_SCSI_STATUS_BUSY                 = 0x80000101,
    IMA_ERROR_SCSI_STATUS_RESERVATION_CONFLICT = 0x80000102,
    IMA_ERROR_SCSI_STATUS_TASK_SET_FULL        = 0x80000103,
    IMA_ERROR_SCSI_STATUS_ACA_ACTIVE           = 0x80000104,
    IMA_ERROR_SCSI_STATUS_TASK_ABORTED         = 0x80000105,
    IMA_ERROR_INVALID_PARAMETER             = 0xC0000000,
    IMA_ERROR_INVALID_OBJECT_TYPE           = 0xC0000001,
    IMA_ERROR_INCORRECT_OBJECT_TYPE         = 0xC0000002,
    IMA_ERROR_OBJECT_NOT_FOUND              = 0xC0000003,
    IMA_ERROR_NAME_TOO_LONG                 = 0xC0000004,
    IMA_ERROR_UNKNOWN_ERROR                 = 0x8FFFFFFF
} IMA_STATUS;

/*
#define IMA_SUCCESS(status)     ( (IMA_UINT32)(status) & \
                                  (IMA_UINT32)IMA_STATUS_ERROR == 0 ? \
                                  IMA_TRUE : IMA_FALSE )
#define IMA_ERROR(status)       ( (IMA_UINT32)(status) & \
                                  (IMA_UINT32)IMA_STATUS_ERROR == 0x8000000 ? \
                                  IMA_TRUE : IMA_FALSE )
*/

#define IMA_SUCCESS(status)							!((status) & IMA_STATUS_ERROR)
#define IMA_ERROR(status)							((status) & IMA_STATUS_ERROR)

#endif

/**
*******************************************************************************
*
* Declaration of the IMA_OBJECT_TYPE enumeration
*
*******************************************************************************
*/
typedef enum
{
    IMA_OBJECT_TYPE_UNKNOWN =   0,
    IMA_OBJECT_TYPE_PLUGIN  =   1,
    IMA_OBJECT_TYPE_NODE    =   2,
    IMA_OBJECT_TYPE_LHBA    =   3,
    IMA_OBJECT_TYPE_PHBA    =   4,
    IMA_OBJECT_TYPE_NETWORK_PORTAL  =   5,
    IMA_OBJECT_TYPE_PORTAL_GROUP    =   6,
    IMA_OBJECT_TYPE_LNP =   7,
    IMA_OBJECT_TYPE_PNP =   8,
    IMA_OBJECT_TYPE_TARGET  =   9,
    IMA_OBJECT_TYPE_LU  =   10,
	IMA_OBJECT_TYPE_DISCOVERY_ADDRESS = 11,
	IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET = 12,
    IMA_OBJECT_TYPE_CONNECTION	=	13,
	IMA_OBJECT_TYPE_SESSION	=	14
} IMA_OBJECT_TYPE;

typedef enum
{
    IMA_ISNS_DISCOVERY_METHOD_STATIC    =   0,
    IMA_ISNS_DISCOVERY_METHOD_DHCP  =   1,
    IMA_ISNS_DISCOVERY_METHOD_SLP   =   2
} IMA_ISNS_DISCOVERY_METHOD;

typedef enum
{
    IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE    =   0,
    IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM  =   1,
    IMA_DOWNLOAD_IMAGE_TYPE_ALL =   2,
	IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE = 3
} IMA_PHBA_DOWNLOAD_IMAGE_TYPE;

typedef enum
{
    IMA_PHBA_STATUS_WORKING =   0,
    IMA_PHBA_STATUS_FAILED  =   1
} IMA_PHBA_STATUS;

typedef enum
{
    IMA_NETWORK_PORT_STATUS_WORKING =   0,
    IMA_NETWORK_PORT_STATUS_DEGRADED    =   1,
    IMA_NETWORK_PORT_STATUS_CRITICAL    =   2,
    IMA_NETWORK_PORT_STATUS_FAILED  =   3,
    IMA_NETWORK_PORT_STATUS_DISCONNECTED    =   4
} IMA_NETWORK_PORT_STATUS;

typedef enum
{
    IMA_TARGET_DISCOVERY_METHOD_STATIC      =   1,
    IMA_TARGET_DISCOVERY_METHOD_SLP     =   2,
    IMA_TARGET_DISCOVERY_METHOD_ISNS        =   4,
    IMA_TARGET_DISCOVERY_METHOD_SENDTARGETS =   8
} IMA_TARGET_DISCOVERY_METHOD;

typedef enum
{
    IMA_AUTHMETHOD_NONE =   0,
    IMA_AUTHMETHOD_CHAP =   1,
    IMA_AUTHMETHOD_SRP  =   2,
    IMA_AUTHMETHOD_KRB5 =   3,
    IMA_AUTHMETHOD_SPKM1    =   4,
    IMA_AUTHMETHOD_SPKM2    =   5
} IMA_AUTHMETHOD;

typedef enum
{
	IMA_COMMIT_TYPE_AUTO	= 0,
	IMA_COMMIT_TYPE_ACTIVE,
	IMA_COMMIT_TYPE_PERSISTENT,
	IMA_COMMIT_TYPE_ACTIVE_AND_PERSISTENT,
	IMA_COMMIT_TYPE_ALL_WITH_RESET
} IMA_COMMIT_LEVEL;

typedef enum 
{
	IMA_DIGEST_NONE		= 0,
	IMA_DIGEST_CRC32C		= 1
} IMA_DIGEST_TYPE;


/**
*******************************************************************************
*
* Declaration of the IMA_OID structure
*
* This structure should be treated as opaque by clients of the API.
* Appropriate APIs should be used to extract information from the structure.
*
*******************************************************************************
*/
typedef struct _IMA_OID
{
    /**
    * The type of the object.  When an object ID is supplied as a parameter
    * to an API the library uses this value to insure that the supplied
    * object's type is appropriate for the API.
    */
    IMA_OBJECT_TYPE objectType;

    /**
    * A value determined by the library which it uses to uniquely identify the
    * owner of an object.  The owner of an object is either the library itself
    * or a plugin.  When an object ID is supplied as a parameter to an API the
    * library uses this value to determine if it should handle the call itself
    * or direct the call to one or more plugins.
    */
    IMA_UINT32      ownerId;

    /**
    * A value determined by a plugin which a plugin uses, perhaps in
    * combination with the object type, to uniquely identify one of its
    * objects.
    */
    IMA_UINT64      objectSequenceNumber;

} IMA_OID;



/**
*******************************************************************************
*
* Declaration of the IMA_OID_LIST structure
*
* This structure is used by a number of APIs to return lists of objects.  Any
* instance of this structure returned by an API must be freed by a client
* using the IMA_FreeObjectIdList API.  Although oids is declared to be an
* array of one
* @ref IMA_OID structure it can in fact contain any number of
* @ref IMA_OID structures.
*
* @note The @a oids array is a variable length array, despite its declaration
*       below it can be of any length.
*
*******************************************************************************
*/
typedef struct _IMA_OID_LIST
{
    /**
    * The number of object IDs in the @a oids array.
    */
    IMA_UINT        oidCount;

    /**
    * A variable length array of zero or more object IDs.  There are
    * 'oidCount' object IDs in this array.
    */
    IMA_OID         oids[1];

} IMA_OID_LIST;

#define IMA_HOST_NAME_LEN 256
typedef IMA_WCHAR IMA_HOST_NAME[IMA_HOST_NAME_LEN];
typedef IMA_BYTE IMA_MAC_ADDRESS[6];

/**
*******************************************************************************
*
* Declaration of the IMA_LIBRARY_PROPERTIES structure
*
*******************************************************************************
*/
typedef struct _IMA_LIBRARY_PROPERTIES
{
    /**
    * The version of the iSCSI Management API implemented by the library.
    * The value returned by a library for the API as described in this
    * document is one.
    */
    IMA_UINT        supportedImaVersion;

    /**
    * A nul terminated ASCII string containing the name of the vendor that
    * created the binary version of the library.
    */
    IMA_WCHAR       vendor[256];

    /**
    * A nul terminated ASCII string containing the implementation version
    * of the library from the vendor specified in the 'vendor' field.
    */
    IMA_WCHAR       implementationVersion[256];

    /**
    * A nul terminated ASCII string ideally containing the path and file
    * name of the library that is being used by the currently executing
    * process can be found. If the path cannot be determined then it is
    * acceptable to fill this field with only the name (and extension if
    * applicable) of the file of the library.  If this cannot be determined
    * then this field should be an empty string.
    */
    IMA_WCHAR       fileName[256];

    /**
    * The time and date that the library that is executing was built.
    */
    IMA_DATETIME    buildTime;

    IMA_BYTE    reserved[64];
} IMA_LIBRARY_PROPERTIES;



/**
*******************************************************************************
*
* Declaration of the IMA_PLUGIN_PROPERTIES structure
*
*******************************************************************************
*/
typedef struct _IMA_PLUGIN_PROPERTIES
{
        IMA_UINT        supportedImaVersion;
        IMA_WCHAR       vendor[256];
        IMA_WCHAR       implementationVersion[256];
        IMA_WCHAR       fileName[256];
        IMA_DATETIME    buildTime;

        IMA_BOOL        lhbasCanBeCreatedAndDestroyed;

        IMA_BYTE        reserved[64];

} IMA_PLUGIN_PROPERTIES;


typedef struct _IMA_IP_ADDRESS
{
        IMA_BOOL        ipv4Address;
        IMA_BYTE        ipAddress[16];

} IMA_IP_ADDRESS;

typedef struct _IMA_ADDRESS_KEY
{
        IMA_IP_ADDRESS  ipAddress;
        IMA_UINT16      portNumber;

} IMA_ADDRESS_KEY;

typedef struct _IMA_ADDRESS_KEYS
{
        IMA_UINT		addressKeyCount;
        IMA_ADDRESS_KEY addressKeys[1];

} IMA_ADDRESS_KEYS;

typedef struct _IMA_ADDRESS_KEY_PROPERTIES
{
        IMA_UINT        addressKeyCount;
        IMA_ADDRESS_KEY addressKeys[1];

} IMA_ADDRESS_KEY_PROPERTIES;

typedef struct _IMA_IP_PROPERTIES
{
        IMA_BOOL        ipConfigurationMethodSettable;
        IMA_BOOL        dhcpConfigurationEnabled;

        IMA_BOOL        subnetMaskSettable;
        IMA_BOOL        subnetMaskValid;
        IMA_IP_ADDRESS  subnetMask;

        IMA_BOOL        defaultGatewaySettable;
        IMA_BOOL        defaultGatewayValid;
        IMA_IP_ADDRESS  defaultGateway;

        IMA_BOOL        primaryDnsServerAddressSettable;
        IMA_BOOL        primaryDnsServerAddressValid;
        IMA_IP_ADDRESS  primaryDnsServerAddress;

        IMA_BOOL        alternateDnsServerAddressSettable;
        IMA_BOOL        alternateDnsServerAddressValid;
        IMA_IP_ADDRESS  alternateDnsServerAddress;

        IMA_BYTE        reserved[64];

} IMA_IP_PROPERTIES;

typedef struct _IMA_HOST_ID
{
		IMA_BOOL hostnameInUse;
		union {

			IMA_HOST_NAME 	hostname;
			IMA_IP_ADDRESS 	ipAddress;

		} id;

} IMA_HOST_ID;

typedef struct _IMA_TARGET_ADDRESS
{
		IMA_HOST_ID hostnameIpAddress;
		IMA_UINT16 	portNumber;

} IMA_TARGET_ADDRESS;

/**
*******************************************************************************
*
* Declaration of the IMA_NODE_NAME type
*
*******************************************************************************
*/
#define	IMA_NODE_NAME_LEN   224
typedef IMA_WCHAR IMA_NODE_NAME[IMA_NODE_NAME_LEN];



/**
*******************************************************************************
*
* Declaration of the IMA_NODE_ALIAS type
*
*******************************************************************************
*/
#define	IMA_NODE_ALIAS_LEN	256
typedef IMA_WCHAR IMA_NODE_ALIAS[IMA_NODE_ALIAS_LEN];



/**
*******************************************************************************
*
* Declaration of the IMA_DOMAIN_NAME type
*
* A variable of this type may be formatted in any of the following four ways:
*       1.  An empty string, which indicates that no host or IP address is
*           specified
*       2.  A DNS host name
*       3.  A dotted-decimal IPv4 address
*       4.  A bracketed IPv6 address as specified in RFC 2732
*
* In all cases a domain name is terminated by a nul character.
* This type is used by several APIs: IMA_SetPhbaSnsDiscovery(),
* IMA_SetNetworkPortalIpAddress(), and indirectly by
* IMA_GetPhbaDiscoveryProperties().
*
*******************************************************************************
*/
typedef wchar_t IMA_DOMAIN_NAME[256];

typedef struct _IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES
{
        IMA_PHBA_DOWNLOAD_IMAGE_TYPE    imageType;
        IMA_WCHAR               version[32];
        IMA_WCHAR               description[512];
        IMA_XBOOL               upgrade;
} IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES;


/**
*******************************************************************************
*
* Declaration of the IMA_NODE_PROPERTIES structure
*
* This structure is returned by the IMA_GetNodeProperties() API.
*
* NOTE: It is possible for both 'runningInInitiatorMode' and
*       'runningInTargetMode' to be set to @c IMA_TRUE.  This means that
*       the node is operating both as an initiator and as a target.
*
*******************************************************************************
*/
typedef struct _IMA_NODE_PROPERTIES
{
    /**
    * A boolean indicating if the node is running as initiator or not.
    */
    IMA_BOOL        runningInInitiatorMode;

    /**
    * A boolean indicating if the node is running as a target or not.
    */
    IMA_BOOL        runningInTargetMode;

    /**
    * A boolean which indicates if the node's name is set or not.
    */
    IMA_BOOL        nameValid;

    /**
    * A nul terminated Unicode string which contains the name of the node.
    * The value in this field is only valid if 'nameValid' is set to
    * IMA_TRUE, in which case it will be Unicode NULL terminated.  If
    * 'nameValid' is set to IMA_FALSE then this field will contain an
    * empty string.
    */
    IMA_NODE_NAME   name;

    /**
    * A boolean which indicates if the node's alias is set or not.
    */
    IMA_BOOL        aliasValid;

    /**
    * A nul terminated Unicode string which contains the alias of the node.
    * This field is only valid if 'aliasValid' is set to IMA_TRUE, in which
    * case it will be Unicode NULL terminated.  If 'aliasValid' is set to
    * IMA_FALSE then this field will contain an empty string.
    */
    IMA_NODE_ALIAS  alias;

    /*
     * Boolean indicating if both the name and alias are settable using
     * IMA_SetNodeName() and IMA_SetNodeAlias().
     */
    IMA_BOOL    nameAndAliasSettable;

    IMA_BYTE    reserved[64];

} IMA_NODE_PROPERTIES;



/**
*******************************************************************************
*
* Declaration of the IMA_LHBA_PROPERTIES structure
*
* This structure is returned by the IMA_GetLhbaProperties()  API.
*
*******************************************************************************
*/
typedef struct _IMA_LHBA_PROPERTIES
{
    IMA_WCHAR   osDeviceName[256];
    IMA_BOOL    luExposingSupported;
    IMA_BOOL    isDestroyable;

    IMA_BOOL    staleDataRemovable;
    IMA_UINT    staleDataSize;

    IMA_BOOL    initiatorAuthMethodsSettable;
    IMA_BOOL    targetAuthMethodsSettable;

    IMA_BYTE    reserved[128];
} IMA_LHBA_PROPERTIES;



/**
*******************************************************************************
*
* Declaration of the IMA_ULP_xxx constants
*
*******************************************************************************
*/
#define IMA_ULP_TCP             0x01
#define IMA_ULP_SCTP            0x02
#define IMA_ULP_UDP             0x04



/**
*******************************************************************************
*
* Declaration of the IMA_MIN_MAX_VALUE structure
*
* Note: If the 'currentValueValid' field is IMA_FALSE then the value of
*       'settable' must also be set to IMA_FALSE.
*
* Note: The fields in this structure contain values which are defined by the
*       implementation and not by the iSCSI specification.  It is possible
*       that an implementation may be more or less restrictive in the values
*       that it can accept than the iSCSI specification allows.
*
* Note: An example of how to use 'incrementValue': Suppose that a structure is
*       obtained where 'currentValueValid' is IMA_TRUE, 'settable' is
*       IMA_TRUE, 'currentValue' is 50, 'defaultValue' is 50, 'minimumValue'
*       is 30, 'maximumValue' is 70 and 'incrementValue' is 10.  In this case,
*       the possible values that the property can be set to are 30, 40, 50,
*       60, and 70.  The new value must be the current value plus or minus
*       some multiple of 'incrementValue'.
*
*******************************************************************************
*/
typedef struct _IMA_MIN_MAX_VALUE
{
    /**
    * A boolean indicating if the @a currentValue field contains a valid value.
    */
    IMA_BOOL        currentValueValid;

    /**
    * Indicates if the corresponding property is settable.  If this field
    * has the value IMA_TRUE then the 'defaultValue', 'minimumValue',
    * 'maximumValue', and 'incrementValue' fields shall contain valid
    * values.  If this field has the value IMA_FALSE then these fields
    * have undefined values.
    */
    IMA_BOOL        settable;

    /**
    * If currentValueValid has the value IMA_TRUE then this field contains
    * the current value of the associated property.  If 'currentValueValid' has
    * the value IMA_FALSE then the value of this field is undefined.
    */
    IMA_UINT32      currentValue;

    /**
    * If 'settable' has the value IMA_TRUE then this field contains the
    * implementation's default value of the associated property.  If 'settable'
    * has the value IMA_FALSE then the value of this field is undefined.
    */
    IMA_UINT32      defaultValue;

    /**
    * If 'settable' has the value IMA_TRUE then this field contains the
    * implementation's minimum value of the associated property.  If 'settable'
    * has the value IMA_FALSE then the value of this field is undefined.
    */
    IMA_UINT32      minimumValue;

    /**
    * If 'settable' has the value IMA_TRUE then this field contains the
    * implementation's maximum value of the associated property.  If 'settable'
    * has the value IMA_FALSE then the value of this field is undefined.
    */
    IMA_UINT32      maximumValue;

    /**
    * If 'settable' has the value IMA_TRUE then this field contains a value
    * which can be added to or subtracted from 'currentValue' to obtain other
    * possible values of the associated property. If 'settable' has the value
    * IMA_FALSE then the value of this field is undefined.
    */
    IMA_UINT32      incrementValue;

} IMA_MIN_MAX_VALUE;

typedef struct _IMA_BOOL_VALUE
{
    IMA_BOOL    currentValueValid;
    IMA_BOOL    settable;
    IMA_BOOL    currentValue;
    IMA_BOOL    defaultValue;
} IMA_BOOL_VALUE;

/**
*******************************************************************************
*
* Declaration of the IMA_PHBA_PROPERTIES structure
*
* This structure is returned by the IMA_GetPhbaProperties() API.
*
* Note: Both 'isInitiator' and 'isTarget' cannot be set to IMA_FALSE as this
*       would mean that the PHBA was not functioning as either an initiator or
*       target, which means that its not functioning at all.
*
*******************************************************************************
*/
typedef struct _IMA_PHBA_PROPERTIES
{
    /**
    * A nul terminated ASCII string which contains the name of the vendor
    * of a PHBA. If the first character in this field is nul then the
    * vendor is unknown.
    */
    IMA_WCHAR       vendor[64];

    /**
    * A nul terminated ASCII string which contains the name of the model of
    * a PHBA. If the first character in this field is nul then the model is
    * unknown.
    */
    IMA_WCHAR       model[256];

    /**
    * A nul terminated ASCII string which contains a description of a PHBA.
    * This is a user friendly description of the PHBA.  If the first character
    * in this field is nul then there is no description.
    */
    IMA_WCHAR       description[256];

    /**
    * A nul terminated ASCII string which contains the serial number of a
    * PHBA.  If the first character in this field is nul then the serial
    * number is unknown.
    */
    IMA_WCHAR       serialNumber[64];

    /**
    * A nul terminated ASCII string which contains the hardware version of
    * a PHBA. If the first character in this field is nul then the hardware
    * version is unknown.
    */
    IMA_WCHAR       hardwareVersion[256];

    /**
    * A nul terminated ASCII string which contains the ASIC version of a
    * PHBA.  If the first character in this field is nul then the ASIC
    * version is unknown or is not applicable.
    */
    IMA_WCHAR       asicVersion[256];

    /**
    * A nul terminated ASCII string which contains the firmware version of
    * a PHBA.  If the first character in this field is nul then the firmware
    * version is unknown or is not applicable.
    */
    IMA_WCHAR       firmwareVersion[256];

    /**
    * A nul terminated ASCII string which contains the option ROM version
    * of a PHBA. If the first character in this field is nul then the option
    * ROM version is unknown or is not applicable.
    */
    IMA_WCHAR       optionRomVersion[256];

    /**
    * A nul terminated ASCII string which contains the name of the driver
    * controlling a PHBA.  If the first character in this field is nul then
    * the name of the driver is unknown.
    */
    IMA_WCHAR       driverName[256];

    /**
    * A nul terminated ASCII string which contains the version of the driver
    * specified in 'driverName'.  If the first character in this field is nul
    * then the version of the driver is unknown.
    *
    * This field can have a known value only if @a driverName has a known
    * value as well.
    */
    IMA_WCHAR       driverVersion[256];

    /**
    * A field containing flags which indicate what upper level protocols
    * are supported by a PHBA.  Examples of upper level protocols include:
    *
    *       - TCP, represented by IMA_ULP_TCP
    *       - SCTP, represented by IMA_ULP_SCTP
    *       - UDP, represented by IMA_ULP_UDP
    */
    IMA_UINT        supportedUlps;

    /**
    * A extended boolean which indicates if a PHBA supports executing SCSI
    * commands which cause bidirectional transfers.
    *
    * Note: The value of this field applies to the entire stack:
    * the hardware, ASIC, firmware, driver, etc.  All must support SCSI
    * commands which cause bidirectional transfers for this field to be
    * set to IMA_TRUE.
    */
    IMA_XBOOL       bidirectionalTransfersSupported;

    /**
    * The maximum length, in bytes, of a CDB that can be transferred by
    * this PHBA.  If this field has a value of zero that indicates that
    * this value is unknown.
    *
    * Note: The value of this field applies to the entire stack:
    * the hardware, ASIC, firmware, driver, etc.  All must support the
    * maximum CDB length returned in this field.
    */
    IMA_UINT        maximumCdbLength;

    /**
    * An extended boolean which indicates if a PHBA can also function as
    * a standard NIC concurrently with functioning as an iSCSI PHBA.
    */
    IMA_XBOOL       canBeNic;

    /**
    * A extended boolean which indicates if a PHBA is functioning as a
    * standard NIC concurrently with functioning as an iSCSI PHBA.
    */
    IMA_XBOOL       isNic;

    /**
    * An extended boolean indicating if the PHBA is functioning as an
    * initiator.
    */
    IMA_XBOOL       isInitiator;

    /**
    * An extended boolean indicating if the PHBA is functioning as a target.
    */
    IMA_XBOOL       isTarget;

    /**
    * An extended boolean indicating if the PHBA is using a TCP offload engine.
    *
    * Note: This value should only be set to @c IMA_TRUE if a TCP offload
    * engine is present and is being used.  If it can be determined that a
    * TCP offload engine is present, but it cannot be determined if that
    * offload engine is being used then this value should be set to
    * IMA_UNKNOWN.
    */
    IMA_XBOOL       usingTcpOffloadEngine;

    /**
    * An extended boolean indicating if the PHBA is using a iSCSI offload
    * engine.
    *
    * Note: This value should only be set to @c IMA_TRUE if a iSCSI offload
    * engine is present and is being used.  If it can be determined that an
    * iSCSI offload engine is present, but it cannot be determined if that
    * offload engine is being used then this value should be set to
    * IMA_UNKNOWN.
    */
    IMA_XBOOL       usingIscsiOffloadEngine;

    IMA_BYTE        reserved[128];

} IMA_PHBA_PROPERTIES;

/**
*******************************************************************************
*
* Declaration of the IMA_DISCOVERY_PROPERTIES structure
*
*******************************************************************************
*/
typedef struct _IMA_DISCOVERY_PROPERTIES
{
		IMA_BOOL			iSnsDiscoverySettable;
		IMA_XBOOL			iSnsDiscoveryEnabled;
		IMA_ISNS_DISCOVERY_METHOD   	iSnsDiscoveryMethod;
		IMA_HOST_ID			iSnsHost;

		IMA_BOOL    			slpDiscoverySettable;
		IMA_XBOOL   			slpDiscoveryEnabled;

		IMA_BOOL    			staticDiscoverySettable;
		IMA_XBOOL   			staticDiscoveryEnabled;

		IMA_BOOL    			sendTargetsDiscoverySettable;
		IMA_XBOOL   			sendTargetsDiscoveryEnabled;

		IMA_BYTE    			reserved[128];
} IMA_DISCOVERY_PROPERTIES;


typedef struct _IMA_PHBA_DOWNLOAD_PROPERTIES
{
        IMA_BOOL        isPhbaDownloadFileSupported;
        IMA_BOOL        optionRomDownloadSupported;
        IMA_BOOL        firmwareDownloadSupported;

        IMA_BYTE        reserved[32];
} IMA_PHBA_DOWNLOAD_PROPERTIES;

typedef struct _IMA_IPSEC_PROPERTIES
{
        IMA_BOOL        ipsecSupported;
        IMA_BOOL        implementedInHardware;
        IMA_BOOL        implementedInSoftware;

        IMA_BYTE        reserved[32];

} IMA_IPSEC_PROPERTIES;

typedef struct _IMA_LNP_PROPERTIES
{
        IMA_MAC_ADDRESS macAddress;
        IMA_BOOL        macAddressSettable;
        IMA_BYTE        reserved[32];

} IMA_LNP_PROPERTIES;

typedef struct _IMA_PNP_PROPERTIES
{
        IMA_OID         associatedPhbaOid;

        IMA_MAC_ADDRESS macAddress;
        IMA_BOOL        macAddressSettable;

        IMA_UINT        maximumTransferRate;
        IMA_UINT        currentTransferRate;

        IMA_UINT        maximumFrameSize;

        IMA_BYTE        reserved[64];
} IMA_PNP_PROPERTIES;

typedef struct _IMA_PNP_STATISTICS
{
        IMA_UINT64      bytesSent;
        IMA_UINT32      pdusSent;
        IMA_UINT64      bytesReceived;
        IMA_UINT32      pdusReceived;

} IMA_PNP_STATISTICS;

typedef struct _IMA_TARGET_PROPERTIES
{
        IMA_OID associatedNodeOid;
        IMA_OID associatedLhbaOid;

        IMA_NODE_NAME   name;
        IMA_NODE_ALIAS  alias;
        IMA_UINT32      discoveryMethodFlags;

        IMA_BOOL        sendTargetsDiscoverySettable;
        IMA_BOOL        sendTargetsDiscoveryEnabled;

        IMA_BYTE        reserved[128];

} IMA_TARGET_PROPERTIES;

typedef struct _IMA_CONNECTION_PROPERTIES
{
	IMA_OID	associatedSessionOid;
	IMA_UINT16	connectionId;
	IMA_DIGEST_TYPE	dataDigest;
	IMA_DIGEST_TYPE	headerDigest;
	IMA_BOOL	ifMarker;
	IMA_UINT32	ifMarkInt;
	IMA_UINT32	maxRecvDataSegmentLength;
	IMA_UINT32	maxTransmitDataSegmentLength;
	IMA_BOOL	ofMarker;
	IMA_UINT32	ofMarkInt;
} IMA_CONNECTION_PROPERTIES;


typedef struct _IMA_SESSION_PROPERTIES
{
	IMA_OID	associatedLhbaOid;
	IMA_AUTHMETHOD	authMethod;
	IMA_BOOL	dataPduInOrder;
	IMA_BOOL	dataSequenceInOrder;
	IMA_UINT16	defaultTime2Retain;
	IMA_UINT16	defaultTime2Wait;
	IMA_UINT16	errorRecoveryLevel;
	IMA_UINT32	firstBurstLength;
	IMA_BOOL	immediateData;
	IMA_BOOL	initialR2T;
	IMA_BYTE	isid[6];
	IMA_UINT32	maxBurstLength;
	IMA_UINT16	maxConnections;
	IMA_UINT16	maxOutstandingR2T;
	IMA_UINT16	targetPortalGroupTag;
	IMA_UINT16	tsih;
} IMA_SESSION_PROPERTIES;


typedef struct _IMA_TARGET_ERROR_STATISTICS
{
        IMA_BOOL        loginFailedCountValid;
        IMA_UINT32      loginFailedCount;

        IMA_BOOL        sessionFailedCountValid;
        IMA_UINT32      sessionFailedCount;

        IMA_BOOL        headerOrDigestSessionFailedCountValid;
        IMA_UINT32      headerOrDigestSessionFailedCount;

        IMA_BOOL        timeLimitExceededSessionFailedCountValid;
        IMA_UINT32      timeLimitExceededSessionFailedCount;

        IMA_BOOL        formatErrorSessionFailedCountValid;
        IMA_UINT32      formatErrorSessionFailedCount;

        IMA_BOOL        closedConnectionDueToTimeoutCountValid;
        IMA_UINT32      closedConnectionDueToTimeoutCount;

        IMA_BOOL        lastLoginFailureTimeValid;
        IMA_DATETIME    lastLoginFailureTime;

        IMA_BYTE        reserved[64];

} IMA_TARGET_ERROR_STATISTICS;

typedef struct _IMA_LU_PROPERTIES
{
        IMA_OID         associatedTargetOid;
        IMA_UINT64      targetLun;

        IMA_BOOL        exposedToOs;
        IMA_DATETIME    timeExposedToOs;

        IMA_BOOL        osDeviceNameValid;
        IMA_WCHAR       osDeviceName[64];

        IMA_BOOL        osParallelIdsValid;
        IMA_UINT32      osBusNumber;
        IMA_UINT32      osTargetId;
        IMA_UINT32      osLun;

        IMA_BYTE        reserved[128];

} IMA_LU_PROPERTIES;

typedef struct _IMA_STATISTICS_PROPERTIES
{
        IMA_BOOL        statisticsCollectionSettable;
        IMA_BOOL        statisticsCollectionEnabled;

} IMA_STATISTICS_PROPERTIES;

typedef struct _IMA_DEVICE_STATISTICS
{
        IMA_UINT64      scsiPayloadBytesSent;
        IMA_UINT64      scsiPayloadBytesReceived;

        IMA_UINT64      iScsiPduBytesSent;
        IMA_UINT64      iScsiPduBytesReceived;

        IMA_UINT64      iScsiPdusSent;
        IMA_UINT64      iScsiPdusReceived;

        IMA_UINT64      millisecondsSpentSending;
        IMA_UINT64      millisecondsSpentReceiving;

} IMA_DEVICE_STATISTICS;

typedef struct _IMA_NETWORK_PORTAL_PROPERTIES
{
        IMA_IP_ADDRESS  ipAddress;
        IMA_OID         associatedLnp;

        IMA_BYTE        reserved[32];
} IMA_NETWORK_PORTAL_PROPERTIES;

typedef void (* IMA_OBJECT_VISIBILITY_FN)(
        IMA_BOOL        becomingVisible,
        IMA_OID         oid
);

typedef void (* IMA_OBJECT_PROPERTY_FN)(
        IMA_OID         oid
);

typedef struct _IMA_CHAP_INITIATOR_AUTHPARMS
{

        IMA_UINT        retries;

        IMA_BYTE        name[512];
        IMA_UINT        nameLength;

        IMA_UINT        minValueLength;
        IMA_UINT        maxValueLength;

        IMA_BYTE        challengeSecret[256];
        IMA_UINT        challengeSecretLength;

        IMA_BYTE        reserved[512];

} IMA_CHAP_INITIATOR_AUTHPARMS;

typedef struct _IMA_SRP_INITIATOR_AUTHPARMS
{

        IMA_BYTE        userName[512];
        IMA_UINT        userNameLength;

        IMA_BYTE        reserved[512];

} IMA_SRP_INITIATOR_AUTHPARMS;

typedef struct _IMA_KRB5_INITIATOR_AUTHPARMS
{

        IMA_BYTE        clientKey[1024];
        IMA_UINT        clientKeyLength;

        IMA_BYTE        reserved[2048];

} IMA_KRB5_INITIATOR_AUTHPARMS;

typedef struct _IMA_SPKM_INITIATOR_AUTHPARMS
{

        IMA_BYTE        privateKey[4096];
        IMA_UINT        privateKeyLength;

        IMA_BYTE        publicKey[4096];
        IMA_UINT        publicKeyLength;

        IMA_BYTE        reserved[4096];

} IMA_SPKM_INITIATOR_AUTHPARMS;

typedef union _IMA_INITIATOR_AUTHPARMS
{

        IMA_CHAP_INITIATOR_AUTHPARMS    chapParms;
        IMA_SRP_INITIATOR_AUTHPARMS     srpParms;
        IMA_KRB5_INITIATOR_AUTHPARMS    kerberosParms;
        IMA_SPKM_INITIATOR_AUTHPARMS    spkmParms;

} IMA_INITIATOR_AUTHPARMS;


typedef struct _IMA_STATIC_DISCOVERY_TARGET
{
		IMA_NODE_NAME 		targetName;
		IMA_TARGET_ADDRESS 	targetAddress;

} IMA_STATIC_DISCOVERY_TARGET;

typedef struct _IMA_DISCOVERY_ADDRESS_PROPERTIES
{
		IMA_OID			associatedNodeOid;
		IMA_OID			associatedLhbaOid;
		IMA_TARGET_ADDRESS	discoveryAddress;

} IMA_DISCOVERY_ADDRESS_PROPERTIES;

typedef struct _IMA_STATIC_TGT_PROPERTIES
{
		IMA_OID				associatedNodeOid;
		IMA_OID				associatedLhbaOid;
		IMA_STATIC_DISCOVERY_TARGET	staticTarget;

} IMA_STATIC_DISCOVERY_TARGET_PROPERTIES;

typedef struct ima_plugin_info {
	char PluginName[64];
        char PluginPath[256];
#ifdef WIN32
	HINSTANCE hPlugin; /* Handle to a loaded DLL */
#else
	void* hPlugin; /* Handle to a loaded DLL */
#endif
	IMA_UINT32 ownerId;
#ifdef WIN32
	HANDLE pluginMutex;
#else
	int pluginMutex;
#endif
	IMA_UINT number_of_vbcallbacks;
        IMA_OBJECT_VISIBILITY_FN vbcallback[IMA_MAX_CALLBACK_PER_PLUGIN];
        IMA_UINT number_of_pccallbacks;
        IMA_OBJECT_PROPERTY_FN pccallback[IMA_MAX_CALLBACK_PER_PLUGIN];
} IMA_PLUGIN_INFO, *PIMA_PLUGIN_INFO;


/**
*******************************************************************************
*
* The individual APIs of the IMA are declared below.
*
*******************************************************************************
*/

/**
*******************************************************************************
*
* Gets the properties of the IMA library that is being used.
*
* @param  pProps
*         A pointer to an IMA_LIBRARY_PROPERTIES structure allocated by
*         the caller.  On successful return this structure will contain the
*         properties of the IMA library.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the library properties were successfully returned.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to which
*         data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetLibraryProperties(
        IMA_LIBRARY_PROPERTIES *pProps
);



/**
*******************************************************************************
*
* Gets a list of the object IDs of all currently loaded plugins.
*
* @param ppList
*        A pointer to a pointer to an IMA_OID_LIST.  On successful
*        return this will contain a pointer to an @ref IMA_OID_LIST
*        which contains the object IDs of all of the plugins currently
*        loaded by the library.
*
* @return An IMA_STATUS indicating if the operation was successful or
*         if an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the plugin ID list was successfully returned.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'ppList' is NULL or specifies a memory area to
*         which data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetPluginOidList(
        IMA_OID_LIST **ppList
);



/**
*******************************************************************************
*
* Gets the properties of the specified vendor plugin.
*
* @param  pluginOid
*         The ID of the plugin whose properties are being retrieved.
*
* @param  pProps
*         A pointer to an @ref IMA_PLUGIN_PROPERTIES structure allocated by
*         the caller.  On successful return this will contain the properties
*         of the plugin specified by pluginOid.
*
* @return An IMA_STATUS indicating if the operation was successful or if an
*         error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the plugin properties were successfully returned.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'pluginOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'pluginOid' does not specify a plugin object.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'pluginOid' refers to a plugin, but not one that
*         is currently loaded.
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to
*         which data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetPluginProperties(
        IMA_OID pluginOid,
        IMA_PLUGIN_PROPERTIES *pProps
);



/**
*******************************************************************************
*
* Gets the object ID for the plugin associated with the specified object ID.
*
* @param  oid
*         The object ID of an object that has been received from a previous
*         library call.
*
* @param  pPluginOid
*         A pointer to an IMA_OID structure allocated by the caller.  On
*         successful return this will contain the object ID of the plugin
*         associated with the object specified by @a objectId.  This
*         can then be used to work with the plugin, e.g., to get the
*         properties of the plugin or the send the plugin an IOCtl.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the associated plugin ID was successfully returned.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pPluginOid' is NULL or specifies a memory area to
*         which data cannot be written.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'oid' specifies an object not owned by a plugin, but
*         instead one that is owned by the library.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'oid' specifies an object with an invalid type.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetAssociatedPluginOid(
        IMA_OID oid,
        IMA_OID *pPluginOid
);



/**
*******************************************************************************
*
* Gets the object ID of the shared node.
*
* @param  pSharedNodeOid
*         A pointer to an IMA_OID structure allocated by the caller.  On
*         successful return it will contain the object ID of the
*         shared node of the currently executing system is placed.
*
* @return An IMA_STATUS indicating if the operation was successful or
*         if an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the shared node ID has been successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pSharedNodeOid' is NULL or specifies a memory area
*         to which data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetSharedNodeOid(
        IMA_OID *pSharedNodeOid
);

IMA_API IMA_STATUS IMA_GetObjectType(
        IMA_OID oid,
        IMA_OBJECT_TYPE *pObjectType
);


/**
*******************************************************************************
*
* Gets the properties of the specified iSCSI node.
*
* @param  nodeOid
*         The ID of the node to get the properties of.
*
* @param  pProps
*         A pointer to an @ref IMA_NODE_PROPERTIES structure which on
*         successful return will contain the properties of the specified node.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the node properties have been successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify a node object.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'nodeOid' does not specify a node which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetNodeProperties(
        IMA_OID nodeOid,
        IMA_NODE_PROPERTIES *pProps
);



/**
*******************************************************************************
*
* Sets the name of the specified node.
*
* @param  nodeOid
*         The object ID of the node whose name is being set.
*
* @param  newName
*         The new name of the node.
*
* @return An IMA_STATUS indicating if the operation was successful or
*         if an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the node name was successfully changed.
*
* @retval IMA_STATUS_REBOOT_NECESSARY
*         Returned if a reboot is necessary before the setting of the
*         name actually takes affect.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'newName' is NULL, or specifies a memory area
*         to which data cannot be written, or has a length of 0.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify a node object.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'nodeOid' does not specify a node which is
*         currently known to the system.
*
* @retval IMA_ERROR_NAME_TOO_LONG
*         Returned if 'newName' contains too many characters.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_SetNodeName(
        IMA_OID nodeOid,
        const IMA_NODE_NAME newName
);



/**
*******************************************************************************
*
* Generates a unique node name for the currently running system.
*
* @param  generatedName
*         On successful return contains the generated node name.
*
* @return  An IMA_STATUS indicating if the operation was successful or if an
*          error occurred.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'generatedname is NULL or
*               specifies a memory area to which data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GenerateNodeName(
        IMA_NODE_NAME generatedName
);



/**
*******************************************************************************
*
* Sets the alias of the specified node.
*
* @param  nodeOid
*         The object ID of the node whose alias is being set.
*
* @param  newAlias
*         A pointer to a Unicode string which contains the new node alias.
*         If this parameter is NULL then the current alias is deleted, in which
*         case the specified node no longer has an alias.
*
* @return An IMA_STATUS indicating if the operation was successful or
*         if an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the node's alias has been successfully set.
*
* @retval IMA_STATUS_REBOOT_NECESSARY
*         A reboot is necessary before the setting of the alias actually
*         takes effect.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'nodeOid' does not specify a node object.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'nodeOid' does not specify a node which is currently
*         known to the system.
*
* @retval IMA_ERROR_NAME_TOO_LONG
*         Returned if 'newAlias' contains too many characters.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_SetNodeAlias(
        IMA_OID nodeOid,
        const IMA_NODE_ALIAS newAlias
);



/**
*******************************************************************************
*
* Gets a list of the object IDs of all the logical HBAs in the system.
*
* @param  ppList
*         A pointer to a pointer to an @ref IMA_OID_LIST structure.  On
*         successful return this will contain a pointer to an
*         IMA_OID_LIST which contains the object IDs of all of the
*         LHBAs currently in the system.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the LHBA ID list has been successfully returned.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'ppList' is NULL or specifies a memory area to which
*         data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetLhbaOidList(
        IMA_OID_LIST **ppList
);



/**
*******************************************************************************
*
* Gets the properties of the specified logical HBA.
*
* @param  lhbaOid
*         The object ID of the LHBA whose properties are being retrieved.
*
* @param  pProps
*         A pointer to an IMA_LHBA_PROPERTIES structure.  On successful
*         return this will contain the properties of the LHBA specified by
*         'lhbaOid'.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the properties of the specified LHBA have been
*         successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'lhbaOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'lhbaOid' does not specify a LHBA.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'lhbaOid' does not specify a LHBA which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetLhbaProperties(
        IMA_OID lhbaOid,
        IMA_LHBA_PROPERTIES *pProps
);



/**
*******************************************************************************
*
* Gets a list of the object IDs of all the physical HBAs in the system.
*
* @param  ppList
*         A pointer to a pointer to an IMA_OID_LIST structure.  On successful
*         return this will contain a pointer to an IMA_OID_LIST which
*         contains the object IDs of all of the PHBAs currently in the system.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the PHBA OID list has been successfully returned.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'ppList' is NULL or specifies a memory area to which
*         data cannot be written.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetPhbaOidList(
        IMA_OID_LIST **ppList
);



/**
*******************************************************************************
*
* Gets the general properties of a physical HBA.
*
* @param  phbaOid
*         The object ID of the PHBA whose properties are being queried.
*
* @param  pProps
*         A pointer to an @ref IMA_PHBA_PROPERTIES structure.  On successful
*         return this will contain the properties of the PHBA specified by
*         'phbaOid'.
#
* @return An IMA_STATUS indicating if the operation was successful or
*         if an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the properties of the specified PHBA have been
*         successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'phbaOid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'phbaOid' does not specify a PHBA.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'phbaOid' does not specify a PHBA which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetPhbaProperties(
        IMA_OID phbaOid,
        IMA_PHBA_PROPERTIES *pProps
);

/**
*******************************************************************************
*
* Frees a previously allocated IMA_OID_LIST structure.
*
* @param pMemory  A pointer to an IMA_OID_LIST structure allocated by the
*                 library.  On successful return the memory allocated by the
*                 list is freed.
* @return  An IMA_STATUS indicating if the operation was successful or if an
*          error occurred.
* @retval IMA_SUCCESS
*         Returned if the specified object ID list was successfully
*         freed.
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if pMemory is NULL or specifies a memory area from which
*         data cannot be read.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_FreeMemory(
        void *pMemory
);



IMA_API IMA_STATUS IMA_GetNonSharedNodeOidList(
                IMA_OID_LIST **ppList
);




/**
*******************************************************************************
*
* Gets the first burst length properties of the specified logical HBA.
*
* @param  oid
*         The object ID of the logical HBA to get the first burst length
*         properties of.
*
* @param  pProps
*         A pointer to a min/max values structure.
*
* @return An IMA_STATUS indicating if the operation was successful or if an
*         error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the first burst length properties have been
*         successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if pProps is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'oid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'oid' does not specify a LHBA.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'oid' does not specify a LHBA which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);


/**
*******************************************************************************
*
* Gets the max burst length properties of the specified logical HBA.
*
* @param  oid
*         The object ID of the logical HBA to get the max burst length
*         properties of.
*
* @param  pProps
*         A pointer to an IMA_MIN_MAX_VALUE structure allocated by the
*         caller.  On successful return this structure will contain the max
*         burst length properties of this LHBA.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the max burst length properties have been successfully
*         retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if pProps is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'oid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'oid' does not specify a LHBA.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'oid' does not specify a LHBA which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties(
                IMA_OID Oid,
                IMA_MIN_MAX_VALUE *pProps
);

/**
*******************************************************************************
*
* Gets the maximum receive data segment length properties of the specified
* logical HBA.
*
* @param  oid
*         The object ID of the logical HBA to get the max receive data
*         segment length properties of.
*
* @param  pProps
*         A pointer to an @ref IMA_MIN_MAX_VALUE structure allocated by the
*         caller.  On successful return this structure will contain the max
*         receive data segment length properties of this LHBA.
*
* @return An IMA_STATUS indicating if the operation was successful or if
*         an error occurred.
*
* @retval IMA_SUCCESS
*         Returned if the max receive data segment length properties
*         have been successfully retrieved.
*
* @retval IMA_ERROR_INVALID_PARAMETER
*         Returned if 'pProps' is NULL or specifies a memory area to which
*         data cannot be written.
*
* @retval IMA_ERROR_INVALID_OBJECT_TYPE
*         Returned if 'oid' does not specify any valid object type.
*
* @retval IMA_ERROR_INCORRECT_OBJECT_TYPE
*         Returned if 'oid' does not specify a LHBA.
*
* @retval IMA_ERROR_OBJECT_NOT_FOUND
*         Returned if 'oid' does not specify a LHBA which is currently
*         known to the system.
*
*******************************************************************************
*/
IMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);


/*---------------------------------------------*/
IMA_API IMA_STATUS IMA_PluginIOCtl(
                IMA_OID pluginOid,
                IMA_UINT command,
                const void *pInputBuffer,
                IMA_UINT inputBufferLength,
                void *pOutputBuffer,
                IMA_UINT *pOutputBufferLength
);



IMA_API IMA_STATUS IMA_GetNetworkPortalOidList(
                IMA_OID oid,
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_SetFirstBurstLength(
                IMA_OID oid,
                IMA_UINT firstBurstLength
);

IMA_API IMA_STATUS IMA_SetMaxBurstLength(
                IMA_OID oid,
                IMA_UINT maxBurstLength
);

IMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength(
                IMA_OID oid,
                IMA_UINT maxRecvDataSegmentLength
);

IMA_API IMA_STATUS IMA_GetMaxConnectionsProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetMaxConnections(
                IMA_OID oid,
                IMA_UINT maxConnections
);

IMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetDefaultTime2Retain(
                IMA_OID oid,
                IMA_UINT defaultTime2Retain
);

IMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetDefaultTime2Wait(
                IMA_OID oid,
                IMA_UINT defaultTime2Wait
);

IMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetMaxOutstandingR2T(
                IMA_OID oid,
                IMA_UINT maxOutstandingR2T
);

IMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties(
                IMA_OID oid,
                IMA_MIN_MAX_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetErrorRecoveryLevel(
                IMA_OID oid,
                IMA_UINT errorRecoveryLevel
);

IMA_API IMA_STATUS IMA_GetInitialR2TProperties(
                IMA_OID oid,
                IMA_BOOL_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetInitialR2T(
                IMA_OID oid,
                IMA_BOOL initialR2T
);

IMA_API IMA_STATUS IMA_GetImmediateDataProperties(
                IMA_OID oid,
                IMA_BOOL_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetImmediateData(
                IMA_OID oid,
                IMA_BOOL immediateData
);

IMA_API IMA_STATUS IMA_GetDataPduInOrderProperties(
                IMA_OID oid,
                IMA_BOOL_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetDataPduInOrder(
                IMA_OID oid,
                IMA_BOOL dataPduInOrder
);

IMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties(
                IMA_OID oid,
                IMA_BOOL_VALUE *pProps
);

IMA_API IMA_STATUS IMA_SetDataSequenceInOrder(
                IMA_OID oid,
                IMA_BOOL dataSequenceInOrder
);

IMA_API IMA_STATUS IMA_SetStatisticsCollection(
                IMA_OID oid,
                IMA_BOOL enableStatisticsCollection
);

IMA_API IMA_STATUS IMA_GetNetworkPortStatus(
                IMA_OID portOid,
                IMA_NETWORK_PORT_STATUS *pStatus
);

IMA_API IMA_STATUS IMA_GetTargetOidList(
                IMA_OID oid,
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_RemoveStaleData(
                IMA_OID lhbaOid
);

IMA_API	IMA_STATUS IMA_SetIsnsDiscovery(
		IMA_OID phbaId,
		IMA_BOOL enableIsnsDiscovery,
		IMA_ISNS_DISCOVERY_METHOD discoveryMethod,
		const IMA_HOST_ID *iSnsHost
);

IMA_API IMA_STATUS IMA_SetSlpDiscovery(
                IMA_OID phbaOid,
                IMA_BOOL enableSlpDiscovery
);

IMA_API IMA_STATUS IMA_SetStaticDiscovery(
                IMA_OID phbaOid,
                IMA_BOOL enableStaticDiscovery
);

IMA_API IMA_STATUS IMA_SetSendTargetsDiscovery(
                IMA_OID oid,
                IMA_BOOL enableSendTargetsDiscovery
);

IMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget(
                IMA_OID targetOid
);

IMA_API IMA_STATUS IMA_GetIpsecProperties(
                IMA_OID phbaOid,
                IMA_IPSEC_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetPnpOidList(
                IMA_OID oid,
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetPhbaDownloadProperties(
                IMA_OID phbaOid,
                IMA_PHBA_DOWNLOAD_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_IsPhbaDownloadFile(
                IMA_OID phbaOid,
                const IMA_WCHAR *pFileName,
                IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_PhbaDownload(
                IMA_OID phbaOid,
                IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType,
                const IMA_WCHAR *pFileName
);

IMA_API IMA_STATUS IMA_GetNetworkPortalProperties(
                IMA_OID networkPortalOid,
                IMA_NETWORK_PORTAL_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress(
                IMA_OID networkPortalOid,
                const IMA_IP_ADDRESS NewIpAddress
);

IMA_API IMA_STATUS IMA_GetLnpOidList(
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetLnpProperties(
                IMA_OID lnpOid,
                IMA_LNP_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetPnpProperties(
                IMA_OID pnpOid,
                IMA_PNP_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetPnpStatistics(
                IMA_OID pnpOid,
                IMA_PNP_STATISTICS *pStats
);

IMA_API IMA_STATUS IMA_GetTargetProperties(
                IMA_OID targetOid,
                IMA_TARGET_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetTargetErrorStatistics(
                IMA_OID targetOid,
                IMA_TARGET_ERROR_STATISTICS *pStats
);

IMA_API IMA_STATUS IMA_GetLuOidList(
                IMA_OID oid,
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetLuOid(
                IMA_OID targetOid,
                IMA_UINT64 lun,
                IMA_OID *pluOid
);

IMA_API IMA_STATUS IMA_GetLuProperties(
                IMA_OID luOid,
                IMA_LU_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetStatisticsProperties(
                IMA_OID oid,
                IMA_STATISTICS_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_GetDeviceStatistics(
                IMA_OID oid,
                IMA_DEVICE_STATISTICS *pStats
);

IMA_API IMA_STATUS IMA_LuInquiry(
                IMA_OID deviceOid,
                IMA_BOOL evpd,
                IMA_BOOL cmddt,
                IMA_BYTE pageCode,

                IMA_BYTE *pOutputBuffer,
                IMA_UINT *pOutputBufferLength,

                IMA_BYTE *pSenseBuffer,
                IMA_UINT *pSenseBufferLength
);

IMA_API IMA_STATUS IMA_LuReadCapacity(
                IMA_OID deviceOid,
                IMA_UINT cdbLength,
                IMA_BYTE *pOutputBuffer,
                IMA_UINT *pOutputBufferLength,

                IMA_BYTE *pSenseBuffer,
                IMA_UINT *pSenseBufferLength
);

IMA_API IMA_STATUS IMA_LuReportLuns(
                IMA_OID deviceOid,
                IMA_BOOL sendToWellKnownLun,
                IMA_BYTE selectReport,

                IMA_BYTE *pOutputBuffer,
                IMA_UINT *pOutputBufferLength,

                IMA_BYTE *pSenseBuffer,
                IMA_UINT *pSenseBufferLength
);

IMA_API IMA_STATUS IMA_ExposeLu(
                IMA_OID luOid
);

IMA_API IMA_STATUS IMA_UnexposeLu(
                IMA_OID luOid
);

IMA_API IMA_STATUS IMA_GetPhbaStatus(
                IMA_OID hbaOid,
                IMA_PHBA_STATUS *pStatus
);

IMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges (
                IMA_OBJECT_VISIBILITY_FN pClientFn
);

IMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges (
                IMA_OBJECT_VISIBILITY_FN pClientFn
);

IMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges (
                IMA_OBJECT_PROPERTY_FN pClientFn
);

IMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges (
                IMA_OBJECT_PROPERTY_FN pClientFn
);


IMA_API IMA_STATUS IMA_GetAddressKeyProperties(
                IMA_OID targetOid,
                IMA_ADDRESS_KEY_PROPERTIES **ppProps
);

IMA_API IMA_STATUS IMA_GetIpProperties(
                IMA_OID oid,
                IMA_IP_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_SetIpConfigMethod(
                IMA_OID oid,
                IMA_BOOL enableDhcpIpConfiguration
);

IMA_API	IMA_STATUS IMA_SetIsnsDiscovery(
		IMA_OID oid,
		IMA_BOOL enableIsnsDiscovery,
		IMA_ISNS_DISCOVERY_METHOD discoveryMethod,
		const IMA_HOST_ID *iSnsHost
);


IMA_API IMA_STATUS IMA_SetSubnetMask(
                IMA_OID oid,
                IMA_IP_ADDRESS subnetMask
);

IMA_API IMA_STATUS IMA_SetDnsServerAddress(
                IMA_OID oid,
                const IMA_IP_ADDRESS *pPrimaryDnsServerAddress,
                const IMA_IP_ADDRESS *pAlternateDnsServerAddress
);

IMA_API IMA_STATUS IMA_SetDefaultGateway(
                IMA_OID oid,
                IMA_IP_ADDRESS defaultGateway
);

IMA_API IMA_STATUS IMA_GetSupportedAuthMethods(
                IMA_OID lhbaOid,
                IMA_BOOL getSettableMethods,
                IMA_UINT *pMethodCount,
                IMA_AUTHMETHOD *pMethodList
);

IMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods(
                IMA_OID lhbaOid,
                IMA_UINT        *pMethodCount,
                IMA_AUTHMETHOD  *pMethodList
);

IMA_API IMA_STATUS IMA_GetInitiatorAuthParms(
                IMA_OID lhbaOid,
                IMA_AUTHMETHOD method,
                IMA_INITIATOR_AUTHPARMS *pParms
);

IMA_API IMA_STATUS IMA_SetInitiatorAuthMethods(
                IMA_OID lhbaOid,
                IMA_UINT methodCount,
                const IMA_AUTHMETHOD *pMethodList
);

IMA_API IMA_STATUS IMA_SetInitiatorAuthParms(
                IMA_OID lhbaOid,
                IMA_AUTHMETHOD method,
                const IMA_INITIATOR_AUTHPARMS *pParms
);


IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList (
                IMA_OID oid,
                IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties(
		IMA_OID staticDiscoveryTargetOid,
		IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_SetStaticDiscovery(
		IMA_OID oid,
		IMA_BOOL enableStaticDiscovery
);

IMA_API IMA_STATUS IMA_GetDiscoveryProperties(
		IMA_OID oid,
		IMA_DISCOVERY_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_AddDiscoveryAddress(
		IMA_OID oid,
		const IMA_TARGET_ADDRESS discoveryAddress,
		IMA_OID *pDiscoveryAddressOid
);

IMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget(
		IMA_OID oid,
		const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget,
		IMA_OID *pStaticDiscoveryTargetOid
);

IMA_API IMA_STATUS IMA_GetAddressKeys(
		IMA_OID targetOid,
		IMA_ADDRESS_KEYS **ppKeys
);

IMA_API IMA_STATUS IMA_GetSessionOidList (
		IMA_OID oid,
		IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetConnectionOidList (
		IMA_OID oid,
		IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList (
		IMA_OID oid,
		IMA_OID_LIST **ppList
);

IMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties (
		IMA_OID discoveryAddressOid,
		IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps
);

IMA_API IMA_STATUS IMA_RemoveDiscoveryAddress (
		IMA_OID oid
);

IMA_API IMA_STATUS QIMA_SetUpdateInterval(IMA_OID pluginOid, time_t interval);

IMA_API IMA_STATUS IMA_CommitHbaParameters (IMA_OID lhba, IMA_COMMIT_LEVEL commitLevel);

#endif

#ifdef __cplusplus
};
#endif