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

API


Detailed Description

This 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. On Windows the same SCARDCONTEXT can be shared by different threads of same application.


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)
 This function establishes a temporary exclusive access mode for doing a serie of commands in a transaction.
LONG SCardCancel (SCARDCONTEXT hContext)
LONG SCardCancelTransaction (SCARDHANDLE hCard)
LONG SCardConnect (SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
 This function 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)
 This function sends a command directly to the IFD Handler (reader driver) to be processed by the reader.
LONG SCardDisconnect (SCARDHANDLE hCard, DWORD dwDisposition)
 This function terminates a connection made through SCardConnect().
LONG SCardEndTransaction (SCARDHANDLE hCard, DWORD dwDisposition)
 This function 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)
 This function get an attribute from the IFD Handler (reader driver).
LONG SCardGetStatusChange (SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders)
 This function 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)
 This function 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)
 This function reestablishes a connection to a reader that was previously connected to using SCardConnect().
LONG SCardReleaseContext (SCARDCONTEXT hContext)
 This function 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)
 This function set an attribute of the IFD Handler.
LONG SCardSetTimeout (SCARDCONTEXT hContext, DWORD dwTimeout)
 The function does not do anything except returning SCARD_S_SUCCESS.
LONG SCardStatus (SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
 This function returns the current status of the reader connected to by hCard.
LONG SCardTransmit (SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
 This function sends an APDU to the smart card contained in the reader connected to by SCardConnect().


Generated by  Doxygen 1.6.0   Back to index