//***************************************************************************
//
//  fccimmap.mof
// 
//  Module: Fibre channel CIM Mapping classes
//
//  Purpose: Contains Fibre channel classes used for a generic 
//           mapping from WDM fibre channel classes. 
//
//  Copyright (c) 2001 Microsoft Corporation
//
//***************************************************************************


#pragma namespace("\\\\.\\root\\cimv2")

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_Card"),
 DerivedClassType("NonConcrete")
]
class FC_Card : CIM_Card
{
    [key]
    string InstanceName;

//
// CIM_ManagedElement
//
    [WmiMapFill,
     MaxLen (64), Description (  
      "The Caption property is a short textual description (one-"    
      "line string) of the object.") : amended
    ]   
    string Caption;  

    [WmiMapFill,
     Description (  
      "The Description property provides a textual description of "
      "the object.") 
    ]   
    string Description;    

//
// CIM_ManagedSystemElement
//
    [WmiMapFill,
     Description (
         "A datetime value indicating when the object was installed. "
         "A lack of a value does not indicate that the object is not "
         "installed.") : amended, 
         MappingStrings {"MIF.DMTF|ComponentID|001.5"} ] 
    datetime InstallDate;

//
// CIM_PhysicalElement
//
    [WmiMapFill,
     MaxLen (256), Description (
         "CreationClassName indicates the name of the class or the "
         "subclass used in the creation of an instance. When used "
         "with the other key properties of this class, this property "
         "allows all instances of this class and its subclasses to "
         "be uniquely identified.") : amended ]
    string CreationClassName;

    [WmiMapFill,
     MaxLen (256), Description (
         "The name of the organization responsible for producing the "
         "PhysicalElement. This may be the entity from whom the Element "
         "is purchased, but this is not necessarily true. The latter "
         "information is contained in the Vendor property of "
         "CIM_Product.") : amended ] 
    string Manufacturer;

//
// CIM_PhysicalPackage
//
    
};


[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_PhysicalConnector"),
 DerivedClassType("NonConcrete")
]
class FC_PhysicalConnector : CIM_PhysicalConnector
{
    [key]
    string InstanceName;

//
// CIM_ManagedElement
//
    [WmiMapFill,
     MaxLen (64), Description (  
      "The Caption property is a short textual description (one-"    
      "line string) of the object.") : amended
    ]   
    string Caption;  

    [WmiMapFill,
     Description (  
      "The Description property provides a textual description of "
      "the object.") 
    ]   
    string Description;    

//
// CIM_ManagedSystemElement
//
    [WmiMapFill,
     Description (
         "A datetime value indicating when the object was installed. "
         "A lack of a value does not indicate that the object is not "
         "installed.") : amended, 
         MappingStrings {"MIF.DMTF|ComponentID|001.5"} ] 
    datetime InstallDate;

//
// CIM_PhysicalElement
//
    [WmiMapFill,
     MaxLen (256), Description (
         "CreationClassName indicates the name of the class or the "
         "subclass used in the creation of an instance. When used "
         "with the other key properties of this class, this property "
         "allows all instances of this class and its subclasses to "
         "be uniquely identified.") : amended ]
    string CreationClassName;

    [WmiMapFill,
     MaxLen (256), Description (
         "The name of the organization responsible for producing the "
         "PhysicalElement. This may be the entity from whom the Element "
         "is purchased, but this is not necessarily true. The latter "
         "information is contained in the Vendor property of "
         "CIM_Product.") : amended ] 
    string Manufacturer;

//
// CIM_PhysicalConnector
//

};


//
// TODO: Need WmiMapFill properties
//
[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibreChannelAdapter"),
 DerivedClassType("NonConcrete")
]
class FC_FibreChannelAdapter : CIM_FibreChannelAdapter
{
    [key]
    string InstanceName;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_ScsiController"),
 DerivedClassType("NonConcrete")
]
class FC_ScsiController : CIM_ScsiController
{
    [key]
    string InstanceName;
};


[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePort"),
 DerivedClassType("NonConcrete")
]
class FC_FibrePort : CIM_FibrePort
{
    [key]
    string InstanceName;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePortOnFCAdapter"),
 DerivedClassType("NonConcrete")
]
class FC_FibrePortOnFCAdapter : CIM_FibrePortOnFCAdapter
{
    [key]
    string InstanceName;

