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

Classes | Defines | Typedefs | Functions | Variables

winscard_clnt.c File Reference

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/un.h>
#include <errno.h>
#include <stddef.h>
#include <sys/time.h>
#include <pthread.h>
#include <sys/wait.h>
#include "misc.h"
#include "pcscd.h"
#include "winscard.h"
#include "debuglog.h"
#include "strlcpycat.h"
#include "readerfactory.h"
#include "eventhandler.h"
#include "sys_generic.h"
#include "winscard_msg.h"
#include "utils.h"
Include dependency graph for winscard_clnt.c:

Go to the source code of this file.

Classes

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

Defines

#define API_TRACE_IN(...)
#define API_TRACE_OUT(...)
#define CHECK_SAME_PROCESS
#define COLOR_BLUE   "\33[34m"
#define COLOR_GREEN   "\33[32m"
#define COLOR_MAGENTA   "\33[35m"
#define COLOR_NORMAL   "\33[0m"
#define COLOR_RED   "\33[01;31m"
#define FALSE   0
#define PROFILE_END(rv)
#define PROFILE_START
#define SCARD_PROTOCOL_ANY_OLD   0x1000
#define TRUE   1

Typedefs

typedef struct _psChannelMap CHANNEL_MAP
typedef struct _psContextMap SCONTEXTMAP

Functions

static int CHANNEL_MAP_seeker (const void *el, const void *key)
static LONG getReaderStates (SCONTEXTMAP *currentContextMap)
static LONG SCardAddContext (SCARDCONTEXT hContext, DWORD dwClientID)
 Adds an Application Context to the vector _psContextMap.
static LONG SCardAddHandle (SCARDHANDLE, SCONTEXTMAP *, LPCSTR)
LONG SCardBeginTransaction (SCARDHANDLE hCard)
 Establishes a temporary exclusive access mode for doing a serie of commands in a transaction.
LONG SCardCancel (SCARDCONTEXT hContext)
LONG SCardCheckDaemonAvailability (void)
 Checks if the server is running.
static LONG SCardCleanContext (SCONTEXTMAP *)
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.
static LONG SCardEstablishContextTH (DWORD dwScope,LPCVOID pvReserved1,LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
 Creates a communication 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).
static SCONTEXTMAPSCardGetContext (SCARDCONTEXT hContext)
 Get the index from the Application Context vector _psContextMap for the passed context.
static LONG SCardGetContextAndChannelFromHandle (SCARDHANDLE, SCONTEXTMAP **, CHANNEL_MAP **)
static LONG SCardGetContextAndChannelFromHandleTH (SCARDHANDLE, SCONTEXTMAP **, CHANNEL_MAP **)
static SCONTEXTMAPSCardGetContextTH (SCARDCONTEXT hContext)
 Get the address from the Application Context list _psContextMap for the passed context.
static LONG SCardGetSetAttrib (SCARDHANDLE hCard, int command, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
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)
static LONG SCardLockThread (void)
 Locks a mutex so another thread must wait to use this function.
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.
static LONG SCardRemoveContext (SCARDCONTEXT hContext)
 Removes an Application Context from a control vector.
static LONG SCardRemoveHandle (SCARDHANDLE)
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().
static LONG SCardUnlockThread (void)
 Unlocks a mutex so another thread may use the client.
static int SCONTEXTMAP_seeker (const void *el, const void *key)

Variables

static pthread_mutex_t clientMutex = PTHREAD_MUTEX_INITIALIZER
static list_t contextMapList
PCSC_API const SCARD_IO_REQUEST g_rgSCardRawPci = { SCARD_PROTOCOL_RAW, sizeof(SCARD_IO_REQUEST) }
PCSC_API const SCARD_IO_REQUEST g_rgSCardT0Pci = { SCARD_PROTOCOL_T0, sizeof(SCARD_IO_REQUEST) }
PCSC_API const SCARD_IO_REQUEST g_rgSCardT1Pci = { SCARD_PROTOCOL_T1, sizeof(SCARD_IO_REQUEST) }
static short isExecuted = 0
static READER_STATE readerStates [PCSCLITE_MAX_READERS_CONTEXTS]
static char sharing_shall_block = TRUE

Detailed Description

Definition in file winscard_clnt.c.


Generated by  Doxygen 1.6.0   Back to index