pcsc-lite 2.3.0
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"

Go to the source code of this file.

Functions

static int ProcessCommonChannelRequest (uint32_t *pdwClientID)
 Accepts a Client connection.
 
INTERNAL int32_t InitializeSocket (void)
 Prepares the communication channel used by the server to talk to the clients.
 
INTERNAL int32_t ProcessEventsServer (uint32_t *pdwClientID)
 Looks for messages sent by clients.
 

Variables

static int commonSocket = 0
 Socket to a file, used for clients-server communication.
 
char AraKiri
 

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

◆ InitializeSocket()

INTERNAL int32_t InitializeSocket ( 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
0Success
-1
  • Can not create the socket
  • or Can not bind the socket to the file PCSCLITE_CSOCK_NAME
  • or Can not put the socket in listen mode.

Definition at line 120 of file winscard_msg_srv.c.

◆ ProcessCommonChannelRequest()

static int ProcessCommonChannelRequest ( uint32_t * pdwClientID)
static

Accepts a Client connection.

Called by ProcessEventsServer().

Parameters
[out]pdwClientIDConnection ID used to reference the Client.
Returns
Error code.
Return values
0Success.
-1Can not establish the connection.

Definition at line 84 of file winscard_msg_srv.c.

◆ ProcessEventsServer()

INTERNAL int32_t ProcessEventsServer ( uint32_t * pdwClientID)

Looks for messages sent by clients.

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

Parameters
[out]pdwClientIDConnection ID used to reference the Client.
Returns
Error code.
Return values
0Success.
-1Error accessing the communication channel.
-2EINTR
2Timeout.

Definition at line 207 of file winscard_msg_srv.c.

Variable Documentation

◆ AraKiri

char AraKiri
extern

Definition at line 72 of file pcscdaemon.c.

◆ commonSocket

int commonSocket = 0
static

Socket to a file, used for clients-server communication.

Definition at line 70 of file winscard_msg_srv.c.