Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00020 #ifndef __winscard_msg_h__
00021 #define __winscard_msg_h__
00022
00023 #include <stdint.h>
00024
00026 #define PROTOCOL_VERSION_MAJOR 4
00027
00028 #define PROTOCOL_VERSION_MINOR 0
00029
00030 #ifdef __cplusplus
00031 extern "C"
00032 {
00033 #endif
00034
00038 struct version_struct
00039 {
00040 int32_t major;
00041 int32_t minor;
00042 uint32_t rv;
00043 };
00044
00048 struct rxHeader
00049 {
00050 uint32_t size;
00051 uint32_t command;
00052 };
00053
00057 enum pcsc_msg_commands
00058 {
00059 CMD_ENUM_FIRST,
00060 SCARD_ESTABLISH_CONTEXT = 0x01,
00061 SCARD_RELEASE_CONTEXT = 0x02,
00062 SCARD_LIST_READERS = 0x03,
00063 SCARD_CONNECT = 0x04,
00064 SCARD_RECONNECT = 0x05,
00065 SCARD_DISCONNECT = 0x06,
00066 SCARD_BEGIN_TRANSACTION = 0x07,
00067 SCARD_END_TRANSACTION = 0x08,
00068 SCARD_TRANSMIT = 0x09,
00069 SCARD_CONTROL = 0x0A,
00070 SCARD_STATUS = 0x0B,
00071 SCARD_GET_STATUS_CHANGE = 0x0C,
00072 SCARD_CANCEL = 0x0D,
00073 SCARD_CANCEL_TRANSACTION = 0x0E,
00074 SCARD_GET_ATTRIB = 0x0F,
00075 SCARD_SET_ATTRIB = 0x10,
00076 CMD_VERSION = 0x11,
00077 CMD_GET_READERS_STATE = 0x12,
00078 CMD_WAIT_READER_STATE_CHANGE = 0x13,
00079 CMD_STOP_WAITING_READER_STATE_CHANGE = 0x14,
00080 CMD_ENUM_LAST
00081 };
00082
00083 struct client_struct
00084 {
00085 uint32_t hContext;
00086 };
00087
00091 struct wait_reader_state_change
00092 {
00093 uint32_t timeOut;
00094 uint32_t rv;
00095 };
00096
00102 struct establish_struct
00103 {
00104 uint32_t dwScope;
00105 uint32_t hContext;
00106 uint32_t rv;
00107 };
00108
00114 struct release_struct
00115 {
00116 uint32_t hContext;
00117 uint32_t rv;
00118 };
00119
00125 struct connect_struct
00126 {
00127 uint32_t hContext;
00128 char szReader[MAX_READERNAME];
00129 uint32_t dwShareMode;
00130 uint32_t dwPreferredProtocols;
00131 int32_t hCard;
00132 uint32_t dwActiveProtocol;
00133 uint32_t rv;
00134 };
00135
00141 struct reconnect_struct
00142 {
00143 int32_t hCard;
00144 uint32_t dwShareMode;
00145 uint32_t dwPreferredProtocols;
00146 uint32_t dwInitialization;
00147 uint32_t dwActiveProtocol;
00148 uint32_t rv;
00149 };
00150
00156 struct disconnect_struct
00157 {
00158 int32_t hCard;
00159 uint32_t dwDisposition;
00160 uint32_t rv;
00161 };
00162
00168 struct begin_struct
00169 {
00170 int32_t hCard;
00171 uint32_t rv;
00172 };
00173
00179 struct end_struct
00180 {
00181 int32_t hCard;
00182 uint32_t dwDisposition;
00183 uint32_t rv;
00184 };
00185
00191 struct cancel_struct
00192 {
00193 int32_t hContext;
00194 uint32_t rv;
00195 };
00196
00202 struct cancel_transaction_struct
00203 {
00204 int32_t hCard;
00205 uint32_t rv;
00206 };
00207
00213 struct status_struct
00214 {
00215 int32_t hCard;
00216 char mszReaderNames[MAX_READERNAME];
00217 uint32_t pcchReaderLen;
00218 uint32_t dwState;
00219 uint32_t dwProtocol;
00220 uint8_t pbAtr[MAX_ATR_SIZE];
00221 uint32_t pcbAtrLen;
00222 uint32_t rv;
00223 };
00224
00230 struct transmit_struct
00231 {
00232 int32_t hCard;
00233 uint32_t ioSendPciProtocol;
00234 uint32_t ioSendPciLength;
00235 uint32_t cbSendLength;
00236 uint32_t ioRecvPciProtocol;
00237 uint32_t ioRecvPciLength;
00238 uint32_t pcbRecvLength;
00239 uint32_t rv;
00240 };
00241
00247 struct control_struct
00248 {
00249 int32_t hCard;
00250 uint32_t dwControlCode;
00251 uint32_t cbSendLength;
00252 uint32_t cbRecvLength;
00253 uint32_t dwBytesReturned;
00254 uint32_t rv;
00255 };
00256
00262 struct getset_struct
00263 {
00264 int32_t hCard;
00265 uint32_t dwAttrId;
00266 uint8_t pbAttr[MAX_BUFFER_SIZE];
00267 uint32_t cbAttrLen;
00268 uint32_t rv;
00269 };
00270
00271
00272
00273
00274
00275 int32_t ClientSetupSession(uint32_t *);
00276 int32_t ClientCloseSession(uint32_t);
00277 int32_t InitializeSocket(void);
00278 int32_t ProcessEventsServer( uint32_t *);
00279 int32_t MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
00280 int32_t MessageReceive( void *buffer, uint64_t buffer_size,
00281 int32_t filedes);
00282 int32_t MessageReceiveTimeout(uint32_t command, void *buffer,
00283 uint64_t buffer_size, int32_t filedes, int32_t timeOut);
00284 int32_t MessageSendWithHeader(uint32_t command, uint32_t dwClientID, uint64_t size, void *data);
00285 void CleanupSharedSegment(int32_t, const char *);
00286
00287 #ifdef __cplusplus
00288 }
00289 #endif
00290
00291 #endif