pcsc-lite 1.7.2

winscard_msg.h

Go to the documentation of this file.
00001 /*
00002  * MUSCLE SmartCard Development ( http://www.linuxnet.com )
00003  *
00004  * Copyright (C) 2001-2004
00005  *  David Corcoran <corcoran@linuxnet.com>
00006  * Copyright (C) 2003-2004
00007  *  Damien Sauveron <damien.sauveron@labri.fr>
00008  * Copyright (C) 2002-2010
00009  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
00010  *
00011  * $Id: winscard_msg.h 5434 2010-12-08 14:13:21Z rousseau $
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 2
00029 
00033     struct version_struct
00034     {
00035         int32_t major;  
00036         int32_t minor;  
00037         uint32_t rv;
00038     };
00039 
00043     struct rxHeader
00044     {
00045         uint32_t size;      
00046         uint32_t command;   
00047     };
00048 
00052     enum pcsc_msg_commands
00053     {
00054         CMD_ENUM_FIRST,
00055         SCARD_ESTABLISH_CONTEXT = 0x01, 
00056         SCARD_RELEASE_CONTEXT = 0x02,   
00057         SCARD_LIST_READERS = 0x03,      
00058         SCARD_CONNECT = 0x04,           
00059         SCARD_RECONNECT = 0x05,         
00060         SCARD_DISCONNECT = 0x06,        
00061         SCARD_BEGIN_TRANSACTION = 0x07, 
00062         SCARD_END_TRANSACTION = 0x08,   
00063         SCARD_TRANSMIT = 0x09,          
00064         SCARD_CONTROL = 0x0A,           
00065         SCARD_STATUS = 0x0B,            
00066         SCARD_GET_STATUS_CHANGE = 0x0C, 
00067         SCARD_CANCEL = 0x0D,            
00068         SCARD_CANCEL_TRANSACTION = 0x0E,
00069         SCARD_GET_ATTRIB = 0x0F,        
00070         SCARD_SET_ATTRIB = 0x10,        
00071         CMD_VERSION = 0x11,             
00072         CMD_GET_READERS_STATE = 0x12,   
00073         CMD_WAIT_READER_STATE_CHANGE = 0x13,    
00074         CMD_STOP_WAITING_READER_STATE_CHANGE = 0x14,    
00075         CMD_ENUM_LAST
00076     };
00077 
00078     struct client_struct
00079     {
00080         uint32_t hContext;
00081     };
00082 
00086     struct wait_reader_state_change
00087     {
00088         uint32_t timeOut;   
00089         uint32_t rv;
00090     };
00091 
00097     struct establish_struct
00098     {
00099         uint32_t dwScope;
00100         uint32_t hContext;
00101         uint32_t rv;
00102     };
00103 
00109     struct release_struct
00110     {
00111         uint32_t hContext;
00112         uint32_t rv;
00113     };
00114 
00120     struct connect_struct
00121     {
00122         uint32_t hContext;
00123         char szReader[MAX_READERNAME];
00124         uint32_t dwShareMode;
00125         uint32_t dwPreferredProtocols;
00126         int32_t hCard;
00127         uint32_t dwActiveProtocol;
00128         uint32_t rv;
00129     };
00130 
00136     struct reconnect_struct
00137     {
00138         int32_t hCard;
00139         uint32_t dwShareMode;
00140         uint32_t dwPreferredProtocols;
00141         uint32_t dwInitialization;
00142         uint32_t dwActiveProtocol;
00143         uint32_t rv;
00144     };
00145 
00151     struct disconnect_struct
00152     {
00153         int32_t hCard;
00154         uint32_t dwDisposition;
00155         uint32_t rv;
00156     };
00157 
00163     struct begin_struct
00164     {
00165         int32_t hCard;
00166         uint32_t rv;
00167     };
00168 
00174     struct end_struct
00175     {
00176         int32_t hCard;
00177         uint32_t dwDisposition;
00178         uint32_t rv;
00179     };
00180 
00186     struct cancel_struct
00187     {
00188         int32_t hContext;
00189         uint32_t rv;
00190     };
00191 
00197     struct status_struct
00198     {
00199         int32_t hCard;
00200         uint32_t rv;
00201     };
00202 
00208     struct transmit_struct
00209     {
00210         int32_t hCard;
00211         uint32_t ioSendPciProtocol;
00212         uint32_t ioSendPciLength;
00213         uint32_t cbSendLength;
00214         uint32_t ioRecvPciProtocol;
00215         uint32_t ioRecvPciLength;
00216         uint32_t pcbRecvLength;
00217         uint32_t rv;
00218     };
00219 
00225     struct control_struct
00226     {
00227         int32_t hCard;
00228         uint32_t dwControlCode;
00229         uint32_t cbSendLength;
00230         uint32_t cbRecvLength;
00231         uint32_t dwBytesReturned;
00232         uint32_t rv;
00233     };
00234 
00240     struct getset_struct
00241     {
00242         int32_t hCard;
00243         uint32_t dwAttrId;
00244         uint8_t pbAttr[MAX_BUFFER_SIZE];
00245         uint32_t cbAttrLen;
00246         uint32_t rv;
00247     };
00248 
00249     /*
00250      * Now some function definitions
00251      */
00252 
00253 #ifdef PCSCD
00254     int32_t InitializeSocket(void);
00255     int32_t ProcessEventsServer(/*@out@*/ uint32_t *);
00256 #else
00257     char *getSocketName(void);
00258     int32_t ClientSetupSession(uint32_t *);
00259     int32_t ClientCloseSession(uint32_t);
00260     LONG MessageReceiveTimeout(uint32_t command, /*@out@*/ void *buffer,
00261         uint64_t buffer_size, int32_t filedes, int32_t timeOut);
00262     LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID,
00263         uint64_t size, void *data);
00264 #endif
00265     LONG MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
00266     LONG MessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
00267         int32_t filedes);
00268 
00269 #endif