pcsc-lite  1.8.8
winscard_msg.h
Go to the documentation of this file.
1 /*
2  * MUSCLE SmartCard Development ( http://www.linuxnet.com )
3  *
4  * Copyright (C) 2001-2004
5  * David Corcoran <corcoran@linuxnet.com>
6  * Copyright (C) 2003-2004
7  * Damien Sauveron <damien.sauveron@labri.fr>
8  * Copyright (C) 2002-2010
9  * Ludovic Rousseau <ludovic.rousseau@free.fr>
10  *
11  * $Id: winscard_msg.h 5929 2011-09-03 21:43:21Z rousseau $
12  */
13 
20 #ifndef __winscard_msg_h__
21 #define __winscard_msg_h__
22 
23 #include <stdint.h>
24 
26 #define PROTOCOL_VERSION_MAJOR 4
27 
28 #define PROTOCOL_VERSION_MINOR 2
29 
34  {
35  int32_t major;
36  int32_t minor;
37  uint32_t rv;
38  };
39 
43  struct rxHeader
44  {
45  uint32_t size;
46  uint32_t command;
47  };
48 
53  {
54  CMD_ENUM_FIRST,
58  SCARD_CONNECT = 0x04,
59  SCARD_RECONNECT = 0x05,
63  SCARD_TRANSMIT = 0x09,
64  SCARD_CONTROL = 0x0A,
65  SCARD_STATUS = 0x0B,
67  SCARD_CANCEL = 0x0D,
71  CMD_VERSION = 0x11,
75  CMD_ENUM_LAST
76  };
77 
79  {
80  uint32_t hContext;
81  };
82 
87  {
88  uint32_t timeOut;
89  uint32_t rv;
90  };
91 
98  {
99  uint32_t dwScope;
100  uint32_t hContext;
101  uint32_t rv;
102  };
103 
110  {
111  uint32_t hContext;
112  uint32_t rv;
113  };
114 
121  {
122  uint32_t hContext;
123  char szReader[MAX_READERNAME];
124  uint32_t dwShareMode;
125  uint32_t dwPreferredProtocols;
126  int32_t hCard;
127  uint32_t dwActiveProtocol;
128  uint32_t rv;
129  };
130 
137  {
138  int32_t hCard;
139  uint32_t dwShareMode;
140  uint32_t dwPreferredProtocols;
141  uint32_t dwInitialization;
142  uint32_t dwActiveProtocol;
143  uint32_t rv;
144  };
145 
152  {
153  int32_t hCard;
154  uint32_t dwDisposition;
155  uint32_t rv;
156  };
157 
164  {
165  int32_t hCard;
166  uint32_t rv;
167  };
168 
174  struct end_struct
175  {
176  int32_t hCard;
177  uint32_t dwDisposition;
178  uint32_t rv;
179  };
180 
187  {
188  int32_t hContext;
189  uint32_t rv;
190  };
191 
198  {
199  int32_t hCard;
200  uint32_t rv;
201  };
202 
209  {
210  int32_t hCard;
211  uint32_t ioSendPciProtocol;
212  uint32_t ioSendPciLength;
213  uint32_t cbSendLength;
214  uint32_t ioRecvPciProtocol;
215  uint32_t ioRecvPciLength;
216  uint32_t pcbRecvLength;
217  uint32_t rv;
218  };
219 
226  {
227  int32_t hCard;
228  uint32_t dwControlCode;
229  uint32_t cbSendLength;
230  uint32_t cbRecvLength;
231  uint32_t dwBytesReturned;
232  uint32_t rv;
233  };
234 
241  {
242  int32_t hCard;
243  uint32_t dwAttrId;
244  uint8_t pbAttr[MAX_BUFFER_SIZE];
245  uint32_t cbAttrLen;
246  uint32_t rv;
247  };
248 
249  /*
250  * Now some function definitions
251  */
252 
253 #ifdef PCSCD
254  int32_t InitializeSocket(void);
255  int32_t ListenExistingSocket(int fd);
256  int32_t ProcessEventsServer(/*@out@*/ uint32_t *);
257 #else
258  char *getSocketName(void);
259  int32_t ClientSetupSession(uint32_t *);
260  int32_t ClientCloseSession(uint32_t);
261  LONG MessageReceiveTimeout(uint32_t command, /*@out@*/ void *buffer,
262  uint64_t buffer_size, int32_t filedes, long timeOut);
263  LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID,
264  uint64_t size, void *data);
265 #endif
266  LONG MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
267  LONG MessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
268  int32_t filedes);
269 
270 #endif
used by SCardBeginTransaction()
Definition: winscard_msg.h:61
contained in SCARD_CONNECT Messages.
Definition: winscard_msg.h:120
wait for a reader state change
Definition: winscard_msg.h:73
contained in SCARD_CANCEL Messages.
Definition: winscard_msg.h:186
contained in SCARD_TRANSMIT Messages.
Definition: winscard_msg.h:208
contained in SCARD_END_TRANSACTION Messages.
Definition: winscard_msg.h:174
INTERNAL int ClientCloseSession(uint32_t dwClientID)
Closes the socket used by the client to communicate with the server.
Definition: winscard_msg.c:145
#define MAX_BUFFER_SIZE
Maximum Tx/Rx Buffer for short APDU.
Definition: pcsclite.h:208
INTERNAL int32_t ListenExistingSocket(int fd)
Acquires a socket passed in from systemd.
get the client/server protocol version
Definition: winscard_msg.h:71
used by SCardEstablishContext()
Definition: winscard_msg.h:55
INTERNAL LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID, uint64_t size, void *data_void)
Wrapper for the MessageSend() function.
Definition: winscard_msg.c:288
int32_t minor
IPC minor PROTOCOL_VERSION_MINOR.
Definition: winscard_msg.h:36
used by SCardEndTransaction()
Definition: winscard_msg.h:62
uint32_t command
one of the pcsc_msg_commands
Definition: winscard_msg.h:46
used by SCardConnect()
Definition: winscard_msg.h:58
contained in SCARD_DISCONNECT Messages.
Definition: winscard_msg.h:151
Information contained in SCARD_RELEASE_CONTEXT Messages.
Definition: winscard_msg.h:109
contained in SCARD_BEGIN_TRANSACTION Messages.
Definition: winscard_msg.h:163
Information contained in SCARD_ESTABLISH_CONTEXT Messages.
Definition: winscard_msg.h:97
get the readers state
Definition: winscard_msg.h:72
Information transmitted in CMD_VERSION Messages.
Definition: winscard_msg.h:33
header structure for client/server message data exchange.
Definition: winscard_msg.h:43
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.
Definition: winscard_msg.c:422
used by SCardReleaseContext()
Definition: winscard_msg.h:56
contained in SCARD_STATUS Messages.
Definition: winscard_msg.h:197
contained in SCARD_RECONNECT Messages.
Definition: winscard_msg.h:136
uint32_t timeOut
timeout in ms
Definition: winscard_msg.h:88
contained in SCARD_GET_ATTRIB and Messages.
Definition: winscard_msg.h:240
Information contained in CMD_WAIT_READER_STATE_CHANGE Messages.
Definition: winscard_msg.h:86
INTERNAL int32_t InitializeSocket(void)
Prepares the communication channel used by the server to talk to the clients.
used by SCardReconnect()
Definition: winscard_msg.h:59
used by SCardTransmit()
Definition: winscard_msg.h:63
pcsc_msg_commands
Commands available to use in the field sharedSegmentMsg.command.
Definition: winscard_msg.h:52
stop waiting for a reader state change
Definition: winscard_msg.h:74
uint32_t size
size of the message excluding this header
Definition: winscard_msg.h:45
INTERNAL int ClientSetupSession(uint32_t *pdwClientID)
Prepares a communication channel for the client to talk to the server.
Definition: winscard_msg.c:90
used by SCardControl()
Definition: winscard_msg.h:64
used by SCardSetAttrib()
Definition: winscard_msg.h:70
used by SCardListReaders()
Definition: winscard_msg.h:57
INTERNAL LONG MessageSend(void *buffer_void, uint64_t buffer_size, int32_t filedes)
Sends a menssage from client to server or vice-versa.
Definition: winscard_msg.c:324
INTERNAL int32_t ProcessEventsServer(uint32_t *pdwClientID)
Looks for messages sent by clients.
used by SCardDisconnect()
Definition: winscard_msg.h:60
contained in SCARD_CONTROL Messages.
Definition: winscard_msg.h:225
used by SCardGetAttrib()
Definition: winscard_msg.h:69
used by SCardCancel()
Definition: winscard_msg.h:67
int32_t major
IPC major PROTOCOL_VERSION_MAJOR.
Definition: winscard_msg.h:35
used by SCardStatus()
Definition: winscard_msg.h:65
INTERNAL LONG MessageReceiveTimeout(uint32_t command, void *buffer_void, uint64_t buffer_size, int32_t filedes, long timeOut)
Called by the Client to get the reponse from the server or vice-versa.
Definition: winscard_msg.c:166