wim/inc/ScardBase.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Definitions for smart card base
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSCARDBASE_H
       
    20 #define CSCARDBASE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 //  CONSTANTS  
       
    26 
       
    27 ////////////////////////////////////////////////////////////////////////////////
       
    28 //  Scard Panic codes
       
    29 ////////////////////////////////////////////////////////////////////////////////
       
    30 const TInt KScPanicNoMemory                 = -1;   // Not enough free memory
       
    31 const TInt KScPanicNullPointer              = -2;   // A NULL pointer was encountered
       
    32 const TInt KScPanicNullLength               = -3;   // A buffer or data member has null lenght
       
    33 const TInt KScPanicNotSupported             = -4;   // A given operation or resource is not supported
       
    34 const TInt KScPanicInvalidValue             = -5;   // A value was invalid in the given context
       
    35 const TInt KScPanicNoResourceConnection     = -6;   // Some external resource (eg. file server) 
       
    36                                                     // could not be contacted
       
    37 //  7-9 rfu
       
    38 const TInt KScUtilPanicOverFlow             = -10; // A buffer overflow
       
    39 const TInt KScUtilPanicUnderFlow            = -11; // A buffer underflow
       
    40 //  12-14 rfu
       
    41 const TInt KScServerPanicInternalError      = -15; // Some internal error has occurred
       
    42 const TInt KScServerPanicBadRequest         = -16; // A service request had an unknown value
       
    43 const TInt KScServerPanicBadDescriptor      = -17; // A descriptor was too short or corrupted
       
    44 const TInt KScServerPanicDescrNonNumeric    = -18;  
       
    45 const TInt KScServerPanicMainSchedulerError = -19; // The active scheduler could not be activated
       
    46 const TInt KScServerPanicSvrCreateServer    = -20; // Server creatíon failed
       
    47 const TInt KScServerPanicCreateTrapCleanup  = -21; // CleanupStack creation failed
       
    48 const TInt KScServerPanicBadCounterRemove   = -22; 
       
    49 const TInt KScServerPanicBadSubsessionHandle= -23; // A subsession had an invalid handle
       
    50 //  24-29 rfu
       
    51 const TInt KScServicePanicAlreadyActive     = -30; // The service is still running the previous request
       
    52 const TInt KScServicePanicBadFormat         = -31; // A parameter did not conform to a spesified format
       
    53 const TInt KScServicePanicDataCorruption    = -32; // Some data (internal/external) has 
       
    54                                                    // been terminally corrupted
       
    55 //  33-n proprietary panics
       
    56 
       
    57 ////////////////////////////////////////////////////////////////////////////////
       
    58 //  Scard error codes
       
    59 ////////////////////////////////////////////////////////////////////////////////
       
    60 const TInt KScErrUnknown                    = 1;  // An undefined internal error has occurred
       
    61 const TInt KScErrGeneral                    = 2;  // An internal error
       
    62 const TInt KScErrNotFound                   = 3;  // A search did not find the wanted resource
       
    63 const TInt KScErrCancelled                  = 4;  // Operation was cancelled
       
    64 const TInt KScErrTimeOut                    = 5;  // A command has timed out
       
    65 const TInt KScErrNotSupported               = 6;  // The operation or resource (reader etc.) 
       
    66                                                   // is not supported
       
    67 const TInt KScErrUnknownGroup               = 7;  // The reader group could not be identified
       
    68 const TInt KScErrUnknownCard                = 8;  // The card could not be identified
       
    69 const TInt KScErrUnknownReader              = 9;  // The reader could not be identified
       
    70 const TInt KScErrBadArgument                = 10; // An argument has unacceptable value / does not
       
    71                                                   // conform to a spesified format
       
    72 const TInt KScErrEmpty                      = 11; // A buffer or descriptor data area was empty, when it 
       
    73                                                   // was expected to contain data
       
    74 const TInt KScErrFull                       = 12; // A buffer or descriptor is full
       
    75 const TInt KScErrNullPointer                = 13; // A null pointer was encountered
       
    76 const TInt KScErrNoMemory                   = 14; // There was not enough free memory to complete a task
       
    77 const TInt KScErrInsufficientBuffer         = 15; // A buffer had insufficient length
       
    78 const TInt KScErrFileFailure                = 16; // An operation could not complete due to file 
       
    79                                                   // handling errors
       
    80 const TInt KScErrAlreadyExists              = 17; // A resource could not be installed because a resource
       
    81                                                   // of same type by that name already exists
       
    82 const TInt KScErrInUse                      = 18; // A resource was in use
       
    83 
       
    84 
       
    85 // 18 - 29 rfu
       
    86 
       
    87 const TInt KScReaderErrNoCard               = 30; // The SC was removed from the reader
       
    88 const TInt KScReaderErrNoReader             = 31; // The reader could not be reached
       
    89 const TInt KScReaderErrUnpoweredCard        = 32; // The SC had no power on
       
    90 const TInt KScReaderErrUnsupportedCard      = 33; // The SC could not be supported
       
    91 const TInt KScReaderErrUnresponsiveCard     = 34; // The SC did not response
       
    92 const TInt KScReaderErrCardFailure          = 35; // A SC failure
       
    93 const TInt KScReaderErrReaderFailure        = 36; // A reader failure
       
    94 const TInt KScReaderErrCommunicationFailure = 37; // A communication failure other than the two previous ones
       
    95 const TInt KScReaderErrResponseTimeout      = 38; // A response time-out limit reached without a valid 
       
    96                                                   // response from the SC or the reader
       
    97 const TInt KScReaderErrPowerFailure         = 39; // The reader has encountered a power failure
       
    98 const TInt KScReaderErrNotReady             = 40; // The reader or the SC was not ready
       
    99 const TInt KScReaderErrCannotConnect        = 41; // Reader handler is unable to connect to the reader
       
   100                                                   // or the SC
       
   101 const TInt KScReaderErrUnsupportedTag       = 42; // In function GetCapabilities a unsupported 
       
   102                                                   // capability tag was requested
       
   103 const TInt KScReaderErrUnsupportedProtocol  = 43; // In function NegotiateProtocol an unsupported
       
   104                                                   // protocol was requested
       
   105 // 44 - 59 proprietary reader errors
       
   106 
       
   107 const TInt KScServerErrIllegalChannel       = 61; // The logical channel the client attempted to
       
   108                                                   // use was not available for this client (no previous
       
   109                                                   // ManageChannel command)
       
   110 const TInt KScServerErrIllegalOperation     = 62; // A client attempted to send a ManageChannel apdu via
       
   111                                                   // TransmitToCard() instead of ManageChannel()
       
   112 // 62 - 79 rfu
       
   113 
       
   114 //  File services
       
   115 const TInt KScServiceErrDirNotFound         = 80; // The requested directory could not be found
       
   116 const TInt KScServiceErrFileNotFound        = 81; // The requested file could not be found
       
   117 const TInt KScServiceErrNoDir               = 82; // The request did not contain a valid directoryname
       
   118 const TInt KScServiceErrNoFile              = 83; // The request did not contain a valid filename
       
   119 const TInt KScServiceErrNoAccess            = 84; // The resource could not be accessed because of a 
       
   120                                                   // sharing violation
       
   121 const TInt KScServiceErrCorruptedFile       = 85; // The requested file was corrupted
       
   122 const TInt KScServiceErrRecordNotFound      = 86; // A requested record was not found
       
   123 const TInt KScServiceErrRunning             = 87; // The service is already running a previous request
       
   124 const TInt KScServiceErrEOF                 = 88; // An end of file was encountered before a successful
       
   125                                                   // completion of a task
       
   126 const TInt KScServiceErrInvalidOffset       = 89; // The offset could not be mapped inside the file/resource
       
   127 const TInt KScServiceErrWriteTooMany        = 90; // A write counter limit has been reached (?)
       
   128 const TInt KScServiceErrFPEmpty             = 91; // A file pointer was empty (?)
       
   129 
       
   130 // Application Management services
       
   131 const TInt KScServiceErrInvalidAID          = 92; // The given application identifier did not match any
       
   132                                                   // applications on the SC
       
   133 const TInt KScServiceErrApplicationBlocked  = 93; // The requested application was blocked
       
   134 const TInt KScServiceErrNoSupportedApps     = 94; // The card contains no supportable applicatíons
       
   135 const TInt KScServiceErrSecurityViolation   = 95; // The task could not be completed because of a security
       
   136                                                   // violation
       
   137 
       
   138 //These tags from PC/SC, shoud be moved to scard.h 
       
   139 ////////////////////////////////////////////////////////////////////////////////
       
   140 //  Tags for reader capabilities           Length   Encoding
       
   141 ////////////////////////////////////////////////////////////////////////////////
       
   142 const TInt32 KVendorName     = 0x0100; //  32       ASCII string
       
   143 const TInt32 KReaderType     = 0x0101; //  32       ASCII string
       
   144 const TInt32 KReaderVersion  = 0x0102; //  4        Dword 0xMMmmbbb
       
   145                                        //               MM = major version
       
   146                                        //               mm = minor version
       
   147                                        //               bbbb = build number
       
   148 const TInt32 KReaderSerial   = 0x0103; //  32       ASCII string
       
   149 
       
   150 // Channel ID skipped
       
   151 
       
   152 const TInt32 KAsyncProtocols = 0x0120; //  4        Dword 0x0000PPPP
       
   153                                        //        1 in a given position indicates
       
   154                                        //        support for associated protocol
       
   155                                        //        e.g 0x00000002 for T=1 support 
       
   156 //other protocol parameters skipped
       
   157 
       
   158 const TInt32 KPowerMgt       = 0x0131; //  1 (4)    0 = not supported
       
   159 const TInt32 KAuthFeatures   = 0x0140; //  4        See PC/SC part 3 page 7
       
   160 
       
   161 //Mechanical charasteristics skipped
       
   162 
       
   163 //Vendor defined tags from 0x0180 - 0x01F0
       
   164 
       
   165 ////////////////////////////////////////////////////////////////////////////////
       
   166 //  Tags for Card state                    Length   Encoding
       
   167 ////////////////////////////////////////////////////////////////////////////////
       
   168 const TInt32 KCardPrecence   = 0x0300; //  1        0 = not present, 1 = present
       
   169 const TInt32 KCardInterface  = 0x0301; //  1        0 = contact inactive, 
       
   170                                        //           1 = contact active
       
   171 const TInt32 KCardType       = 0x0304; //  1        0 = unknown, 1 = 7816 async,
       
   172 const TInt32 KCardStatus     = 0x0310; //  1        bit 1: card powered
       
   173                                        //           bit 2: card present
       
   174                                        //           bit 3: card reader id1 size
       
   175                                        //           bit 4: card reader present
       
   176                                        //           bit 5: card reader removable
       
   177 
       
   178 ////////////////////////////////////////////////////////////////////////////////
       
   179 //  Tags for Reader Protocol options       Length   Encoding
       
   180 ////////////////////////////////////////////////////////////////////////////////
       
   181 const TInt32 KCurrentProtocol= 0x0201; //  4        As with AsyncProtocols
       
   182 const TInt32 KCurrentF       = 0x0203; //  4               
       
   183 const TInt32 KCurrentD       = 0x0204; //  4               
       
   184 const TInt32 KCurrentN       = 0x0205; //  4  
       
   185 
       
   186 ////////////////////////////////////////////////////////////////////////////////
       
   187 //  Connection parameters
       
   188 ////////////////////////////////////////////////////////////////////////////////
       
   189 const TInt KAnyReader               = 0x01;
       
   190 const TInt KExplicitReader          = 0x02;
       
   191 const TInt KExcludedReader          = 0x04;
       
   192 
       
   193 const TInt KAnyCard                 = 0x10;
       
   194 const TInt KATRSpesified            = 0x20;
       
   195 const TInt KApplicationSpesified    = 0x40;
       
   196 const TInt KServiceSpesified        = 0x80;
       
   197 
       
   198 const TInt KNewCardsOnly            = 0x100;
       
   199 const TInt KNewReadersOnly          = 0x200;
       
   200 
       
   201 ////////////////////////////////////////////////////////////////////////////////
       
   202 //  Reader handler definitions
       
   203 ////////////////////////////////////////////////////////////////////////////////
       
   204 _LIT( KReaderName, "SWIM Reader" );
       
   205 const TInt KReaderID = 1;
       
   206 
       
   207 _LIT( KGroupName, "SWIM Readers" );
       
   208 const TInt KGroupID  = 1;
       
   209 
       
   210 _LIT( KSwimReaderDLL, "SwimReader.dll" );
       
   211 
       
   212 #endif      // CSCARDBASE_H
       
   213 
       
   214 // End of File