winscard_msg_srv.c File Reference

client/server communication (on the server side only) More...

#include "config.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "misc.h"
#include "pcscd.h"
#include "winscard.h"
#include "debuglog.h"
#include "winscard_msg.h"
#include "sys_generic.h"

Include dependency graph for winscard_msg_srv.c:

Go to the source code of this file.

Functions

static int SHMProcessCommonChannelRequest (uint32_t *pdwClientID)
 Accepts a Client connection.
INTERNAL int32_t SHMInitializeCommonSegment (void)
 Prepares the communication channel used by the server to talk to the clients.
INTERNAL int32_t SHMProcessEventsServer (uint32_t *pdwClientID)
 Looks for messages sent by clients.
INTERNAL int32_t SHMProcessEventsContext (uint32_t dwClientID, psharedSegmentMsg msgStruct)
 Called by ContextThread().

Variables

static int commonSocket = 0
 Socket to a file, used for clients-server comminication.
char AraKiri
char ReCheckSerialReaders
static const char * CommandsText []


Detailed Description

client/server communication (on the server side only)

A file based socket (commonSocket) is used to send/receive only messages among clients and server.
The messages' data are passed throw a memory mapped file: sharedSegmentMsg.

Definition in file winscard_msg_srv.c.


Function Documentation

INTERNAL int32_t SHMInitializeCommonSegment ( void   ) 

Prepares the communication channel used by the server to talk to the clients.

This is called by the server to create a socket for local IPC with the clients. The socket is associated to the file PCSCLITE_CSOCK_NAME. Each client will open a connection to this socket.

Returns:
Error code.
Return values:
0 Success
-1 Can not create the socket.
-1 Can not bind the socket to the file PCSCLITE_CSOCK_NAME.
-1 Can not put the socket in listen mode.

Definition at line 133 of file winscard_msg_srv.c.

References commonSocket, SHMCleanupSharedSegment(), and SYS_RemoveFile().

Referenced by SVCServiceRunLoop().

Here is the call graph for this function:

static int SHMProcessCommonChannelRequest ( uint32_t *  pdwClientID  )  [static]

Accepts a Client connection.

Called by SHMProcessEventsServer().

Parameters:
[out] pdwClientID Connection ID used to reference the Client.
Returns:
Error code.
Return values:
0 Success.
-1 Can not establish the connection.
-1 Can not set the connection to non-blocking mode.

Definition at line 87 of file winscard_msg_srv.c.

References commonSocket, and SYS_CloseFile().

Referenced by SHMProcessEventsServer().

Here is the call graph for this function:

INTERNAL int32_t SHMProcessEventsServer ( uint32_t *  pdwClientID  ) 

Looks for messages sent by clients.

This is called by the Server's function SVCServiceRunLoop().

Parameters:
[out] pdwClientID Connection ID used to reference the Client.
Returns:
Error code.
Return values:
0 Success.
-1 Error accessing the communication channel.
-1 Can not set the connection to non-blocking mode.
2 Timeout.

Definition at line 193 of file winscard_msg_srv.c.

References commonSocket, and SHMProcessCommonChannelRequest().

Referenced by SVCServiceRunLoop().

Here is the call graph for this function:


Variable Documentation

const char* CommandsText[] [static]

Initial value:

 {
    "CMD_VERSION",  
    "ESTABLISH_CONTEXT",    
    "RELEASE_CONTEXT",
    "LIST_READERS",
    "CONNECT",
    "RECONNECT",
    "DISCONNECT",
    "BEGIN_TRANSACTION",
    "END_TRANSACTION",
    "TRANSMIT",
    "CONTROL",
    "STATUS",
    "GET_STATUS_CHANGE",
    "CANCEL",
    "CANCEL_TRANSACTION",
    "GET_ATTRIB",
    "SET_ATTRIB",
    "TRANSMIT_EXTENDED",
    "CONTROL_EXTENDED",
    "NULL"
}

Definition at line 52 of file winscard_msg_srv.c.


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