os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiclientreq.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 TSCSICLIENTREQ_H
    22 #define TSCSICLIENTREQ_H
    23 
    24 /**
    25 Data type for GROUP CODE
    26 SAM-2 5.2.2
    27 SPC-3 4.3.4.1
    28 */
    29 typedef TUint8 TGroupCode;
    30 
    31 /**
    32 Data type for ALLOCATION LENGTH
    33 SPC-2 4.3.4.6
    34 SPC-3 4.3.4.6
    35 */
    36 typedef TUint TAllocationLength;    // 1 Byte
    37 
    38 /**
    39 Base class to decode SCSI RESPONSE
    40 */
    41 class TScsiClientResp: public MClientCommandServiceResp
    42     {
    43 public:
    44     TScsiClientResp() {};
    45     };
    46 
    47 
    48 /**
    49 Base class to encode a SCSI REQUEST which implements the SCSI header encoding
    50 */
    51 class TScsiClientReq: public MClientCommandServiceReq
    52     {
    53 public:
    54     /** SCSI OPERATION CODE */
    55     enum TOperationCode
    56         {
    57         ETestUnitReady			= 0x00,
    58         ERequestSense			= 0x03,
    59         EInquiry 				= 0x12,
    60         EModeSense6				= 0x1A,
    61         EStartStopUnit			= 0x1B,
    62         EPreventMediaRemoval	= 0x1E,
    63         EReadFormatCapacities	= 0x23,
    64         EReadCapacity10			= 0x25,
    65         ERead10 				= 0x28,
    66         EWrite10				= 0x2A,
    67         EVerify10				= 0x2f,
    68         EModeSense10			= 0x5A,
    69         EUndefinedCommand		= 0xFF
    70         };
    71 
    72     TScsiClientReq(TOperationCode aOperationCode);
    73 
    74     virtual TInt EncodeRequestL(TDes8& aBuffer) const;
    75 
    76 private:
    77     TUint8 GetControlByte() const;
    78     TGroupCode GetGroupCode() const;
    79 
    80     TBool IsDataDirectionOut() const;
    81     TUint32 DataLength() const;
    82 
    83 public:
    84     /** SCSI OPERATION CODE of CDB byte, SAM-2 5.2.2 */
    85     const TOperationCode iOperationCode;
    86     /** SCSI NACA field of CDB CONTROL Byte. SAM-2 5.2.3 */
    87     TBool iNaca;
    88     /** SCSI LINK field of CDB CONTROL Byte. SAM-2 5.2.3 */
    89     TBool iLink;
    90     };
    91 
    92 #include "tscsiclientreq.inl"
    93 
    94 #endif // TSCSICLIENTREQ_H