//+---------------------------------------------------------------------------
//
//    Microsoft Windows
//    Copyright (C) Microsoft Corporation, 2000
//
//    File: vdslun.idl
//
//    Abstract:
//        Declaration of VDS_LUN_INFORMATION and related structures.
//
//----------------------------------------------------------------------------



///////////////////////////////////////////////////////////////////////////////
//  Imports
//


import "oaidl.idl";
import "ocidl.idl";



// Mode page 83 data types corresponding to STORAGE_IDENTIFIER_CODE_SET in ntddstor.h
typedef enum _VDS_STORAGE_IDENTIFIER_CODE_SET
{
    VDSStorageIdCodeSetReserved = 0,
    VDSStorageIdCodeSetBinary   = 1,
    VDSStorageIdCodeSetAscii    = 2,
    VDSStorageIdCodeSetUtf8     = 3
} VDS_STORAGE_IDENTIFIER_CODE_SET;


// Mode page 83 identifier types corresponding to STORAGE_IDENTIFIER_TYPE in ntddstor.h
typedef enum _VDS_STORAGE_IDENTIFIER_TYPE
{
    VDSStorageIdTypeVendorSpecific              = 0,
    VDSStorageIdTypeVendorId                    = 1,
    VDSStorageIdTypeEUI64                       = 2,
    VDSStorageIdTypeFCPHName                    = 3,
    VDSStorageIdTypePortRelative                = 4,
    VDSStorageIdTypeTargetPortGroup             = 5,
    VDSStorageIdTypeLogicalUnitGroup            = 6,
    VDSStorageIdTypeMD5LogicalUnitIdentifier    = 7,
    VDSStorageIdTypeScsiNameString              = 8
} VDS_STORAGE_IDENTIFIER_TYPE;


// Bus types corresponding to STORAGE_BUS_TYPE in ntddstor.h
typedef enum _VDS_STORAGE_BUS_TYPE
{
    VDSBusTypeUnknown       = 0x00,
    VDSBusTypeScsi          = 0x01,
    VDSBusTypeAtapi         = 0x02,
    VDSBusTypeAta           = 0x03,
    VDSBusType1394          = 0x04,
    VDSBusTypeSsa           = 0x05,
    VDSBusTypeFibre         = 0x06,
    VDSBusTypeUsb           = 0x07,
    VDSBusTypeRAID          = 0x08,
    VDSBusTypeiScsi         = 0x09,
    VDSBusTypeSas           = 0x0A,
    VDSBusTypeSata          = 0x0B,
    VDSBusTypeSd            = 0x0C,
    VDSBusTypeMmc           = 0x0D,
    VDSBusTypeMax           = 0x0E,
    VDSBusTypeFileBackedVirtual  = 0x0F,

    VDSBusTypeMaxReserved   = 0x7F
} VDS_STORAGE_BUS_TYPE;


// Storage identifier corresponding to STORAGE_IDENTIFIER in ntddstor.h
typedef struct _VDS_STORAGE_IDENTIFIER
{
    // whether ascii or binary data
    VDS_STORAGE_IDENTIFIER_CODE_SET m_CodeSet;

    // type of identifier
    VDS_STORAGE_IDENTIFIER_TYPE     m_Type;

    // length of identifier in bytes
    ULONG                           m_cbIdentifier;

    // actual identintifier
    [size_is(m_cbIdentifier)] BYTE  *m_rgbIdentifier;
} VDS_STORAGE_IDENTIFIER;

// Mode page 83 is mandatory, returns a list of identifiers.
// Device ID descriptor corresponding to STORAGE_DEVICE_ID_DESCRIPTOR in ntddstor.h
typedef struct _VDS_STORAGE_DEVICE_ID_DESCRIPTOR
{
    // version of structure
    ULONG                                               m_version;

    // number of identifiers
    ULONG                                               m_cIdentifiers;

    [size_is(m_cIdentifiers)] VDS_STORAGE_IDENTIFIER    *m_rgIdentifiers;
} VDS_STORAGE_DEVICE_ID_DESCRIPTOR;

