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