os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiprimarycmds.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @internalTechnology
    19 */
    20 
    21 #ifndef TSCSIPRIMARYCMDS_H
    22 #define TSCSIPRIMARYCMDS_H
    23 
    24 
    25 /**
    26 Encodes SCSI INQUIRY REQUEST
    27 Ref SPC-2 7.3.1
    28 Ref SPC-3 6.4
    29 */
    30 class TScsiClientInquiryReq: public TScsiClientReq
    31     {
    32 public:
    33     /** Length of INQUIRY response */
    34     static const TUint KResponseLength = 36;
    35 
    36     TScsiClientInquiryReq();
    37     TInt EncodeRequestL(TDes8& aBuffer) const;
    38 
    39     void SetEvpd(TUint8 aPageCode);
    40     void SetCmdDt(TUint8 aOperationCode);
    41     void SetAllocationLength(TAllocationLength aAllocationLength);
    42 
    43 public:
    44     /** SCSI CmdDt field */
    45     TBool iCmdDt;
    46     /** SCSI EVPD field */
    47 	TBool iEvpd;
    48     /** SCSI PAGE field */
    49 	TUint8 iPage;
    50     /** SCSI ALLOCATION LENGTH */
    51     TAllocationLength iAllocationLength;
    52     };
    53 
    54 
    55 /**
    56 Represents the SCSI INQUIRY RESPONSE PRODUCT IDENTIFICATION information
    57 */
    58 class TMassStorageConfig
    59     {
    60 public:
    61     /** SCSI VENDOR ID field */
    62     TBuf<8> iVendorId;
    63     /** SCSI PRODUCT ID field */
    64     TBuf<16> iProductId;
    65     /** SCSI PRODUCT REVISION field */
    66     TBuf<4> iProductRev;
    67     };
    68 
    69 /**
    70 Represents the SCSI INQUIRY RESPONSE PERIPHERAL device information
    71 */
    72 class TPeripheralInfo
    73     {
    74 public:
    75     /** Medium removable flag */
    76     TBool iRemovable;
    77 
    78     /** SCSI PERIPHERAL QUALIFIER */
    79     TUint8 iPeripheralQualifier;
    80     /** SCSI PERIPHEREAL DEVICE TYPE */
    81     TUint8 iPeripheralDeviceType;
    82     /** SCSI RESPONSE DATA FORMAT */
    83     TUint8 iResponseDataFormat;
    84     /** SCSI VERSION */
    85     TUint8 iVersion;
    86     /** Device product information (vendor id, product id, revision) */
    87     TMassStorageConfig iIdentification;
    88     };
    89 
    90 /**
    91 Decodes SCSI INQUIRY REQUEST
    92 */
    93 class TScsiClientInquiryResp: public TScsiClientResp
    94     {
    95 public:
    96     /** Length of INQUIRY response */
    97     static const TInt KResponseLength = 36;
    98     TScsiClientInquiryResp(TPeripheralInfo& aPeripheralInfo);
    99 
   100     TInt DataLength() const {return KResponseLength;}
   101     void DecodeL(const TDesC8& aPtr);
   102 
   103 private:
   104     void DecodeInquiry(const TDesC8& aPtr);
   105 
   106 public:
   107     /** Device peripheral info fields */
   108     TPeripheralInfo& iPeripheralInfo;
   109     };
   110 
   111 /**
   112 Data type for PREVENT field
   113 SPC-2, 7.12 Table 78
   114 SPC-3, 6.13 Table 119
   115 */
   116 typedef TBool TPrevent;
   117 
   118 /**
   119 Encodes SCSI PREVENT MEDIA REMOVAL REQUEST
   120 SPC-2 7.12
   121 SPC-3 6.13
   122 */
   123 class TScsiClientPreventMediaRemovalReq: public TScsiClientReq
   124     {
   125 public:
   126     TScsiClientPreventMediaRemovalReq(TPrevent aPrevent);
   127     TInt EncodeRequestL(TDes8& aBuffer) const;
   128 
   129 private:
   130     TPrevent iPrevent;
   131     };
   132 
   133 
   134 /**
   135 Encodes SCSI REQUEST SENSE REQUEST
   136 */
   137 class TScsiClientRequestSenseReq: public TScsiClientReq
   138     {
   139 public:
   140     /** Length of REQUEST SENSE request */
   141     static const TUint KResponseLength = 18;
   142     TScsiClientRequestSenseReq();
   143     TInt EncodeRequestL(TDes8& aBuffer) const;
   144 
   145 private:
   146     void SetAllocationLength(TAllocationLength aAllocationLength);
   147 
   148 public:
   149     /** SCSI ALLOCATION LENGTH field */
   150     TAllocationLength iAllocationLength;
   151     };
   152 
   153 
   154 /**
   155 Decodes SCSI SENSE RESPONSE
   156 */
   157 class TScsiClientRequestSenseResp: public TScsiClientResp
   158     {
   159 public:
   160     /** SCSI Response Code, SBC-3 4.5 */
   161     enum TResponseCode
   162         {
   163         ECurrentErrors = 0x70,
   164         EDeferredErrors = 0x71
   165         };
   166 
   167     /** Length of the REQUEST SENSE response */
   168     static const TInt KResponseLength = 18;
   169     /** Constructor */
   170     TScsiClientRequestSenseResp() {};
   171 
   172     TInt DataLength() const {return KResponseLength;}
   173     void DecodeL(const TDesC8& aPtr);
   174 
   175 private:
   176     void DecodeSenseInfo(const TDesC8& aPtr);
   177 
   178 public:
   179     /** Returned SCSI RESPONSE CODE */
   180     TResponseCode iResponseCode;
   181     /** Returned SCSI Sense Info */
   182     TSenseInfo iSenseInfo;
   183     /** Returned SCSI ADDITIONAL SENSE LENGTH */
   184     TUint iAdditionalSenseLength;
   185     };
   186 
   187 
   188 /**
   189 Encodes SCSI TEST UNIT READY REQUEST
   190 Ref SPC-2 7.25
   191 Ref SPC-3 6.33
   192 */
   193 class TScsiClientTestUnitReadyReq: public TScsiClientReq
   194     {
   195 public:
   196     TScsiClientTestUnitReadyReq();
   197     TInt EncodeRequestL(TDes8& aBuffer) const;
   198     };
   199 
   200 
   201 #include "tscsiprimarycmds.inl"
   202 
   203 #endif // TSCSIPRIMARYCMDS_H