    [Override ("Antecedent"), 
     Max (1), 
     Description ("The FibreChannelAdapter that includes the Port.") : amended
    ]
    FC_FibreChannelAdapter REF Antecedent;

    [Override ("Dependent"), 
     Max (1), 
     Description ("The FibrePort on the Adapter.") : amended
    ]
    FC_FibrePort REF Dependent;    
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FCAdapterEventCounters"),
 DerivedClassType("NonConcrete")
]
class FC_FCAdapterEventCounters : CIM_FCAdapterEventCounters
{
    [key]
    string InstanceName;

    [WmiMapFill,
     MaxLen (256),
     Description (
          "The scoping System's CreationClassName.") : amended
    ]
    string SystemCreationClassName;

    [WmiMapFill,
     MaxLen (256),
     Description ("The scoping System's Name.") : amended
    ]
    string SystemName;

    [WmiMapFill,
     MaxLen (256), 
     Description ("The scoping Device's CreationClassName.") : amended 
    ]
    string DeviceCreationClassName;

    [WmiMapFill,
     MaxLen (64), 
     Description ("The scoping Device's ID.") : amended
    ]
    string DeviceID;

    [WmiMapFill,
     MaxLen (256), Description (
         "CreationClassName indicates the name of the class or the "
         "subclass used in the creation of an instance. When used "
         "with the other key properties of this class, this property "
         "allows all instances of this class and its subclasses to "
         "be uniquely identified.") : amended 
    ]
    string CreationClassName;

    [MaxLen (256), Override ("Name"), Description (
	   "The Name property, inherited from StatisticalInformation, "
         "serves as part of the object key.") : amended 
    ]
    string Name;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePortEventCounters"),
 DerivedClassType("NonConcrete")
]
class FC_FCFibrePortEventCounters : CIM_FibrePortEventCounters
{
    [key]
    string InstanceName;

    [WmiMapFill,
     MaxLen (256),
     Description (
          "The scoping System's CreationClassName.") : amended
    ]
    string SystemCreationClassName;

    [WmiMapFill,
     MaxLen (256),
     Description ("The scoping System's Name.") : amended
    ]
    string SystemName;

    [WmiMapFill,
     MaxLen (256), 
     Description ("The scoping Device's CreationClassName.") : amended 
    ]
    string DeviceCreationClassName;

    [WmiMapFill,
     MaxLen (64), 
     Description ("The scoping Device's ID.") : amended
    ]
    string DeviceID;

    [WmiMapFill,
     MaxLen (256), Description (
         "CreationClassName indicates the name of the class or the "
         "subclass used in the creation of an instance. When used "
         "with the other key properties of this class, this property "
         "allows all instances of this class and its subclasses to "
         "be uniquely identified.") : amended 
    ]
    string CreationClassName;

    [MaxLen (256), Override ("Name"), Description (
	   "The Name property, inherited from StatisticalInformation, "
         "serves as part of the object key.") : amended 
    ]
    string Name;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePortActiveLogin"),
 DerivedClassType("NonConcrete")
]
class FC_FibrePortActiveLogin : CIM_FibrePortActiveLogin
{
    [Description ("The originator of the login.") : amended 
    ]
    FC_FibrePort REF LoginOriginator;

    [Description ("The responder to the login.") : amended
    ]
    FC_FibrePort REF LoginResponder;
};


#if 0
//
// This is a CIM extension class that specifies the additonal 
// adapter attributes needed for HBA. Where do these go in the CIM Heirarchy ?
//

// TODO: Get descriptions from FC-MI

[HBAType("HBA_PORTSTATISTICS")
]
class CIMExt_FibrePortHBAStatistics
{
    sint64 SecondsSinceLastReset;
    sint64 TxFrames;
    sint64 TxWords;
    sint64 RxFrames;
    sint64 RxWords;
    sint64 LIPCount;
    sint64 NOSCount;
    sint64 ErrorFrames;
    sint64 DumpedFrames;
    sint64 LinkFailureCount;
    sint64 LossOfSyncCount;
    sint64 LossOfSignalCount;
    sint64 PrimitiveSeqProtocolErrCount;
    sint64 InvalidTxWordCount;
    sint64 InvalidCRCCount;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePortHBAStatistics"),
 DerivedClassType("NonConcrete")
]
class FC_FibrePortHBAStatistics : CIMExt_FibrePortHBAStatistics
{
    [key]
    string InstanceName;
};