// Interconnect address types
typedef enum _VDS_INTERCONNECT_ADDRESS_TYPE
{
    VDS_IA_UNKNOWN  = 0,
    VDS_IA_FCFS     = 1,
    VDS_IA_FCPH     = 2,
    VDS_IA_FCPH3    = 3,
    VDS_IA_MAC      = 4,
    VDS_IA_SCSI     = 5
} VDS_INTERCONNECT_ADDRESS_TYPE;

// Physical interconnect
//
// This part of VDS was initially defined in the context of
// VSS hardware transportable snapshots. From the VSS hardware
// provider documentation:
// VDS_INTERCONNECT_ADDRESS_TYPE is an enumeration of
// recognized interconnect addressing schemes and includes, but
// is not limited to, FCFS, FCPH, FCP3, MAC (iSCSI), and SCSI.
// By default, it is empty, and it is recommended that this is
// left empty.
//
// The original thinking was that we might need a field to tell
// other (wave your hands here) software how to interpret and/or
// display in a nice way the other fields in VDS_INTERCONNECT.
//
// However, our current clients (Storage Manager for SANs and
// DiskRAID) don’t use it anyway.
// We recommend that you leave this field blank, as it is not
// likely to be used by clients.
//
typedef struct _VDS_INTERCONNECT
{
    // address type
    VDS_INTERCONNECT_ADDRESS_TYPE   m_addressType;

    // port that address refers to
    ULONG                           m_cbPort;

    // actual address of port
    [size_is(m_cbPort)] BYTE        *m_pbPort;

    // size of address
    ULONG                           m_cbAddress;

    // address relative to the port
    [size_is(m_cbAddress)] BYTE     *m_pbAddress;
} VDS_INTERCONNECT;



// Information about a lun.  Includes STORAGE_DEVICE_DESCRIPTOR
// (from ntddstor.h) STORAGE_DEVICE_ID_DESCRIPTOR, interconnect address type,
// and interconnect address.
typedef struct _VDS_LUN_INFORMATION
{
    // version of structure
    ULONG                                           m_version;

    // The SCSI-2 device type
    BYTE                                            m_DeviceType;

    // The SCSI-2 device type modifier (if any) - this may be zero
    BYTE                                            m_DeviceTypeModifier;

    // Flag indicating whether the device can support mulitple outstanding
    // commands.  The actual synchronization in this case is the responsibility
    // of the port driver.
    BOOL                                            m_bCommandQueueing;

    // Contains the bus type (as defined above) of the device.  It should be
    // used to interpret the raw device properties at the end of this structure
    // (if any).
    // The bus type for mode page 0x83 is currently determined by looking at the
    // registry, which is set by the inf.
    // This results in the bus type being bogus if the driver writer did not set
    // this property correctly.
    VDS_STORAGE_BUS_TYPE                            m_BusType;


    // vendor id string.  For devices with no such ID this will be zero
    [string] char                                   *m_szVendorId;

    // device's product id string.  For devices with no such ID this will be zero
    [string] char                                   *m_szProductId;

    // zero-terminated ascii string containing the device's
    // product revision string.  For devices with no such string this will be
    // zero
    [string] char                                   *m_szProductRevision;

    // zero-terminated ascii string containing the device's
    // serial number.  For devices with no serial number this will be zero.
    // Mode page 0x80, optional
    [string] char                                   *m_szSerialNumber;

    // disk signature
    GUID                                            m_diskSignature;

    // device id descriptor
    VDS_STORAGE_DEVICE_ID_DESCRIPTOR                m_deviceIdDescriptor;

    // number of interconnects
    ULONG                                           m_cInterconnects;

    // array of interconnects
    [size_is(m_cInterconnects)] VDS_INTERCONNECT    *m_rgInterconnects;
} VDS_LUN_INFORMATION;

const ULONG VER_VDS_LUN_INFORMATION = 1;

