Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00018 #ifndef __winscard_msg_h__
00019 #define __winscard_msg_h__
00020
00021 #include <stdint.h>
00022
00024 #define PROTOCOL_VERSION_MAJOR 3
00025
00026 #define PROTOCOL_VERSION_MINOR 0
00027
00028 #ifdef __cplusplus
00029 extern "C"
00030 {
00031 #endif
00032
00036 struct version_struct
00037 {
00038 int32_t major;
00039 int32_t minor;
00040 uint32_t rv;
00041 };
00042 typedef struct version_struct version_struct;
00043
00055 typedef struct rxSharedSegment
00056 {
00057 uint32_t mtype;
00058 uint32_t user_id;
00059 uint32_t group_id;
00060 uint32_t command;
00061 uint64_t date;
00062 unsigned char key[PCSCLITE_MSG_KEY_LEN];
00063 union
00064 {
00065 unsigned char data[PCSCLITE_MAX_MESSAGE_SIZE];
00066 struct version_struct veStr;
00067 };
00068 }
00069 sharedSegmentMsg, *psharedSegmentMsg;
00070
00074 enum pcsc_adm_commands
00075 {
00076 CMD_FUNCTION = 0xF1,
00077 CMD_FAILED = 0xF2,
00078 CMD_SERVER_DIED = 0xF3,
00079 CMD_CLIENT_DIED = 0xF4,
00080 CMD_READER_EVENT = 0xF5,
00081 CMD_SYN = 0xF6,
00082 CMD_ACK = 0xF7,
00083 CMD_VERSION = 0xF8
00084 };
00085
00089 enum pcsc_msg_commands
00090 {
00091 SCARD_ESTABLISH_CONTEXT = 0x01,
00092 SCARD_RELEASE_CONTEXT = 0x02,
00093 SCARD_LIST_READERS = 0x03,
00094 SCARD_CONNECT = 0x04,
00095 SCARD_RECONNECT = 0x05,
00096 SCARD_DISCONNECT = 0x06,
00097 SCARD_BEGIN_TRANSACTION = 0x07,
00098 SCARD_END_TRANSACTION = 0x08,
00099 SCARD_TRANSMIT = 0x09,
00100 SCARD_CONTROL = 0x0A,
00101 SCARD_STATUS = 0x0B,
00102 SCARD_GET_STATUS_CHANGE = 0x0C,
00103 SCARD_CANCEL = 0x0D,
00104 SCARD_CANCEL_TRANSACTION = 0x0E,
00105 SCARD_GET_ATTRIB = 0x0F,
00106 SCARD_SET_ATTRIB = 0x10,
00107 SCARD_TRANSMIT_EXTENDED = 0x11,
00108 SCARD_CONTROL_EXTENDED = 0x12
00109 };
00110
00111 struct client_struct
00112 {
00113 uint32_t hContext;
00114 };
00115 typedef struct client_struct client_struct;
00116
00122 struct establish_struct
00123 {
00124 uint32_t dwScope;
00125 uint32_t hContext;
00126 uint32_t rv;
00127 };
00128 typedef struct establish_struct establish_struct;
00129
00135 struct release_struct
00136 {
00137 uint32_t hContext;
00138 uint32_t rv;
00139 };
00140 typedef struct release_struct release_struct;
00141
00147 struct connect_struct
00148 {
00149 uint32_t hContext;
00150 char szReader[MAX_READERNAME];
00151 uint32_t dwShareMode;
00152 uint32_t dwPreferredProtocols;
00153 int32_t hCard;
00154 uint32_t dwActiveProtocol;
00155 uint32_t rv;
00156 };
00157 typedef struct connect_struct connect_struct;
00158
00164 struct reconnect_struct
00165 {
00166 int32_t hCard;
00167 uint32_t dwShareMode;
00168 uint32_t dwPreferredProtocols;
00169 uint32_t dwInitialization;
00170 uint32_t dwActiveProtocol;
00171 uint32_t rv;
00172 };
00173 typedef struct reconnect_struct reconnect_struct;
00174
00180 struct disconnect_struct
00181 {
00182 int32_t hCard;
00183 uint32_t dwDisposition;
00184 uint32_t rv;
00185 };
00186 typedef struct disconnect_struct disconnect_struct;
00187
00193 struct begin_struct
00194 {
00195 int32_t hCard;
00196 uint32_t rv;
00197 };
00198 typedef struct begin_struct begin_struct;
00199
00205 struct end_struct
00206 {
00207 int32_t hCard;
00208 uint32_t dwDisposition;
00209 uint32_t rv;
00210 };
00211 typedef struct end_struct end_struct;
00212
00218 struct cancel_struct
00219 {
00220 int32_t hCard;
00221 uint32_t rv;
00222 };
00223 typedef struct cancel_struct cancel_struct;
00224
00230 struct status_struct
00231 {
00232 int32_t hCard;
00233 char mszReaderNames[MAX_READERNAME];
00234 uint32_t pcchReaderLen;
00235 uint32_t dwState;
00236 uint32_t dwProtocol;
00237 uint8_t pbAtr[MAX_ATR_SIZE];
00238 uint32_t pcbAtrLen;
00239 uint32_t rv;
00240 };
00241 typedef struct status_struct status_struct;
00242
00248 struct transmit_struct
00249 {
00250 int32_t hCard;
00251 uint32_t ioSendPciProtocol;
00252 uint32_t ioSendPciLength;
00253 uint8_t pbSendBuffer[MAX_BUFFER_SIZE];
00254 uint32_t cbSendLength;
00255 uint32_t ioRecvPciProtocol;
00256 uint32_t ioRecvPciLength;
00257 uint8_t pbRecvBuffer[MAX_BUFFER_SIZE];
00258 uint32_t pcbRecvLength;
00259 uint32_t rv;
00260 };
00261 typedef struct transmit_struct transmit_struct;
00262
00268 struct transmit_struct_extended
00269 {
00270 int32_t hCard;
00271 uint32_t ioSendPciProtocol;
00272 uint32_t ioSendPciLength;
00273 uint32_t cbSendLength;
00274 uint32_t ioRecvPciProtocol;
00275 uint32_t ioRecvPciLength;
00276 uint32_t pcbRecvLength;
00277 uint32_t rv;
00278 uint64_t size;
00279 uint8_t data[1];
00280 };
00281 typedef struct transmit_struct_extended transmit_struct_extended;
00282
00288 struct control_struct
00289 {
00290 int32_t hCard;
00291 uint32_t dwControlCode;
00292 uint8_t pbSendBuffer[MAX_BUFFER_SIZE];
00293 uint32_t cbSendLength;
00294 uint8_t pbRecvBuffer[MAX_BUFFER_SIZE];
00295 uint32_t cbRecvLength;
00296 uint32_t dwBytesReturned;
00297 uint32_t rv;
00298 };
00299 typedef struct control_struct control_struct;
00300
00306 struct control_struct_extended
00307 {
00308 int32_t hCard;
00309 uint32_t dwControlCode;
00310 uint32_t cbSendLength;
00311 uint32_t cbRecvLength;
00312 uint32_t dwBytesReturned;
00313 uint32_t rv;
00314 uint64_t size;
00315 uint8_t data[1];
00316 };
00317 typedef struct control_struct_extended control_struct_extended;
00318
00324 struct getset_struct
00325 {
00326 int32_t hCard;
00327 uint32_t dwAttrId;
00328 uint8_t pbAttr[MAX_BUFFER_SIZE];
00329 uint32_t cbAttrLen;
00330 uint32_t rv;
00331 };
00332 typedef struct getset_struct getset_struct;
00333
00334
00335
00336
00337
00338 int32_t SHMClientRead(psharedSegmentMsg, uint32_t, int32_t);
00339 int32_t SHMClientSetupSession(uint32_t *);
00340 int32_t SHMClientCloseSession(uint32_t);
00341 int32_t SHMInitializeCommonSegment(void);
00342 int32_t SHMProcessEventsContext(uint32_t, psharedSegmentMsg);
00343 int32_t SHMProcessEventsServer( uint32_t *);
00344 int32_t SHMMessageSend(void *buffer, uint64_t buffer_size, int32_t filedes,
00345 int32_t blockAmount);
00346 int32_t SHMMessageReceive( void *buffer, uint64_t buffer_size,
00347 int32_t filedes, int32_t blockAmount);
00348 int32_t WrapSHMWrite(uint32_t command, uint32_t dwClientID, uint64_t size,
00349 uint32_t blockAmount, void *data);
00350 void SHMCleanupSharedSegment(int32_t, const char *);
00351
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355
00356 #endif