pcsc-lite 2.4.1
winscard_msg.h
Go to the documentation of this file.
1/*
2 * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
3 *
4 * Copyright (C) 2001-2004
5 * David Corcoran <corcoran@musclecard.com>
6 * Copyright (C) 2003-2004
7 * Damien Sauveron <damien.sauveron@labri.fr>
8 * Copyright (C) 2002-2021
9 * Ludovic Rousseau <ludovic.rousseau@free.fr>
10 *
11Redistribution and use in source and binary forms, with or without
12modification, are permitted provided that the following conditions
13are met:
14
151. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
172. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
203. The name of the author may not be used to endorse or promote products
21 derived from this software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
40
41#ifndef __winscard_msg_h__
42#define __winscard_msg_h__
43
44#include <stdint.h>
45
46#include "pcsclite.h"
47#include "wintypes.h"
48
50#define PROTOCOL_VERSION_MAJOR 4
52#define PROTOCOL_VERSION_MINOR 5
54#define PROTOCOL_VERSION_MINOR_CLIENT_BACKWARD 4
56#define PROTOCOL_VERSION_MINOR_SERVER_BACKWARD 4
57
62 {
63 int32_t major;
64 int32_t minor;
65 uint32_t rv;
66 };
67
71 struct rxHeader
72 {
73 uint32_t size;
74 uint32_t command;
75 };
76
106
108 {
109 uint32_t hContext;
110 };
111
116 {
117 uint32_t timeOut;
118 uint32_t rv;
119 };
120
127 {
128 uint32_t dwScope;
129 uint32_t hContext;
130 uint32_t rv;
131 };
132
139 {
140 uint32_t hContext;
141 uint32_t rv;
142 };
143
150 {
151 uint32_t hContext;
152 char szReader[MAX_READERNAME];
153 uint32_t dwShareMode;
154 uint32_t dwPreferredProtocols;
155 int32_t hCard;
156 uint32_t dwActiveProtocol;
157 uint32_t rv;
158 };
159
166 {
167 int32_t hCard;
168 uint32_t dwShareMode;
169 uint32_t dwPreferredProtocols;
170 uint32_t dwInitialization;
171 uint32_t dwActiveProtocol;
172 uint32_t rv;
173 };
174
181 {
182 int32_t hCard;
183 uint32_t dwDisposition;
184 uint32_t rv;
185 };
186
193 {
194 int32_t hCard;
195 uint32_t rv;
196 };
197
204 {
205 int32_t hCard;
206 uint32_t dwDisposition;
207 uint32_t rv;
208 };
209
216 {
217 int32_t hContext;
218 uint32_t rv;
219 };
220
227 {
228 int32_t hCard;
229 uint32_t rv;
230 };
231
238 {
239 int32_t hCard;
240 uint32_t ioSendPciProtocol;
241 uint32_t ioSendPciLength;
242 uint32_t cbSendLength;
243 uint32_t ioRecvPciProtocol;
244 uint32_t ioRecvPciLength;
245 uint32_t pcbRecvLength;
246 uint32_t rv;
247 };
248
255 {
256 int32_t hCard;
257 uint32_t dwControlCode;
258 uint32_t cbSendLength;
259 uint32_t cbRecvLength;
260 uint32_t dwBytesReturned;
261 uint32_t rv;
262 };
263
270 {
271 int32_t hCard;
272 uint32_t dwAttrId;
273 uint8_t pbAttr[MAX_BUFFER_SIZE];
274 uint32_t cbAttrLen;
275 uint32_t rv;
276 };
277
279 {
280 uint32_t readerEvents;
281 uint32_t rv;
282 };
283
284 /*
285 * Now some function definitions
286 */
287
288#ifdef PCSCD
289 int32_t InitializeSocket(void);
290 int32_t ListenExistingSocket(int fd);
291 int32_t ProcessEventsServer(/*@out@*/ uint32_t *);
292#else
293 char *getSocketName(void);
294 int32_t ClientSetupSession(uint32_t *);
295 void ClientCloseSession(uint32_t);
296 LONG MessageReceiveTimeout(uint32_t command, /*@out@*/ void *buffer,
297 uint64_t buffer_size, int32_t filedes, long timeOut);
298 LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID,
299 uint64_t size, void *data);
300#endif
301 LONG MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
302 LONG MessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
303 int32_t filedes);
304
305#endif
This keeps a list of defines for pcsc-lite.
#define MAX_BUFFER_SIZE
Maximum Tx/Rx Buffer for short APDU.
Definition pcsclite.h:298
contained in SCARD_BEGIN_TRANSACTION Messages.
contained in SCARD_CANCEL Messages.
contained in SCARD_CONNECT Messages.
contained in SCARD_CONTROL Messages.
contained in SCARD_DISCONNECT Messages.
contained in SCARD_END_TRANSACTION Messages.
Information contained in SCARD_ESTABLISH_CONTEXT Messages.
contained in SCARD_GET_ATTRIB and Messages.
contained in SCARD_RECONNECT Messages.
Information contained in SCARD_RELEASE_CONTEXT Messages.
header structure for client/server message data exchange.
uint32_t size
size of the message excluding this header
uint32_t command
one of the pcsc_msg_commands
contained in SCARD_STATUS Messages.
contained in SCARD_TRANSMIT Messages.
Information transmitted in CMD_VERSION Messages.
int32_t major
IPC major PROTOCOL_VERSION_MAJOR.
int32_t minor
IPC minor PROTOCOL_VERSION_MINOR.
Information contained in CMD_WAIT_READER_STATE_CHANGE Messages.
uint32_t timeOut
timeout in ms
LONG MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes)
Sends a menssage from client to server or vice-versa.
LONG MessageReceive(void *buffer, uint64_t buffer_size, int32_t filedes)
Called by the Client to get the response from the server or vice-versa.
LONG MessageReceiveTimeout(uint32_t command, void *buffer, uint64_t buffer_size, int32_t filedes, long timeOut)
Called by the Client to get the response from the server or vice-versa.
LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID, uint64_t size, void *data)
Wrapper for the MessageSend() function.
void ClientCloseSession(uint32_t)
Closes the socket used by the client to communicate with the server.
int32_t ClientSetupSession(uint32_t *)
Prepares a communication channel for the client to talk to the server.
pcsc_msg_commands
Commands available to use in the field sharedSegmentMsg.command.
@ SCARD_DISCONNECT
used by SCardDisconnect()
@ SCARD_SET_ATTRIB
used by SCardSetAttrib()
@ SCARD_RELEASE_CONTEXT
used by SCardReleaseContext()
@ CMD_STOP_WAITING_READER_STATE_CHANGE
stop waiting for a reader state change
@ CMD_GET_READERS_STATE
get the readers state
@ SCARD_GET_STATUS_CHANGE
not used
@ SCARD_CONTROL
used by SCardControl()
@ CMD_VERSION
get the client/server protocol version
@ CMD_WAIT_READER_STATE_CHANGE
wait for a reader state change
@ SCARD_RECONNECT
used by SCardReconnect()
@ SCARD_STATUS
used by SCardStatus()
@ SCARD_GET_ATTRIB
used by SCardGetAttrib()
@ CMD_GET_READER_EVENTS
get the number of reader events
@ SCARD_BEGIN_TRANSACTION
used by SCardBeginTransaction()
@ SCARD_TRANSMIT
used by SCardTransmit()
@ SCARD_LIST_READERS
used by SCardListReaders()
@ SCARD_END_TRANSACTION
used by SCardEndTransaction()
@ SCARD_CANCEL
used by SCardCancel()
@ SCARD_CANCEL_TRANSACTION
not used
@ SCARD_CONNECT
used by SCardConnect()
@ SCARD_ESTABLISH_CONTEXT
used by SCardEstablishContext()
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.
This keeps a list of Windows(R) types.