Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

Functions

API

Handles smartcard reader communications and forwarding requests over message queues. More...

Functions

PCSC_API char * pcsc_stringify_error (const LONG pcscError)
 This function return a human readable text for the given PC/SC error code.
LONG SCardBeginTransaction (SCARDHANDLE hCard)
 Establishes a temporary exclusive access mode for doing a serie of commands in a transaction.
LONG SCardCancel (SCARDCONTEXT hContext)
LONG SCardConnect (SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
 Establishes a connection to the reader specified in * szReader.
LONG SCardControl (SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)
 Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.
LONG SCardDisconnect (SCARDHANDLE hCard, DWORD dwDisposition)
 Terminates a connection made through SCardConnect().
LONG SCardEndTransaction (SCARDHANDLE hCard, DWORD dwDisposition)
 Ends a previously begun transaction.
LONG SCardEstablishContext (DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
 Creates an Application Context to the PC/SC Resource Manager.
LONG SCardFreeMemory (SCARDCONTEXT hContext, LPCVOID pvMem)
 Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE length designator.
LONG SCardGetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
 Get an attribute from the IFD Handler (reader driver).
LONG SCardGetStatusChange (SCARDCONTEXT hContext, DWORD dwTimeout, SCARD_READERSTATE *rgReaderStates, DWORD cReaders)
 Blocks execution until the current availability of the cards in a specific set of readers changes.
LONG SCardIsValidContext (SCARDCONTEXT hContext)
 Check if a SCARDCONTEXT is valid.
LONG SCardListReaderGroups (SCARDCONTEXT hContext, LPSTR mszGroups, LPDWORD pcchGroups)
 Returns a list of currently available reader groups on the system. mszGroups is a pointer to a character string that is allocated by the application. If the application sends mszGroups as NULL then this function will return the size of the buffer needed to allocate in pcchGroups.
LONG SCardListReaders (SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
LONG SCardReconnect (SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)
 Reestablishes a connection to a reader that was previously connected to using SCardConnect().
LONG SCardReleaseContext (SCARDCONTEXT hContext)
 Destroys a communication context to the PC/SC Resource Manager. This must be the last function called in a PC/SC application.
LONG SCardSetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)
 Set an attribute of the IFD Handler.
LONG SCardStatus (SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
 Returns the current status of the reader connected to by hCard.
LONG SCardTransmit (SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, SCARD_IO_REQUEST *pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
 Sends an APDU to the smart card contained in the reader connected to by SCardConnect().

Detailed Description

Handles smartcard reader communications and forwarding requests over message queues.

Here is exposed the API for client applications.

Attention:
Known differences with Microsoft Windows WinSCard implementation:
  1. SCardStatus()
    SCardStatus() returns a bit field on pcsc-lite but a enumeration on Windows.
    This difference may be resolved in a future version of pcsc-lite. The bit-fields would then only contain one bit set.
    You can have a portable code using:
        if (dwState & SCARD_PRESENT)
        {
          // card is present
        }
    
  2. SCARD_E_UNSUPPORTED_FEATURE
    Windows may return ERROR_NOT_SUPPORTED instead of SCARD_E_UNSUPPORTED_FEATURE
    This difference will not be corrected. pcsc-lite only uses SCARD_E_* error codes.
  3. SCARD_E_UNSUPPORTED_FEATURE
    For historical reasons the value of SCARD_E_UNSUPPORTED_FEATURE is 0x8010001F in pcsc-lite but 0x80100022 in Windows WinSCard. You should not have any problem if you always use the symbolic name.
    The value 0x8010001F is also used by SCARD_E_UNEXPECTED on pcsc-lite but SCARD_E_UNEXPECTED is never returned by pcsc-lite. So 0x8010001F does always means SCARD_E_UNSUPPORTED_FEATURE.
    Applications like rdekstop that allow a Windows application to talk to pcsc-lite should take care of this difference and convert the value between the two worlds.
  4. SCardConnect()
    If SCARD_SHARE_DIRECT is used the reader is accessed in shared mode (like with SCARD_SHARE_SHARED) and not in exclusive mode (like with SCARD_SHARE_EXCLUSIVE) as on Windows.
  5. SCardEstablishContext()
    Each thread of an application shall use its own SCARDCONTEXT. SCardCancel() is the only exception to the rule. On Windows the same SCARDCONTEXT can be shared by different threads of same application.
  6. CardConnect() & SCardReconnect()
    pdwActiveProtocol is not set to SCARD_PROTOCOL_UNDEFINED if SCARD_SHARE_DIRECT is used but the card has already negociated its protocol

Generated by  Doxygen 1.6.0   Back to index