[HBAType("HBA_PORTATTRIBUTES")
]
class CIMExt_FibrePortHBAAttributes
{
    CIM_FibrePort Ref Port;

    [HBAType("HBA_WWN")
    ]
    uint8 NodeWWN[8];

    [HBAType("HBA_WWN")
    ]
    uint8 PortWWN[8];

    uint32 PortFcId;
    [HBAType("HBA_PORTTYPE"),
     Values{"Unknown", "Other", "Not present", "Fabric", "Public Loop",
            "HBA_PORTTYPE_FLPORT", "Fabric Port", "Fabric expansion port",
            "Generic Fabric Port", "Private Loop", "Point to Point"} : amended,
     ValueMap{"1", "2", "3", "5", "6", "7", "8", "9", "10", "20", "21"}
    ]
    uint32 PortType;

    [HBAType("HBA_PORTSTATE"),
     Values{"Unknown", "Operational", "User Offline", "Bypassed", 
            "In diagnostics mode", "Link Down", "Port Error", "Loopback"
           } : amended,
     ValueMap{"1","2","3","4","5","6","7","8"}
    ]
    uint32 PortState;

    // TODO: See GS-2 spec for enumeration/ValueMap
    [HBAType("HBA_COS")
    ]
    uint32 PortSupportedClassofService;

    [HBAType("HBA_FC4TYPES")
    ]
    uint8 PortSupportedFc4Types[32];

    [HBAType("HBA_FC4TYPES")
    ]
    uint8 PortActiveFc4Types[32];

    [MaxLen(256)
    ]
    string PortSymbolicName;

    [MaxLen(256)
    ]
    string OSDeviceName;

    [HBAType("HBA_PORTSPEED"),
     Values{"1 GBit/sec", "2 GBit/sec", "10 GBit/sec"} : amended,
     ValueMap{"1", "2", "4"}
    ]
    uint32 PortSupportedSpeed;

    [HBAType("HBA_PORTSPEED"),
     Values{"1 GBit/sec", "2 GBit/sec", "10 GBit/sec"} : amended,
     ValueMap{"1", "2", "4"}
    ]
    uint32 PortSpeed;

    uint32 PortMaxFrameSize;
    [HBAType("HBA_WWN")
    ]
    uint8 FabricName[8];
    uint32 NumberofDiscoveredPorts;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FibrePortHBAAttributes"),
 DerivedClassType("NonConcrete")
]
class FC_FibrePortHBAAttributes : CIMExt_FibrePortHBAAttributes
{
    [key]
    string InstanceName;
};


[HBAType("HBA_ADAPTERATTRIBUTES")
]
class CIMExt_FCAdapterHBAAttributes
{
    CIM_FibreChannelAdapter REF Adapter;

    [MaxLen(64)
    ]
    string Manufacturer;

    [MaxLen(64)
    ]
    string SerialNumber; 

    [MaxLen(256)
    ]
    string Model; 

    [MaxLen(256)
    ]
    string ModelDescription; 

    [HBAType("HBA_WWN")
    ]
    uint8 NodeWWN[8];

    [MaxLen(256)
    ]
    string NodeSymbolicName; 

    [MaxLen(256)
    ]
    string HardwareVersion; 

    [MaxLen(256)
    ]
    string DriverVersion; 

    [MaxLen(256)
    ]
    string OptionROMVersion; 

    [MaxLen(256)
    ]
    string FirmwareVersion; 

    uint32 VendorSpecificID;
    uint32 NumberOfPorts;

    [MaxLen(256)
    ]
    string DriverName; 

};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_FCAdapterHBAAttributes"),
 DerivedClassType("NonConcrete")
]
class FC_FCAdapterHBAAttributes : CIMExt_FCAdapterHBAAttributes
{
    [key]
    string InstanceName;
};


