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

Classes | Defines | Functions | Variables

winscard_scf.c File Reference

This provides PC/SC to SCF shimming. More...

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/un.h>
#include <smartcard/scf.h>
#include <time.h>
#include "pcsclite.h"
#include "winscard.h"
#include "debug.h"
#include "thread_generic.h"
#include "readerfactory.h"
#include "eventhandler.h"
#include "sys_generic.h"
Include dependency graph for winscard_scf.c:

Go to the source code of this file.

Classes

struct  _psChannelMap
struct  _psContextMap
 Represents the an Application Context on the Client side. More...
struct  _psReaderMap
struct  _psTransmitMap

Defines

#define FALSE   0
#define PCSCLITE_MAX_READERS_CONTEXTS   2
#define TRUE   1

Functions

static LONG ConvertStatus (SCF_Status_t status)
static void EventCallback (SCF_Event_t eventType, SCF_Terminal_t hTerm, void *cbdata)
static LONG getCardForHandle (SCARDHANDLE PSCS_hCard, SCF_Card_t *SCF_hCard)
static LONG getNewContext (SCARDCONTEXT *phContext)
static LONG getNewHandle (SCARDCONTEXT hContext, LPCSTR szReader, SCARDHANDLE *phCard, DWORD)
static SCF_Session_t getSessionForContext (SCARDCONTEXT hContext)
static LONG isActiveContextPresent (void)
static LONG isOCFServerRunning (void)
static LONG PCSC_SCF_getATR (SCF_Card_t hCard, LPBYTE pcbAtr, LPDWORD pcbAtrLen)
static LONG PCSC_SCF_Initialize (void)
static LONG SCardAddContext (SCARDCONTEXT hContext, SCF_Session_t hSession)
static LONG SCardAddHandle (SCARDHANDLE PCSC_hCard, SCARDCONTEXT hContext, SCF_Session_t hSession, SCF_Terminal_t hTerminal, SCF_Card_t SCF_hCard, int, DWORD)
LONG SCardBeginTransaction (SCARDHANDLE hCard)
 This function establishes a temporary exclusive access mode for doing a series of commands or transaction.
LONG SCardCancel (SCARDCONTEXT hContext)
static LONG SCardCancelTH (SCARDCONTEXT hContext)
LONG SCardCancelTransaction (SCARDHANDLE hCard)
static LONG SCardCancelTransactionTH (SCARDHANDLE hCard)
LONG SCardCheckDaemonAvailability (void)
 Checks if the Server is running.
LONG SCardCheckReaderAvailability (LPSTR readerName, LONG errorCode)
LONG SCardConnect (SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
static LONG SCardConnectTH (SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
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 to be processed by the reader.
LONG SCardDisconnect (SCARDHANDLE hCard, DWORD dwDisposition)
static LONG SCardDisconnectTH (SCARDHANDLE hCard, DWORD dwDisposition)
LONG SCardEndTransaction (SCARDHANDLE hCard, DWORD dwDisposition)
 This function ends a previously begun transaction.
static LONG SCardEndTransactionTH (SCARDHANDLE hCard, DWORD dwDisposition)
LONG SCardEstablishContext (DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
 Creates an Application Context for a client.
static LONG SCardEstablishContextTH (DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
LONG SCardEventLock (void)
LONG SCardEventUnlock (void)
LONG SCardGetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
static LONG SCardGetContextIndice (SCARDCONTEXT hContext)
static LONG SCardGetHandleIndice (SCARDHANDLE hCard)
static LONG SCardGetReaderIndice (LPCSTR ReaderName)
LONG SCardGetStatusChange (SCARDCONTEXT hContext, DWORD dwTimeout, LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders)
 This function receives a structure or list of structures containing reader names. It then blocks for a change in state to occur on any of the OR'd values contained in dwCurrentState for a maximum blocking time of dwTimeout or forever if INFINITE is used.
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.
static LONG SCardListReaderGroupsTH (SCARDCONTEXT hContext, LPSTR mszGroups, LPDWORD pcchGroups)
LONG SCardListReaders (SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
static LONG SCardListReadersTH (SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
LONG SCardLockThread (void)
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().
static LONG SCardReconnectTH (SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)
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.
static LONG SCardReleaseContextTH (SCARDCONTEXT hContext)
static LONG SCardRemoveContext (SCARDCONTEXT hContext)
static LONG SCardRemoveHandle (SCARDHANDLE hCard)
LONG SCardSetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)
 This function set an attribute of the IFD Handler.
LONG SCardStatus (SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
 This function returns the current status of the reader connected to by hCard.
static LONG SCardStatusTH (SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
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().
static LONG SCardTransmitTH (SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
void SCardUnload (void)
LONG SCardUnlockThread (void)

Variables

static PCSCLITE_MUTEX clientMutex = PTHREAD_MUTEX_INITIALIZER
static pthread_cond_t EventCondition = PTHREAD_COND_INITIALIZER
static PCSCLITE_MUTEX EventMutex = PTHREAD_MUTEX_INITIALIZER
static SCF_Session_t g_hSession = NULL
SCARD_IO_REQUEST g_rgSCardRawPci
SCARD_IO_REQUEST g_rgSCardT0Pci
SCARD_IO_REQUEST g_rgSCardT1Pci
static char PCSC_Initialized = 0
static struct _psChannelMap psChannelMap [PCSCLITE_MAX_APPLICATION_CONTEXTS]
static struct _psContextMap psContextMap [PCSCLITE_MAX_APPLICATION_CONTEXTS]
static struct _psReaderMap psReaderMap [PCSCLITE_MAX_READERS_CONTEXTS]
static struct _psTransmitMap psTransmitMap [PCSCLITE_MAX_APPLICATION_CONTEXTS]
static PCSCLITE_MUTEX SCFInitMutex = PTHREAD_MUTEX_INITIALIZER

Detailed Description

This provides PC/SC to SCF shimming.

Definition in file winscard_scf.c.


Generated by  Doxygen 1.6.0   Back to index