Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _INC_ISCSIDSC
      7 #define _INC_ISCSIDSC
      8 #include <ntddscsi.h>
      9 #if (_WIN32_WINNT >= 0x0600)
     10 #ifdef __cplusplus
     11 extern "C" {
     12 #endif
     13 
     14   typedef enum  {
     15     ISCSI_NO_AUTH_TYPE             = 0,
     16     ISCSI_CHAP_AUTH_TYPE           = 1,
     17     ISCSI_MUTUAL_CHAP_AUTH_TYPE    = 2
     18   } ISCSI_AUTH_TYPES;
     19 
     20   typedef enum  {
     21     ISCSI_DIGEST_TYPE_NONE     = 0,
     22     ISCSI_DIGEST_TYPE_CRC32C   = 1
     23   } ISCSI_DIGEST_TYPES;
     24 
     25   typedef ULONG ISCSI_LOGIN_OPTIONS_INFO_SPECIFIED,
     26 	      *PISCSI_LOGIN_OPTIONS_INFO_SPECIFIED;
     27 #define ISCSI_LOGIN_OPTIONS_HEADER_DIGEST            0x00000001
     28 #define ISCSI_LOGIN_OPTIONS_DATA_DIGEST              0x00000002
     29 #define ISCSI_LOGIN_OPTIONS_MAXIMUM_CONNECTIONS      0x00000004
     30 #define ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_WAIT      0x00000008
     31 #define ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_RETAIN    0x00000010
     32 #define ISCSI_LOGIN_OPTIONS_USERNAME                 0x00000020
     33 #define ISCSI_LOGIN_OPTIONS_PASSWORD                 0x00000040
     34 #define ISCSI_LOGIN_OPTIONS_AUTH_TYPE                0x00000080
     35 
     36 #define ISCSI_LOGIN_OPTIONS_VERSION                  0x00000000
     37 
     38   typedef ULONG ISCSI_LOGIN_FLAGS,
     39 	      *PISCSI_LOGIN_FLAGS;
     40 
     41 #define ISCSI_LOGIN_FLAG_REQUIRE_IPSEC               0x00000001
     42 #define ISCSI_LOGIN_FLAG_MULTIPATH_ENABLED           0x00000002
     43 #define ISCSI_LOGIN_FLAG_RESERVED1                   0x00000004
     44 #define ISCSI_LOGIN_FLAG_ALLOW_PORTAL_HOPPING        0x00000008
     45 #define ISCSI_LOGIN_FLAG_USE_RADIUS_RESPONSE         0x00000010
     46 #define ISCSI_LOGIN_FLAG_USE_RADIUS_VERIFICATION     0x00000020
     47 
     48   typedef ULONGLONG ISCSI_SECURITY_FLAGS,
     49 		  *PISCSI_SECURITY_FLAGS;
     50 
     51 #define ISCSI_SECURITY_FLAG_VALID                    0x00000001
     52 #define ISCSI_SECURITY_FLAG_IKE_IPSEC_ENABLED        0x00000002
     53 #define ISCSI_SECURITY_FLAG_MAIN_MODE_ENABLED        0x00000004
     54 #define ISCSI_SECURITY_FLAG_AGGRESSIVE_MODE_ENABLED  0x00000008
     55 #define ISCSI_SECURITY_FLAG_PFS_ENABLED              0x00000010
     56 #define ISCSI_SECURITY_FLAG_TRANSPORT_MODE_PREFERRED 0x00000020
     57 #define ISCSI_SECURITY_FLAG_TUNNEL_MODE_PREFERRED    0x00000040
     58 
     59 
     60 #define AddIScsiConnection __MINGW_NAME_AW(AddIScsiConnection)
     61 #define AddIScsiSendTargetPortal __MINGW_NAME_AW(AddIScsiSendTargetPortal)
     62 #define AddIScsiStaticTarget __MINGW_NAME_AW(AddIScsiStaticTarget)
     63 #define RemoveIScsiStaticTarget __MINGW_NAME_AW(RemoveIScsiStaticTarget)
     64 #define AddISNSServer __MINGW_NAME_AW(AddISNSServer)
     65 #define AddPersistentiScsiDevice __MINGW_NAME_AW(AddPersistentiScsiDevice)
     66 #define RemoveIScsiPersistentTarget __MINGW_NAME_AW(RemoveIScsiPersistentTarget)
     67 #define RemovePersistentIScsiDevice __MINGW_NAME_AW(RemovePersistentIScsiDevice)
     68 #define PERSISTENT_ISCSI_LOGIN_INFO __MINGW_NAME_AW(PERSISTENT_ISCSI_LOGIN_INFO)
     69 #define AddRadiusServer __MINGW_NAME_AW(AddRadiusServer)
     70 #define RemoveRadiusServer __MINGW_NAME_AW(RemoveRadiusServer)
     71 
     72 #define MAX_ISCSI_PORTAL_NAME_LEN 256
     73 #define MAX_ISCSI_PORTAL_ADDRESS_LEN 256
     74 #define MAX_ISCSI_HBANAME_LEN 256
     75 
     76 typedef enum _TARGET_INFORMATION_CLASS {
     77   ProtocolType,
     78   TargetAlias,
     79   DiscoveryMechanisms,
     80   PortalGroups,
     81   PersistentTargetMappings,
     82   InitiatorName,
     83   TargetFlags,
     84   LoginOptions
     85 } TARGET_INFORMATION_CLASS;
     86 
     87 typedef enum _TARGETPROTOCOLTYPE {
     88   ISCSI_TCP_PROTOCOL_TYPE
     89 } TARGETPROTOCOLTYPE;
     90 
     91 typedef enum _IKE_AUTHENTICATION_METHOD {
     92   IKE_AUTHENTICATION_PRESHARED_KEY_METHOD    = 1
     93 } IKE_AUTHENTICATION_METHOD, *PIKE_AUTHENTICATION_METHOD;
     94 
     95 typedef struct _ISCSI_LOGIN_OPTIONS {
     96   ULONG                              Version;
     97   ISCSI_LOGIN_OPTIONS_INFO_SPECIFIED InformationSpecified;
     98   ISCSI_LOGIN_FLAGS                  LoginFlags;
     99   ISCSI_AUTH_TYPES                   AuthType;
    100   ISCSI_DIGEST_TYPES                 HeaderDigest;
    101   ISCSI_DIGEST_TYPES                 DataDigest;
    102   ULONG                              MaximumConnections;
    103   ULONG                              DefaultTime2Wait;
    104   ULONG                              DefaultTime2Retain;
    105   ULONG                              UsernameLength;
    106   ULONG                              PasswordLength;
    107   PUCHAR                             Username;
    108   PUCHAR                             Password;
    109 } ISCSI_LOGIN_OPTIONS, *PISCSI_LOGIN_OPTIONS, *PSCSI_LOGIN_OPTIONS, *PISCI_LOGIN_OPTIONS;
    110 
    111 typedef struct _ISCSI_TARGET_PORTALA {
    112   CHAR  SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    113   CHAR  Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    114   USHORT Socket;
    115 } ISCSI_TARGET_PORTALA, *PISCSI_TARGET_PORTALA;
    116 
    117 typedef struct _ISCSI_TARGET_PORTALW {
    118   WCHAR  SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    119   WCHAR  Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    120   USHORT Socket;
    121 } ISCSI_TARGET_PORTALW, *PISCSI_TARGET_PORTALW;
    122 
    123 typedef struct _ISCSI_TARGET_PORTAL_GROUPA {
    124   ULONG               Count;
    125   ISCSI_TARGET_PORTALA Portals[1];
    126 } ISCSI_TARGET_PORTAL_GROUPA, *PISCSI_TARGET_PORTAL_GROUPA;
    127 
    128 typedef struct _ISCSI_TARGET_PORTAL_GROUPW {
    129   ULONG               Count;
    130   ISCSI_TARGET_PORTALW Portals[1];
    131 } ISCSI_TARGET_PORTAL_GROUPW, *PISCSI_TARGET_PORTAL_GROUPW;
    132 
    133 typedef struct _ISCSI_LUN_LIST {
    134   ULONG     OSLUN;
    135   ULONGLONG TargetLUN;
    136 } SCSI_LUN_LIST, *PSCSI_LUN_LIST;
    137 
    138 typedef struct _ISCSI_UNIQUE_SESSION_ID {
    139   ULONGLONG AdapterUnique;
    140   ULONGLONG AdapterSpecific;
    141 }
    142 ISCSI_UNIQUE_SESSION_ID,    *PISCSI_UNIQUE_SESSION_ID,
    143 ISCSI_UNIQUE_CONNECTION_ID, *PISCSI_UNIQUE_CONNECTION_ID;
    144 
    145 typedef struct _ISCSI_TARGET_MAPPINGA {
    146   CHAR                    InitiatorName[MAX_ISCSI_HBANAME_LEN];
    147   CHAR                    TargetName[MAX_ISCSI_NAME_LEN];
    148   CHAR                    OSDeviceName[MAX_PATH];
    149   ISCSI_UNIQUE_SESSION_ID SessionId;
    150   ULONG                   OSBusNumber;
    151   ULONG                   OSTargetNumber;
    152   ULONG                   LUNCount;
    153   PSCSI_LUN_LIST          LUNList;
    154 } ISCSI_TARGET_MAPPINGA, *PISCSI_TARGET_MAPPINGA;
    155 
    156 typedef struct _ISCSI_TARGET_MAPPINGW {
    157   WCHAR                   InitiatorName[MAX_ISCSI_HBANAME_LEN];
    158   WCHAR                   TargetName[MAX_ISCSI_NAME_LEN];
    159   WCHAR                   OSDeviceName[MAX_PATH];
    160   ISCSI_UNIQUE_SESSION_ID SessionId;
    161   ULONG                   OSBusNumber;
    162   ULONG                   OSTargetNumber;
    163   ULONG                   LUNCount;
    164   PSCSI_LUN_LIST          LUNList;
    165 } ISCSI_TARGET_MAPPINGW, *PISCSI_TARGET_MAPPINGW;
    166 
    167 typedef struct _PERSISTENT_ISCSI_LOGIN_INFOA {
    168   CHAR                   TargetName[MAX_ISCSI_NAME_LEN];
    169   BOOLEAN                IsInformationalSession;
    170   CHAR                   InitiatorInstance[MAX_ISCSI_HBANAME_LEN];
    171   ULONG                  InitiatorPortNumber;
    172   ISCSI_TARGET_PORTALA   TargetPortal;
    173   ISCSI_SECURITY_FLAGS   SecurityFlags;
    174   PISCSI_TARGET_MAPPINGA Mappings;
    175   ISCSI_LOGIN_OPTIONS    LoginOptions;
    176 } PERSISTENT_ISCSI_LOGIN_INFOA, *PPERSISTENT_ISCSI_LOGIN_INFOA;
    177 
    178 typedef struct _PERSISTENT_ISCSI_LOGIN_INFOW {
    179   CHAR                   TargetName[MAX_ISCSI_NAME_LEN];
    180   BOOLEAN                IsInformationalSession;
    181   CHAR                   InitiatorInstance[MAX_ISCSI_HBANAME_LEN];
    182   ULONG                  InitiatorPortNumber;
    183   ISCSI_TARGET_PORTALW   TargetPortal;
    184   ISCSI_SECURITY_FLAGS   SecurityFlags;
    185   PISCSI_TARGET_MAPPINGW Mappings;
    186   ISCSI_LOGIN_OPTIONS    LoginOptions;
    187 } PERSISTENT_ISCSI_LOGIN_INFOW, *PPERSISTENT_ISCSI_LOGIN_INFOW;
    188 
    189 typedef UCHAR IKE_IDENTIFICATION_PAYLOAD_TYPE, *PIKE_IDENTIFICATION_PAYLOAD_TYPE;
    190 
    191 typedef struct _IKE_AUTHENTICATION_PRESHARED_KEY {
    192   ISCSI_SECURITY_FLAGS            SecurityFlags;
    193   IKE_IDENTIFICATION_PAYLOAD_TYPE IdType;
    194   ULONG                           IdLengthInBytes;
    195   PUCHAR                          Id;
    196   ULONG                           KeyLengthInBytes;
    197   PUCHAR                          Key;
    198 } IKE_AUTHENTICATION_PRESHARED_KEY, *PIKE_AUTHENTICATION_PRESHARED_KEY;
    199 
    200 typedef struct _IKE_AUTHENTICATION_INFORMATION {
    201   IKE_AUTHENTICATION_METHOD AuthMethod;
    202   __C89_NAMELESS union {
    203     IKE_AUTHENTICATION_PRESHARED_KEY PsKey;
    204   };
    205 } IKE_AUTHENTICATION_INFORMATION, *PIKE_AUTHENTICATION_INFORMATION;
    206 
    207 typedef struct _ISCSI_CONNECTION_INFOA {
    208   ISCSI_UNIQUE_CONNECTION_ID ConnectionId;
    209   CHAR                       InitiatorAddress;
    210   CHAR                       TargetAddress;
    211   USHORT                     InitiatorSocket;
    212   USHORT                     TargetSocket;
    213   UCHAR                      CID[2];
    214 } ISCSI_CONNECTION_INFOA, *PISCSI_CONNECTION_INFOA;
    215 
    216 typedef struct _ISCSI_CONNECTION_INFO {
    217   ISCSI_UNIQUE_CONNECTION_ID ConnectionId;
    218   TCHAR                      InitiatorAddress;
    219   TCHAR                      TargetAddress;
    220   USHORT                     InitiatorSocket;
    221   USHORT                     TargetSocket;
    222   UCHAR                      CID[2];
    223 } ISCSI_CONNECTION_INFOW, *PISCSI_CONNECTION_INFOW;
    224 
    225 typedef struct _ISCSI_SESSION_INFOA {
    226   ISCSI_UNIQUE_SESSION_ID SessionId;
    227   CHAR                    InitiatorName;
    228   CHAR                    TargetName;
    229   CHAR                    TargetNodeName;
    230   UCHAR                   ISID[6];
    231   UCHAR                   TSID[2];
    232   ULONG                   ConnectionCount;
    233   PISCSI_CONNECTION_INFOA Connections;
    234 } ISCSI_SESSION_INFOA, *PISCSI_SESSION_INFOA;
    235 
    236 typedef struct _ISCSI_SESSION_INFO {
    237   ISCSI_UNIQUE_SESSION_ID SessionId;
    238   WCHAR                   InitiatorName;
    239   WCHAR                   TargetName;
    240   WCHAR                   TargetNodeName;
    241   UCHAR                   ISID[6];
    242   UCHAR                   TSID[2];
    243   ULONG                   ConnectionCount;
    244   PISCSI_CONNECTION_INFOW Connections;
    245 } ISCSI_SESSION_INFOW, *PISCSI_SESSION_INFOW;
    246 
    247 typedef struct _ISCSI_VERSION_INFO {
    248   ULONG MajorVersion;
    249   ULONG MinorVersion;
    250   ULONG BuildNumber;
    251 } ISCSI_VERSION_INFO, *PISCSI_VERSION_INFO;
    252 
    253 typedef struct _ISCSI_TARGET_PORTAL_INFOA {
    254   CHAR   InitiatorName[MAX_ISCSI_HBANAME_LEN];
    255   ULONG  InitiatorPortNumber;
    256   CHAR   SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    257   CHAR   Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    258   USHORT Socket;
    259 } ISCSI_TARGET_PORTAL_INFOA, *PISCSI_TARGET_PORTAL_INFOA;
    260 
    261 typedef struct _ISCSI_TARGET_PORTAL_INFOW {
    262   WCHAR  InitiatorName[MAX_ISCSI_HBANAME_LEN];
    263   ULONG  InitiatorPortNumber;
    264   WCHAR  SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    265   WCHAR  Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    266   USHORT Socket;
    267 } ISCSI_TARGET_PORTAL_INFOW, *PISCSI_TARGET_PORTAL_INFOW;
    268 
    269 typedef struct _ISCSI_TARGET_PORTAL_INFO_EXA {
    270   CHAR   InitiatorName[MAX_ISCSI_HBANAME_LEN];
    271   ULONG  InitiatorPortNumber;
    272   CHAR   SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    273   CHAR   Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    274   USHORT Socket;
    275   ISCSI_SECURITY_FLAGS SecurityFlags;
    276   ISCSI_LOGIN_OPTIONS  LoginOptions;
    277 } ISCSI_TARGET_PORTAL_INFO_EX, *PISCSI_TARGET_PORTAL_INFO_EX;
    278 
    279 typedef struct _ISCSI_TARGET_PORTAL_INFO_EXW {
    280   WCHAR  InitiatorName[MAX_ISCSI_HBANAME_LEN];
    281   ULONG  InitiatorPortNumber;
    282   WCHAR  SymbolicName[MAX_ISCSI_PORTAL_NAME_LEN];
    283   WCHAR  Address[MAX_ISCSI_PORTAL_ADDRESS_LEN];
    284   USHORT Socket;
    285   ISCSI_SECURITY_FLAGS SecurityFlags;
    286   ISCSI_LOGIN_OPTIONS  LoginOptions;
    287 } ISCSI_TARGET_PORTAL_INFO_EX, *PISCSI_TARGET_PORTAL_INFO_EX;
    288 
    289 __MINGW_TYPEDEF_AW(ISCSI_CONNECTION_INFO)
    290 __MINGW_TYPEDEF_AW(PISCSI_CONNECTION_INFO)
    291 __MINGW_TYPEDEF_AW(ISCSI_SESSION_INFO)
    292 __MINGW_TYPEDEF_AW(PISCSI_SESSION_INFO)
    293 __MINGW_TYPEDEF_AW(ISCSI_TARGET_PORTAL_GROUP)
    294 __MINGW_TYPEDEF_AW(PISCSI_TARGET_PORTAL_GROUP)
    295 __MINGW_TYPEDEF_AW(ISCSI_TARGET_PORTAL)
    296 __MINGW_TYPEDEF_AW(PISCSI_TARGET_PORTAL)
    297 __MINGW_TYPEDEF_AW(ISCSI_TARGET_MAPPING)
    298 __MINGW_TYPEDEF_AW(PISCSI_TARGET_MAPPING)
    299 __MINGW_TYPEDEF_AW(ISCSI_TARGET_PORTAL_INFO)
    300 __MINGW_TYPEDEF_AW(PISCSI_TARGET_PORTAL_INFO)
    301 __MINGW_TYPEDEF_AW(ISCSI_TARGET_PORTAL_INFO_EX)
    302 __MINGW_TYPEDEF_AW(PISCSI_TARGET_PORTAL_INFO_EX)
    303 
    304 typedef ULONG ISCSI_TARGET_FLAGS;
    305 
    306   HRESULT WINAPI AddIScsiConnectionA(PISCSI_UNIQUE_SESSION_ID UniqueSessionId,PVOID Reserved,ULONG InitiatorPortNumber,PISCSI_TARGET_PORTALA TargetPortal,ISCSI_SECURITY_FLAGS SecurityFlags,PSCSI_LOGIN_OPTIONS LoginOptions,ULONG KeySize,PCHAR Key,PISCSI_UNIQUE_CONNECTION_ID ConnectionId);
    307   HRESULT WINAPI AddIScsiConnectionW(PISCSI_UNIQUE_SESSION_ID UniqueSessionId,PVOID Reserved,ULONG InitiatorPortNumber,PISCSI_TARGET_PORTALW TargetPortal,ISCSI_SECURITY_FLAGS SecurityFlags,PSCSI_LOGIN_OPTIONS LoginOptions,ULONG KeySize,PCHAR Key,PISCSI_UNIQUE_CONNECTION_ID ConnectionId);
    308 
    309   HRESULT WINAPI AddIScsiSendTargetPortalA(PCHAR InitiatorName,ULONG InitiatorPortNumber,PISCI_LOGIN_OPTIONS LoginOptions,ISCSI_SECURITY_FLAGS SecurityFlags,PISCSI_TARGET_PORTALA Portal);
    310 
    311   HRESULT WINAPI AddIScsiSendTargetPortalW(PWCHAR InitiatorName,ULONG InitiatorPortNumber,PISCI_LOGIN_OPTIONS LoginOptions,ISCSI_SECURITY_FLAGS SecurityFlags,PISCSI_TARGET_PORTALW Portal);
    312 
    313   HRESULT WINAPI AddIScsiStaticTargetA(PCHAR TargetName,PCHAR TargetAlias,ISCSI_TARGET_FLAGS TargetFlags,BOOLEAN Persist,PISCSI_TARGET_MAPPINGA Mappings,PISCSI_LOGIN_OPTIONS LoginOptions,PISCSI_TARGET_PORTAL_GROUPA PortalGroup);
    314 
    315   HRESULT WINAPI AddIScsiStaticTargetW(PWCHAR TargetName,PWCHAR TargetAlias,ISCSI_TARGET_FLAGS TargetFlags,BOOLEAN Persist,PISCSI_TARGET_MAPPINGW Mappings,PISCSI_LOGIN_OPTIONS LoginOptions,PISCSI_TARGET_PORTAL_GROUPW PortalGroup);
    316 
    317   HRESULT WINAPI AddISNSServerA(PCHAR Address);
    318   HRESULT WINAPI AddISNSServerW(PWCHAR Address);
    319 
    320   HRESULT WINAPI AddRadiusServerA(PCHAR Address);
    321   HRESULT WINAPI AddRadiusServerW(PWCHAR Address);
    322 
    323   HRESULT WINAPI AddPersistentiScsiDeviceA(PCHAR VolumePath);
    324   HRESULT WINAPI AddPersistentiScsiDeviceW(PWCHAR VolumePath);
    325 
    326   HRESULT WINAPI ClearPersistentiScsiDevices(void);
    327 
    328   HRESULT WINAPI RemoveIScsiPersistentTargetA(PCHAR InitiatorInstance,ULONG InitiatorPortNumber,PCHAR TargetName,PISCSI_TARGET_PORTALA Portal);
    329   HRESULT WINAPI RemoveIScsiPersistentTargetW(PWCHAR InitiatorInstance,ULONG InitiatorPortNumber,PWCHAR TargetName,PISCSI_TARGET_PORTALW Portal);
    330 
    331   HRESULT WINAPI RemoveIScsiStaticTargetA(PCHAR TargetName);
    332   HRESULT WINAPI RemoveIScsiStaticTargetW(PWCHAR TargetName);
    333 
    334   HRESULT WINAPI RemovePersistentIScsiDeviceA(PCHAR VolumePath);
    335   HRESULT WINAPI RemovePersistentIScsiDeviceW(PWCHAR VolumePath);
    336 
    337   HRESULT WINAPI RemoveRadiusServerA(PCHAR Address);
    338   HRESULT WINAPI RemoveRadiusServerW(PWCHAR Address);
    339 
    340   HRESULT WINAPI SetupPersistentIScsiDevices(void);
    341 
    342   HRESULT WINAPI SendScsiInquiry(PISCSI_UNIQUE_SESSION_ID *UniqueSessionId,ULONGLONG Lun,UCHAR EvpdCmddt,UCHAR PageCode,PUCHAR *ScsiStatus,PULONG *ReponseSize,PUCHAR ReponseBuffer,PULONG *SenseSize,PUCHAR SenseBuffer);
    343 
    344   HRESULT WINAPI SendScsiReadCapacity(PISCSI_UNIQUE_SESSION_ID UniqueSessionId,ULONGLONG Lun,PUCHAR *ScsiStatus,PULONG *ResponseSize,PUCHAR ResponseBuffer,PULONG *SenseSize,PUCHAR SenseBuffer);
    345 
    346   HRESULT WINAPI SendScsiReportLuns(PISCSI_UNIQUE_SESSION_ID UniqueSessionId,PUCHAR *ScsiStatus,PULONG *ResponseSize,PUCHAR ResponseBuffer,PULONG *SenseSize,PUCHAR SenseBuffer);
    347 
    348 typedef struct _ISCSI_DEVICE_ON_SESSION {
    349   TCHAR                 InitiatorName[MAX_ISCSI_HBANAME_LEN];
    350   TCHAR                 TargetName[MAX_ISCSI_NAME_LEN + 1];
    351   SCSI_ADDRESS          ScsiAddress;
    352   GUID                  DeviceInterfaceType;
    353   TCHAR                 DeviceInterfaceName[MAX_PATH];
    354   TCHAR                 LegacyName[MAX_PATH];
    355   STORAGE_DEVICE_NUMBER StorageDeviceNumber;
    356   DWORD                 DeviceInstance;
    357 } ISCSI_DEVICE_ON_SESSION, *PISCSI_DEVICE_ON_SESSION;
    358 
    359 HRESULT WINAPI GetDevicesForiSCSISession(
    360   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    361   ULONG *DeviceCount,
    362   PISCSI_DEVICE_ON_SESSION Devices
    363 );
    364 
    365 #define GetIScsiIKEInfo __MINGW_NAME_AW(GetIScsiIKEInfo)
    366 
    367 HRESULT WINAPI GetIScsiIKEInfoA(
    368   PCHAR InitiatorName,
    369   ULONG PortNumber,
    370   PULONG Reserved,
    371   PIKE_AUTHENTICATION_INFORMATION *AuthInfo
    372 );
    373 
    374 HRESULT WINAPI GetIScsiIKEInfoW(
    375   PWCHAR InitiatorName,
    376   ULONG PortNumber,
    377   PULONG Reserved,
    378   PIKE_AUTHENTICATION_INFORMATION *AuthInfo
    379 );
    380 
    381 #define GetIScsiInitiatorNodeName __MINGW_NAME_AW(GetIScsiInitiatorNodeName)
    382 
    383 HRESULT WINAPI GetIScsiInitiatorNodeNameA(
    384     PCHAR InitiatorNodeName
    385 );
    386 
    387 HRESULT WINAPI GetIScsiInitiatorNodeNameW(
    388     PWCHAR InitiatorNodeName
    389 );
    390 
    391 #define GetIScsiSessionList __MINGW_NAME_AW(GetIScsiSessionList)
    392 
    393 HRESULT WINAPI GetIScsiSessionListA(
    394   ULONG *BufferSize,
    395   ULONG *SessionCount,
    396   PISCSI_SESSION_INFOA SessionInfo
    397 );
    398 
    399 HRESULT WINAPI GetIScsiSessionListW(
    400   ULONG *BufferSize,
    401   ULONG *SessionCount,
    402   PISCSI_SESSION_INFOW SessionInfo
    403 );
    404 
    405 #define GetIScsiTargetInformation __MINGW_NAME_AW(GetIScsiTargetInformation)
    406 
    407 HRESULT WINAPI GetIScsiTargetInformationA(
    408   PCHAR  TargetName,
    409   PCHAR  DiscoveryMechanism,
    410   TARGET_INFORMATION_CLASS InfoClass,
    411   PULONG BufferSize,
    412   PVOID Buffer
    413 );
    414 
    415 HRESULT WINAPI GetIScsiTargetInformationW(
    416   PWCHAR TargetName,
    417   PWCHAR DiscoveryMechanism,
    418   TARGET_INFORMATION_CLASS InfoClass,
    419   PULONG BufferSize,
    420   PVOID Buffer
    421 );
    422 
    423 HRESULT WINAPI GetIScsiVersionInformation(
    424     PISCSI_VERSION_INFO VersionInfo
    425 );
    426 
    427 HRESULT WINAPI LoginIScsiTargetA(
    428   PCHAR TargetName,
    429   BOOLEAN IsInformationalSession,
    430   PCHAR InitiatorName,
    431   ULONG InitiatorPortNumber,
    432   PISCSI_TARGET_PORTALA TargetPortal,
    433   ISCSI_SECURITY_FLAGS SecurityFlags,
    434   PISCSI_TARGET_MAPPINGA Mappings,
    435   PISCSI_LOGIN_OPTIONS LoginOptions,
    436   ULONG KeySize,
    437   PCHAR Key,
    438   BOOLEAN IsPersistent,
    439   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    440   PISCSI_UNIQUE_CONNECTION_ID UniqueConnectionId
    441 );
    442 
    443 HRESULT WINAPI LoginIScsiTargetW(
    444   PWCHAR TargetName,
    445   BOOLEAN IsInformationalSession,
    446   PWCHAR InitiatorName,
    447   ULONG InitiatorPortNumber,
    448   PISCSI_TARGET_PORTALW TargetPortal,
    449   ISCSI_SECURITY_FLAGS SecurityFlags,
    450   PISCSI_TARGET_MAPPINGW Mappings,
    451   PISCSI_LOGIN_OPTIONS LoginOptions,
    452   ULONG KeySize,
    453   PCHAR Key,
    454   BOOLEAN IsPersistent,
    455   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    456   PISCSI_UNIQUE_CONNECTION_ID UniqueConnectionId
    457 );
    458 
    459 HRESULT WINAPI LogoutIScsiTarget(
    460   PISCSI_UNIQUE_SESSION_ID UniqueSessionId
    461 );
    462 
    463 HRESULT WINAPI RefreshIScsiSendTargetPortalA(
    464   PCHAR InitiatorInstance,
    465   ULONG InitiatorPortNumber,
    466   PISCSI_TARGET_PORTALA Portal
    467 );
    468 
    469 HRESULT WINAPI RefreshIScsiSendTargetPortalW(
    470   PWCHAR InitiatorInstance,
    471   ULONG InitiatorPortNumber,
    472   PISCSI_TARGET_PORTALW Portal
    473 );
    474 
    475 #define RefreshIScsiSendTargetPortal __MINGW_NAME_AW(RefreshIScsiSendTargetPortal)
    476 
    477 HRESULT WINAPI RefreshISNSServerA(
    478   PCHAR Address
    479 );
    480 
    481 HRESULT WINAPI RefreshISNSServerW(
    482   PWCHAR Address
    483 );
    484 
    485 #define RefreshISNSServer __MINGW_NAME_AW(RefreshISNSServer)
    486 
    487 HRESULT WINAPI RemoveIScsiConnection(
    488   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    489   PISCSI_UNIQUE_CONNECTION_ID UniqueConnectionId
    490 );
    491 
    492 HRESULT WINAPI RemoveIScsiPersistentTargetA(
    493   PCHAR InitiatorInstance,
    494   ULONG InitiatorPortNumber,
    495   PCHAR TargetName,
    496   PISCSI_TARGET_PORTALA Portal
    497 );
    498 
    499 HRESULT WINAPI RemoveIScsiPersistentTargetW(
    500   PWCHAR InitiatorInstance,
    501   ULONG InitiatorPortNumber,
    502   PWCHAR TargetName,
    503   PISCSI_TARGET_PORTALW Portal
    504 );
    505 
    506 #define RemoveIScsiPersistentTarget __MINGW_NAME_AW(RemoveIScsiPersistentTarget)
    507 
    508 HRESULT WINAPI RemoveIScsiSendTargetPortalA(
    509   PCHAR InitiatorInstance,
    510   ULONG InitiatorPortNumber,
    511   PISCSI_TARGET_PORTALA Portal
    512 );
    513 
    514 HRESULT WINAPI RemoveIScsiSendTargetPortalW(
    515   PWCHAR InitiatorInstance,
    516   ULONG InitiatorPortNumber,
    517   PISCSI_TARGET_PORTALW Portal
    518 );
    519 
    520 #define RemoveIScsiSendTargetPortal __MINGW_NAME_AW(RemoveIScsiSendTargetPortal)
    521 
    522 HRESULT WINAPI RemoveIScsiStaticTargetA(
    523   PCHAR TargetName
    524 );
    525 
    526 HRESULT WINAPI RemoveIScsiStaticTargetW(
    527   PWCHAR TargetName
    528 );
    529 #define RemoveIScsiStaticTarget __MINGW_NAME_AW(RemoveIScsiStaticTarget)
    530 
    531 HRESULT WINAPI RemoveISNSServerA(
    532   PCHAR Address
    533 );
    534 
    535 HRESULT WINAPI RemoveISNSServerW(
    536   PWCHAR Address
    537 );
    538 #define RemoveISNSServer __MINGW_NAME_AW(RemoveISNSServer)
    539 
    540 HRESULT WINAPI RemovePersistentIScsiDeviceA(
    541   PCHAR VolumePath
    542 );
    543 
    544 HRESULT WINAPI RemovePersistentIScsiDeviceW(
    545   PWCHAR VolumePath
    546 );
    547 #define RemovePersistentIScsiDevice __MINGW_NAME_AW(RemovePersistentIScsiDevice)
    548 
    549 HRESULT WINAPI RemoveRadiusServerA(
    550   PCHAR Address
    551 );
    552 
    553 HRESULT WINAPI RemoveRadiusServerW(
    554   PWCHAR Address
    555 );
    556 #define RemoveRadiusServer __MINGW_NAME_AW(RemoveRadiusServer)
    557 
    558 HRESULT WINAPI ReportIScsiInitiatorListA(
    559   ULONG *BufferSize,
    560   PCHAR Buffer
    561 );
    562 
    563 HRESULT WINAPI ReportIScsiInitiatorListW(
    564   ULONG *BufferSize,
    565   PWCHAR Buffer
    566 );
    567 
    568 HRESULT WINAPI ReportIScsiPersistentLoginsA(
    569   ULONG *Count,
    570   PPERSISTENT_ISCSI_LOGIN_INFOA PersistentLoginInfo,
    571   PULONG BufferSizeInBytes
    572 );
    573 
    574 HRESULT WINAPI ReportIScsiPersistentLoginsW(
    575   ULONG *Count,
    576   PPERSISTENT_ISCSI_LOGIN_INFOW PersistentLoginInfo,
    577   PULONG BufferSizeInBytes
    578 );
    579 #define ReportIScsiPersistentLogins __MINGW_NAME_AW(ReportIScsiPersistentLogins)
    580 
    581 HRESULT WINAPI ReportIScsiSendTargetPortalsA(
    582   PULONG PortalCount,
    583   PISCSI_TARGET_PORTAL_INFOA PortalInfo
    584 );
    585 
    586 HRESULT WINAPI ReportIScsiSendTargetPortalsW(
    587   PULONG PortalCount,
    588   PISCSI_TARGET_PORTAL_INFOA PortalInfo
    589 );
    590 
    591 #define ReportIScsiSendTargetPortals __MINGW_NAME_AW(ReportIScsiSendTargetPortals)
    592 
    593 HRESULT WINAPI ReportActiveIScsiTargetMappingsA(
    594   PULONG BufferSize,
    595   PULONG MappingCount,
    596   PISCSI_TARGET_MAPPINGA Mappings
    597 );
    598 
    599 HRESULT WINAPI ReportActiveIScsiTargetMappingsW(
    600   PULONG BufferSize,
    601   PULONG MappingCount,
    602   PISCSI_TARGET_MAPPINGW Mappings
    603 );
    604 #define ReportActiveIScsiTargetMappings __MINGW_NAME_AW(ReportActiveIScsiTargetMappings)
    605 
    606 HRESULT WINAPI ReportIScsiSendTargetPortalsExA(
    607   PULONG PortalCount,
    608   PULONG PortalInfoSize,
    609   PISCSI_TARGET_PORTAL_INFO_EXA PortalInfo
    610 );
    611 
    612 HRESULT WINAPI ReportIScsiSendTargetPortalsExW(
    613   PULONG PortalCount,
    614   PULONG PortalInfoSize,
    615   PISCSI_TARGET_PORTAL_INFO_EXW PortalInfo
    616 );
    617 
    618 #define ReportIScsiSendTargetPortalsEx __MINGW_NAME_AW(ReportIScsiSendTargetPortalsEx)
    619 
    620 HRESULT WINAPI ReportIScsiTargetPortalsA(
    621   PCHAR  InitiatorName,
    622   PCHAR  TargetName,
    623   PUSHORT TargetPortalTag,
    624   PULONG ElementCount,
    625   PISCSI_TARGET_PORTALA Portals
    626 );
    627 
    628 HRESULT WINAPI ReportIScsiTargetPortalsW(
    629   PWCHAR InitiatorName,
    630   PWCHAR TargetName,
    631   PUSHORT TargetPortalTag,
    632   PULONG ElementCount,
    633   PISCSI_TARGET_PORTALW Portals
    634 );
    635 
    636 #define ReportIScsiTargetPortals __MINGW_NAME_AW(ReportIScsiTargetPortals)
    637 
    638 HRESULT WINAPI ReportIScsiTargetsA(
    639   BOOLEAN ForceUpdate,
    640   PULONG BufferSize,
    641   PCHAR  Buffer
    642 );
    643 
    644 HRESULT WINAPI ReportIScsiTargetsW(
    645   BOOLEAN ForceUpdate,
    646   PULONG BufferSize,
    647   PWCHAR Buffer
    648 );
    649 #define ReportIScsiTargets __MINGW_NAME_AW(ReportIScsiTargets)
    650 
    651 HRESULT WINAPI ReportISNSServerListA(
    652   PULONG BufferSizeInChar,
    653   PCHAR  Buffer
    654 );
    655 
    656 HRESULT WINAPI ReportISNSServerListW(
    657   PULONG BufferSizeInChar,
    658   PWCHAR Buffer
    659 );
    660 
    661 #define ReportISNSServerList __MINGW_NAME_AW(ReportISNSServerList)
    662 
    663 HRESULT WINAPI ReportPersistentiScsiDevicesA(
    664   PULONG BufferSizeInChar,
    665   PCHAR  Buffer
    666 );
    667 
    668 HRESULT WINAPI ReportPersistentiScsiDevicesW(
    669   PULONG BufferSizeInChar,
    670   PWCHAR Buffer
    671 );
    672 
    673 #define ReportPersistentiScsiDevices __MINGW_NAME_AW(ReportPersistentiScsiDevices)
    674 
    675 HRESULT WINAPI ReportRadiusServerListA(
    676   PULONG BufferSizeInChar,
    677   PCHAR  Buffer
    678 );
    679 
    680 HRESULT WINAPI ReportRadiusServerListW(
    681   PULONG BufferSizeInChar,
    682   PCHAR  Buffer
    683 );
    684 #define ReportRadiusServerList __MINGW_NAME_AW(ReportRadiusServerList)
    685 
    686 HRESULT WINAPI SendScsiReadCapacity(
    687   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    688   ULONGLONG Lun,
    689   PUCHAR *ScsiStatus,
    690   PULONG *ResponseSize,
    691   PUCHAR ResponseBuffer,
    692   PULONG *SenseSize,
    693   PUCHAR SenseBuffer
    694 );
    695 
    696 HRESULT WINAPI SendScsiReportLuns(
    697   PISCSI_UNIQUE_SESSION_ID UniqueSessionId,
    698   PUCHAR *ScsiStatus,
    699   PULONG *ResponseSize,
    700   PUCHAR ResponseBuffer,
    701   PULONG *SenseSize,
    702   PUCHAR SenseBuffer
    703 );
    704 
    705 HRESULT WINAPI SendScsiInquiry(
    706   PISCSI_UNIQUE_SESSION_ID *UniqueSessionId,
    707   ULONGLONG Lun,
    708   UCHAR EvpdCmddt,
    709   UCHAR PageCode,
    710   PUCHAR *ScsiStatus,
    711   PULONG *ReponseSize,
    712   PUCHAR ReponseBuffer,
    713   PULONG *SenseSize,
    714   PUCHAR SenseBuffer
    715 );
    716 
    717 HRESULT WINAPI SetIScsiGroupPresharedKey(
    718   ULONG KeyLength,
    719   PUCHAR Key,
    720   BOOLEAN Persist
    721 );
    722 
    723 HRESULT WINAPI SetIScsiInitiatorCHAPSharedSecret(
    724   ULONG SharedSecretLength,
    725   PUCHAR SharedSecret
    726 );
    727 
    728 HRESULT WINAPI SetIScsiInitiatorNodeNameA(
    729   PCHAR InitiatorNodeName
    730 );
    731 
    732 HRESULT WINAPI SetIScsiInitiatorNodeNameW(
    733   PWCHAR InitiatorNodeName
    734 );
    735 
    736 #define SetIScsiInitiatorNodeName __MINGW_NAME_AW(SetIScsiInitiatorNodeName)
    737 
    738 HRESULT WINAPI SetIscsiInitiatorRADIUSSharedSecret(
    739   ULONG SharedSecretLength,
    740   PUCHAR SharedSecret
    741 );
    742 
    743 HRESULT WINAPI SetIScsiTunnelModeOuterAddressA(
    744   PCHAR InitiatorName,
    745   ULONG InitiatorPortNumber,
    746   PCHAR DestinationAddress,
    747   PCHAR OuterModeAddress,
    748   BOOLEAN Persist
    749 );
    750 
    751 HRESULT WINAPI SetIScsiTunnelModeOuterAddressW(
    752   PWCHAR InitiatorName,
    753   ULONG  InitiatorPortNumber,
    754   PWCHAR DestinationAddress,
    755   PWCHAR OuterModeAddress,
    756   BOOLEAN Persist
    757 );
    758 
    759 #define SetIScsiTunnelModeOuterAddress __MINGW_NAME_AW(SetIScsiTunnelModeOuterAddress)
    760 
    761 HRESULT WINAPI SetupPersistentIScsiDevices(void);
    762 
    763 #ifdef __cplusplus
    764 }
    765 #endif
    766 #endif /*(_WIN32_WINNT >= 0x0600)*/
    767 #endif
    768