winscard_svc.c File Reference

This demarshalls functions over the message queue and keeps track of clients and their handles. More...

#include "config.h"
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include "pcscd.h"
#include "winscard.h"
#include "debuglog.h"
#include "winscard_msg.h"
#include "winscard_svc.h"
#include "sys_generic.h"
#include "thread_generic.h"
#include "readerfactory.h"

Include dependency graph for winscard_svc.c:

Go to the source code of this file.

Data Structures

struct  _psContext
 Represents an Application Context on the Server side. More...

Functions

static LONG MSGCheckHandleAssociation (SCARDHANDLE, DWORD)
static LONG MSGFunctionDemarshall (psharedSegmentMsg msgStruct, DWORD dwContextIndex)
 Find out which message was sent by the Client and execute the right task.
static LONG MSGAddContext (SCARDCONTEXT, DWORD)
static LONG MSGRemoveContext (SCARDCONTEXT, DWORD)
static LONG MSGAddHandle (SCARDCONTEXT, SCARDHANDLE, DWORD)
static LONG MSGRemoveHandle (SCARDHANDLE, DWORD)
static LONG MSGCleanupClient (DWORD)
static void ContextThread (LPVOID dwIndex)
 Handles messages received from Clients.
LONG ContextsInitialize (void)
LONG CreateContextThread (uint32_t *pdwClientID)
 Creates threads to handle messages received from Clients.

Variables

static struct _psContext psContext [PCSCLITE_MAX_APPLICATIONS_CONTEXTS]
 Represents an Application Context on the Server side.


Detailed Description

This demarshalls functions over the message queue and keeps track of clients and their handles.

Each Client message is deald by creating a thread (CreateContextThread). The thread establishes reands and demarshalls the message and calls the appropriate function to threat it.

Definition in file winscard_svc.c.


Function Documentation

static void ContextThread ( LPVOID  dwIndex  )  [static]

Handles messages received from Clients.

For each Client message a new instance of this thread is created.

Parameters:
[in] dwIndex Index of an avaiable Application Context slot in psContext.

Definition at line 126 of file winscard_svc.c.

References CMD_VERSION, version_struct::major, version_struct::minor, MSGFunctionDemarshall(), PCSCLITE_SERVER_ATTEMPTS, _psContext::protocol_minor, PROTOCOL_VERSION_MAJOR, PROTOCOL_VERSION_MINOR, psContext, SCARD_CONTROL_EXTENDED, SCARD_E_NO_SERVICE, SCARD_S_SUCCESS, SCARD_TRANSMIT_EXTENDED, SHMClientCloseSession(), SHMMessageSend(), and SHMProcessEventsContext().

Referenced by CreateContextThread().

Here is the call graph for this function:

LONG CreateContextThread ( uint32_t *  pdwClientID  ) 

Creates threads to handle messages received from Clients.

Parameters:
[in] pdwClientID Connection ID used to reference the Client.
Returns:
Error code.
Return values:
SCARD_S_SUCCESS Success.
SCARD_F_INTERNAL_ERROR Exceded the maximum number of simultaneous Application Contexts.
SCARD_E_NO_MEMORY Error creating the Context Thread.

Definition at line 78 of file winscard_svc.c.

References ContextThread(), _psContext::dwClientID, PCSCLITE_MAX_APPLICATIONS_CONTEXTS, psContext, SCARD_E_NO_MEMORY, SCARD_F_INTERNAL_ERROR, SCARD_S_SUCCESS, and SYS_CloseFile().

Referenced by SVCServiceRunLoop().

Here is the call graph for this function:

static LONG MSGFunctionDemarshall ( psharedSegmentMsg  msgStruct,
DWORD  dwContextIndex 
) [static]


Variable Documentation

struct _psContext psContext[PCSCLITE_MAX_APPLICATIONS_CONTEXTS] [static]

Represents an Application Context on the Server side.

An Application Context contains Channels (hCard).

Referenced by ContextThread(), CreateContextThread(), and MSGFunctionDemarshall().


Generated on Mon Aug 17 01:00:16 2009 for pcsc-lite by  doxygen 1.5.9