[HBAType("HBA_MGMTINFO")
]
class CIMExt_HBAFC3MgmtInfo
{
    CIM_FibreChannelAdapter REF Adapter;

    [HBAType("HBA_WWN")
    ]
    uint8 wwn[8];

    uint32 unittype;
    uint32 PortId;
    uint32 NumberOfAttachedNodes;
    uint16 IPVersion;
    uint16 UDPPort;
    uint8 IPAddress[16];
    uin16 reserved;
    uint16 TopologyDiscoveryFlags;
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_HBAFC3MgmtInfo"),
 DerivedClassType("NonConcrete")
]
class FC_HBAFC3MgmtInfo : CIMExt_HBAFC3MgmtInfo
{
    [key]
    string InstanceName;
};


class CIMExt_HBAPortMethods
{
    [HBAType("HBA_STATUS")
    ]
    uint32 GetDiscoveredPortAttributes([in] CIM_FibrePort Ref Port,
                                       [in] uint32 DiscoveredPortIndex,
                                       [out] CIMExt_FibrePortHBAAttributes PortAttributes);

    [HBAType("HBA_STATUS")
    ]
    uint32 GetPortAttributesByWWN([in,
                                   HBAType("HBA_WWN")
                                   ] uint8 wwn[8],
                                  [out] CIMExt_FibrePortHBAAttributes PortAttributes);
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_HBAPortMethods"),
 DerivedClassType("NonConcrete")
]
class FC_HBAPortMethods : CIMExt_HBAPortMethods
{
    [key]
    string InstanceName;
};

class CIMExt_HBAFc3MgmtMethods
{
    [HBAType("HBA_STATUS")
    ]
    uint32 SendCTPassThru([in] uint8 RequestBuffer[],                
                          [out] uint8 ResponseBuffer[]
                         );


    [HBAType("HBA_STATUS")
    ]
    uint32 SendRNID([in,
                     HBAType("HBA_WWN")
                    ] uint8 wwn[8],
                    [in,
                     HBAType("HBA_WWNTYPE"),
                     Values{"NODE_WWN", "PORT_WWN"},
                     ValueMap{"0", "1"}
                    ] uint32 wwntype,
                    [out
                    ] uint8 ResponseBuffer[]);
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_HBAFc3MgmtMethods"),
 DerivedClassType("NonConcrete")
]
class FC_HBAFc3MgmtMethods : CIMExt_HBAFc3MgmtMethods
{
    [key]
    string InstanceName;
};

[HBAType("HBA_SCSIID")
]
class HBAScsiID
{
    [MaxLen(256)
    ]
    string OSDeviceName;
    uint32 ScsiBusNumber;
    uint32 ScsiTargetNumber;
    uint32 ScsiOSLun;
};

[HBAType("HBA_FCPID")
]
class HBAFCPID
{
    uint32 Fcid;

    [HBAType("HBA_WWN")
    ]
    uint8 NodeWWN[8];

    [HBAType("HBA_WWN")
    ]
    uint8 PortWWN[8];

    uint64 FcpLun;
};

[HBAType("HBA_FCPSCSIENTRY")
]
class HBAFCPScsiEntry
{
    HBAScsiID ScsiId;
    HBAFCPID FCPId;
};

[HBAType("HBA_FCPBINDINGENTRY")
]
class HBAFCPBindingEntry
{
    [HBAType("HBA_FCPBINDINGTYPE"),
     Values{"TO_D_ID", "TO_WWN"},
     ValueMap{"0", "1"}
    ]
    uint32 Type;

    [HBAType("HBA_FCPSCSIENTRY")
    ]
    HBAScsiID ScsiId;

    [HBAType("HBA_FCID")
    ]
    HBAFCPID FCPId;
};


class CimExt_HBAFCPInfoMethods
{
    uint32 GetFcpTargetMapping([out] HBAFCPScsiEntry Entry[]);

    uint32 GetFcpPersistentBindind([out] HBAFCPBindingEntry Entry[]);
};

[Dynamic,
 Provider("wmimap"),
 WdmShadowClass("MSFC_HBAFCPInfoMethods"),
 DerivedClassType("NonConcrete")
]
class FC_HBAFCPInfoMethods : CIMExt_HBAFCPInfoMethods
{
    [key]
    string InstanceName;
};

#endif