Go to the source code of this file.
Data Structures | |
| struct | rxSharedSegment |
| General structure for client/serve message data exchange. More... | |
| struct | version_struct |
Information transmitted in CMD_VERSION Messages. More... | |
| struct | client_struct |
| struct | establish_struct |
Information contained in SCARD_ESTABLISH_CONTEXT Messages. More... | |
| struct | release_struct |
Information contained in SCARD_RELEASE_CONTEXT Messages. More... | |
| struct | connect_struct |
contained in SCARD_CONNECT Messages. More... | |
| struct | reconnect_struct |
contained in SCARD_RECONNECT Messages. More... | |
| struct | disconnect_struct |
contained in SCARD_DISCONNECT Messages. More... | |
| struct | begin_struct |
contained in SCARD_BEGIN_TRANSACTION Messages. More... | |
| struct | end_struct |
contained in SCARD_END_TRANSACTION Messages. More... | |
| struct | cancel_struct |
contained in SCARD_CANCEL Messages. More... | |
| struct | status_struct |
contained in SCARD_STATUS Messages. More... | |
| struct | transmit_struct |
contained in SCARD_TRANSMIT Messages. More... | |
| struct | transmit_struct_extended |
contained in SCARD_TRANSMIT_EXTENDED Messages. More... | |
| struct | control_struct |
contained in SCARD_CONTROL Messages. More... | |
| struct | control_struct_extended |
contained in SCARD_CONTROL_EXTENDED Messages. More... | |
| struct | getset_struct |
contained in SCARD_GET_ATTRIB and Messages. More... | |
Defines | |
| #define | PROTOCOL_VERSION_MAJOR 2 |
| Major version of the current message protocol. | |
| #define | PROTOCOL_VERSION_MINOR 2 |
| Minor version of the current message protocol. | |
Typedefs | |
| typedef struct rxSharedSegment | sharedSegmentMsg |
| typedef struct rxSharedSegment * | psharedSegmentMsg |
| typedef struct version_struct | version_struct |
| typedef struct client_struct | client_struct |
| typedef struct establish_struct | establish_struct |
| typedef struct release_struct | release_struct |
| typedef struct connect_struct | connect_struct |
| typedef struct reconnect_struct | reconnect_struct |
| typedef struct disconnect_struct | disconnect_struct |
| typedef struct begin_struct | begin_struct |
| typedef struct end_struct | end_struct |
| typedef struct cancel_struct | cancel_struct |
| typedef struct status_struct | status_struct |
| typedef struct transmit_struct | transmit_struct |
|
typedef struct transmit_struct_extended | transmit_struct_extended |
| typedef struct control_struct | control_struct |
|
typedef struct control_struct_extended | control_struct_extended |
| typedef struct getset_struct | getset_struct |
Enumerations | |
| enum | pcsc_adm_commands { CMD_FUNCTION = 0xF1, CMD_FAILED = 0xF2, CMD_SERVER_DIED = 0xF3, CMD_CLIENT_DIED = 0xF4, CMD_READER_EVENT = 0xF5, CMD_SYN = 0xF6, CMD_ACK = 0xF7, CMD_VERSION = 0xF8 } |
Command types available to use in the field sharedSegmentMsg.mtype. | |
| enum | pcsc_msg_commands { SCARD_ESTABLISH_CONTEXT = 0x01, SCARD_RELEASE_CONTEXT = 0x02, SCARD_LIST_READERS = 0x03, SCARD_CONNECT = 0x04, SCARD_RECONNECT = 0x05, SCARD_DISCONNECT = 0x06, SCARD_BEGIN_TRANSACTION = 0x07, SCARD_END_TRANSACTION = 0x08, SCARD_TRANSMIT = 0x09, SCARD_CONTROL = 0x0A, SCARD_STATUS = 0x0B, SCARD_GET_STATUS_CHANGE = 0x0C, SCARD_CANCEL = 0x0D, SCARD_CANCEL_TRANSACTION = 0x0E, SCARD_GET_ATTRIB = 0x0F, SCARD_SET_ATTRIB = 0x10, SCARD_TRANSMIT_EXTENDED = 0x11, SCARD_CONTROL_EXTENDED = 0x12 } |
Commands available to use in the field sharedSegmentMsg.command. | |
Functions | |
| int | SHMClientRead (psharedSegmentMsg, DWORD, int) |
| Wrapper for the SHMMessageReceive() function. | |
| int | SHMClientSetupSession (PDWORD) |
| Prepares a communication channel for the client to talk to the server. | |
| int | SHMClientCloseSession (DWORD) |
| Closes the socket used by the client to communicate with the server. | |
| int | SHMInitializeCommonSegment (void) |
| Prepares the communication channel used by the server to talk to the clients. | |
| int | SHMProcessEventsContext (PDWORD, psharedSegmentMsg, int) |
Called by ContextThread(). | |
| int | SHMProcessEventsServer (PDWORD, int) |
| Looks for messages sent by clients. | |
| int | SHMMessageSend (void *buffer, size_t buffer_size, int filedes, int blockAmount) |
| Sends a menssage from client to server or vice-versa. | |
| int | SHMMessageReceive (void *buffer, size_t buffer_size, int filedes, int blockAmount) |
| Called by the Client to get the reponse from the server or vice-versa. | |
| int | WrapSHMWrite (unsigned int command, DWORD dwClientID, unsigned int size, unsigned int blockAmount, void *data) |
| Wrapper for the SHMMessageSend() function. | |
| void | SHMCleanupSharedSegment (int, const char *) |
| Closes the communications channel used by the server to talk to the clients. | |
Definition in file winscard_msg.h.
| void SHMCleanupSharedSegment | ( | int | sockValue, | |
| const char * | pcFilePath | |||
| ) |
Closes the communications channel used by the server to talk to the clients.
The socket used is closed and the file it is bound to is removed.
| [in] | sockValue | Socket to be closed. |
| [in] | pcFilePath | File used by the socket. |
Definition at line 479 of file winscard_msg.c.
References SYS_CloseFile().
Referenced by SHMInitializeCommonSegment().
| int SHMClientCloseSession | ( | DWORD | 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 122 of file winscard_msg.c.
References SYS_CloseFile().
Referenced by SCardUnload().
| int SHMClientRead | ( | psharedSegmentMsg | msgStruct, | |
| DWORD | dwClientID, | |||
| int | blockamount | |||
| ) |
Wrapper for the SHMMessageReceive() function.
Called by clients to read the server responses.
| [out] | msgStruct | Message read. |
| [in] | dwClientID | Client socket handle. |
| [in] | blockamount | Timeout in milliseconds. |
Definition at line 57 of file winscard_msg.c.
References SHMMessageReceive().
Referenced by SCardBeginTransaction(), SCardCancelTransaction(), SCardConnect(), SCardControl(), SCardDisconnect(), SCardEndTransaction(), SCardEstablishContextTH(), SCardReconnect(), SCardReleaseContext(), SCardStatus(), and SCardTransmit().
| int SHMClientSetupSession | ( | PDWORD | 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 75 of file winscard_msg.c.
References SYS_CloseFile().
Referenced by SCardEstablishContextTH().
| int 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.
| 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 110 of file winscard_msg_srv.c.
References commonSocket, and SHMCleanupSharedSegment().
Referenced by SVCServiceRunLoop().
| int SHMMessageReceive | ( | void * | buffer_void, | |
| size_t | buffer_size, | |||
| int | filedes, | |||
| int | blockAmount | |||
| ) |
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. |
| [in] | blockAmount | Timeout in milliseconds. |
| 0 | Success. | |
| -1 | Timeout. | |
| -1 | Socket is closed. | |
| -1 | A signal was received. |
Definition at line 268 of file winscard_msg.c.
References SCardCheckDaemonAvailability().
Referenced by MSGFunctionDemarshall(), SCardControl(), SCardEstablishContextTH(), SCardTransmit(), SHMClientRead(), and SHMProcessEventsContext().
| int SHMMessageSend | ( | void * | buffer_void, | |
| size_t | buffer_size, | |||
| int | filedes, | |||
| int | blockAmount | |||
| ) |
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. |
| [in] | blockAmount | Timeout in milliseconds. |
| 0 | Success | |
| -1 | Timeout. | |
| -1 | Socket is closed. | |
| -1 | A signal was received. |
Definition at line 143 of file winscard_msg.c.
Referenced by ContextThread(), MSGFunctionDemarshall(), SCardEstablishContextTH(), and WrapSHMWrite().
| int SHMProcessEventsServer | ( | PDWORD | pdwClientID, | |
| int | blocktime | |||
| ) |
Looks for messages sent by clients.
This is called by the Server's function SVCServiceRunLoop().
| [out] | pdwClientID | Connection ID used to reference the Client. |
| [in] | blocktime | Timeout (not used). |
| 0 | Success. | |
| -1 | Error accessing the communication channel. | |
| -1 | Can not set the connection to non-blocking mode. | |
| 2 | Timeout. |
Definition at line 171 of file winscard_msg_srv.c.
References commonSocket, and SHMProcessCommonChannelRequest().
Referenced by SVCServiceRunLoop().
| int WrapSHMWrite | ( | unsigned int | command, | |
| DWORD | dwClientID, | |||
| unsigned int | size, | |||
| unsigned int | blockAmount, | |||
| void * | data_void | |||
| ) |
Wrapper for the SHMMessageSend() 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] | blockAmount | Timeout to the operation in ms. |
| [in] | data_void | Data to be sent. |
Definition at line 412 of file winscard_msg.c.
References rxSharedSegment::command, rxSharedSegment::data, rxSharedSegment::date, rxSharedSegment::dummy, rxSharedSegment::group_id, rxSharedSegment::key, rxSharedSegment::mtype, SHMMessageSend(), and rxSharedSegment::user_id.
Referenced by SCardBeginTransaction(), SCardCancelTransaction(), SCardConnect(), SCardControl(), SCardDisconnect(), SCardEndTransaction(), SCardEstablishContextTH(), SCardReconnect(), SCardReleaseContext(), SCardStatus(), and SCardTransmit().
1.5.5