|
pcsc-lite
1.7.4
|
This is responsible for client/server communication. 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 <stdlib.h>#include "misc.h"#include "pcscd.h"#include "winscard.h"#include "debuglog.h"#include "winscard_msg.h"#include "sys_generic.h"#include "utils.h"#include "strlcpycat.h"Go to the source code of this file.
Functions | |
| char * | getSocketName (void) |
| INTERNAL int | ClientSetupSession (uint32_t *pdwClientID) |
| Prepares a communication channel for the client to talk to the server. | |
| INTERNAL int | ClientCloseSession (uint32_t dwClientID) |
| Closes the socket used by the client to communicate with the server. | |
| INTERNAL LONG | MessageReceiveTimeout (uint32_t command, void *buffer_void, uint64_t buffer_size, int32_t filedes, unsigned long timeOut) |
| Called by the Client to get the reponse from the server or vice-versa. | |
| INTERNAL LONG | MessageSendWithHeader (uint32_t command, uint32_t dwClientID, uint64_t size, void *data_void) |
| Wrapper for the MessageSend() function. | |
| INTERNAL LONG | MessageSend (void *buffer_void, uint64_t buffer_size, int32_t filedes) |
| Sends a menssage from client to server or vice-versa. | |
| INTERNAL LONG | MessageReceive (void *buffer_void, uint64_t buffer_size, int32_t filedes) |
| Called by the Client to get the reponse from the server or vice-versa. | |
This is responsible for client/server communication.
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.c.
| INTERNAL int ClientCloseSession | ( | uint32_t | dwClientID | ) |
Closes the socket used by the client to communicate with the server.
| [in] | dwClientID | Client socket handle to be closed. |
| 0 | Success. |
Definition at line 138 of file winscard_msg.c.
Referenced by SCardCancel().
| INTERNAL int ClientSetupSession | ( | uint32_t * | pdwClientID | ) |
Prepares a communication channel for the client to talk to the server.
This is called by the application to create a socket for local IPC with the server. The socket is associated to the file PCSCLITE_CSOCK_NAME.
| [out] | pdwClientID | Client Connection ID. |
| 0 | Success. |
| -1 | Can not create the socket. |
| -1 | The socket can not open a connection. |
| -1 | Can not set the socket to non-blocking. |
Definition at line 90 of file winscard_msg.c.
Referenced by SCardEstablishContextTH(), and SCardCancel().
| INTERNAL LONG MessageReceive | ( | void * | buffer_void, |
| uint64_t | buffer_size, | ||
| int32_t | filedes | ||
| ) |
Called by the Client to get the reponse from the server or vice-versa.
Reads the message from the file filedes.
| [out] | buffer_void | Message read. |
| [in] | buffer_size | Size to read |
| [in] | filedes | Socket handle. |
| SCARD_S_SUCCESS | Success. |
| SCARD_F_COMM_ERROR | Socket is closed. |
| SCARD_F_COMM_ERROR | A signal was received. |
Definition at line 415 of file winscard_msg.c.
References SCARD_S_SUCCESS, and SCARD_F_COMM_ERROR.
Referenced by SCardEstablishContextTH(), SCardReleaseContext(), SCardConnect(), SCardReconnect(), SCardDisconnect(), SCardBeginTransaction(), SCardEndTransaction(), SCardStatus(), SCardGetStatusChange(), SCardControl(), SCardTransmit(), and SCardCancel().
| INTERNAL LONG MessageReceiveTimeout | ( | uint32_t | command, |
| void * | buffer_void, | ||
| uint64_t | buffer_size, | ||
| int32_t | filedes, | ||
| unsigned long | timeOut | ||
| ) |
Called by the Client to get the reponse from the server or vice-versa.
Reads the message from the file filedes.
| [in] | command | one of the pcsc_msg_commands commands |
| [out] | buffer_void | Message read. |
| [in] | buffer_size | Size to read |
| [in] | filedes | Socket handle. |
| [in] | timeOut | Timeout in milliseconds. |
| SCARD_S_SUCCESS | Success. |
| SCARD_E_TIMEOUT | Timeout. |
| SCARD_F_COMM_ERROR | Socket is closed. |
| SCARD_F_COMM_ERROR | A signal was received. |
Definition at line 159 of file winscard_msg.c.
References SCARD_S_SUCCESS, time_sub(), SCARD_E_TIMEOUT, SCARD_F_COMM_ERROR, and SCardCheckDaemonAvailability().
Referenced by SCardGetStatusChange().
| INTERNAL LONG MessageSend | ( | void * | buffer_void, |
| uint64_t | buffer_size, | ||
| int32_t | filedes | ||
| ) |
Sends a menssage from client to server or vice-versa.
Writes the message in the shared file filedes.
| [in] | buffer_void | Message to be sent. |
| [in] | buffer_size | Size of the message to send |
| [in] | filedes | Socket handle. |
| SCARD_S_SUCCESS | Success |
| SCARD_E_TIMEOUT | Timeout. |
| SCARD_F_COMM_ERROR | Socket is closed. |
| SCARD_F_COMM_ERROR | A signal was received. |
Definition at line 317 of file winscard_msg.c.
References SCARD_S_SUCCESS, SCARD_F_COMM_ERROR, SCARD_E_NO_SERVICE, and SCARD_E_TIMEOUT.
Referenced by SCardControl(), SCardTransmit(), and MessageSendWithHeader().
| INTERNAL LONG MessageSendWithHeader | ( | uint32_t | command, |
| uint32_t | dwClientID, | ||
| uint64_t | size, | ||
| void * | data_void | ||
| ) |
Wrapper for the MessageSend() function.
Called by clients to send messages to the server. The parameters command and data are set in the sharedSegmentMsg struct in order to be sent.
| [in] | command | Command to be sent. |
| [in] | dwClientID | Client socket handle. |
| [in] | size | Size of the message (data). |
| [in] | data_void | Data to be sent. |
Definition at line 281 of file winscard_msg.c.
References rxHeader::command, rxHeader::size, and MessageSend().
Referenced by SCardEstablishContextTH(), SCardReleaseContext(), SCardConnect(), SCardReconnect(), SCardDisconnect(), SCardBeginTransaction(), SCardEndTransaction(), SCardStatus(), SCardGetStatusChange(), SCardControl(), SCardTransmit(), and SCardCancel().
1.7.5