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  *  Damien Sauveron <damien.sauveron@labri.fr>
00007  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
00008  *
00009  * $Id: winscard_msg.h 1695 2005-10-29 16:27:33Z rousseau $
00010  */
00011 
00018 #ifndef __winscard_msg_h__
00019 #define __winscard_msg_h__
00020 
00022 #define PROTOCOL_VERSION_MAJOR 2
00023 
00024 #define PROTOCOL_VERSION_MINOR 0
00025 
00026 #ifdef __cplusplus
00027 extern "C"
00028 {
00029 #endif
00030 
00042     typedef struct rxSharedSegment
00043     {
00044         unsigned int mtype;     
00045         unsigned int user_id;
00046         unsigned int group_id;
00047         unsigned int command;   
00048         unsigned int dummy; /* was request_id in pcsc-lite <= 1.2.0 */
00049         time_t date;
00050         unsigned char key[PCSCLITE_MSG_KEY_LEN];
00051         unsigned char data[PCSCLITE_MAX_MESSAGE_SIZE];
00052     }
00053     sharedSegmentMsg, *psharedSegmentMsg;
00054 
00058     enum pcsc_adm_commands
00059     {
00060         CMD_FUNCTION = 0xF1,
00061         CMD_FAILED = 0xF2,
00062         CMD_SERVER_DIED = 0xF3,
00063         CMD_CLIENT_DIED = 0xF4,
00064         CMD_READER_EVENT = 0xF5,
00065         CMD_SYN = 0xF6,
00066         CMD_ACK = 0xF7,
00067         CMD_VERSION = 0xF8
00068     };
00069 
00073     enum pcsc_msg_commands
00074     {
00075         SCARD_ESTABLISH_CONTEXT = 0x01,
00076         SCARD_RELEASE_CONTEXT = 0x02,
00077         SCARD_LIST_READERS = 0x03,
00078         SCARD_CONNECT = 0x04,
00079         SCARD_RECONNECT = 0x05,
00080         SCARD_DISCONNECT = 0x06,
00081         SCARD_BEGIN_TRANSACTION = 0x07,
00082         SCARD_END_TRANSACTION = 0x08,
00083         SCARD_TRANSMIT = 0x09,
00084         SCARD_CONTROL = 0x0A,
00085         SCARD_STATUS = 0x0B,
00086         SCARD_GET_STATUS_CHANGE = 0x0C,
00087         SCARD_CANCEL = 0x0D,
00088         SCARD_CANCEL_TRANSACTION = 0x0E,
00089         SCARD_GET_ATTRIB = 0x0F,
00090         SCARD_SET_ATTRIB = 0x10
00091     };
00092 
00096     struct version_struct
00097     {
00098         int major;
00099         int minor;
00100         LONG rv;
00101     };
00102     typedef struct version_struct version_struct;
00103 
00104     struct client_struct
00105     {
00106         SCARDCONTEXT hContext;
00107     };
00108     typedef struct client_struct client_struct;
00109 
00115     struct establish_struct
00116     {
00117         DWORD dwScope;
00118         SCARDCONTEXT phContext;
00119         LONG rv;
00120     };
00121     typedef struct establish_struct establish_struct;
00122 
00128     struct release_struct
00129     {
00130         SCARDCONTEXT hContext;
00131         LONG rv;
00132     };
00133     typedef struct release_struct release_struct;
00134 
00140     struct connect_struct
00141     {
00142         SCARDCONTEXT hContext;
00143         char szReader[MAX_READERNAME];
00144         DWORD dwShareMode;
00145         DWORD dwPreferredProtocols;
00146         SCARDHANDLE phCard;
00147         DWORD pdwActiveProtocol;
00148         LONG rv;
00149     };
00150     typedef struct connect_struct connect_struct;
00151 
00157     struct reconnect_struct
00158     {
00159         SCARDHANDLE hCard;
00160         DWORD dwShareMode;
00161         DWORD dwPreferredProtocols;
00162         DWORD dwInitialization;
00163         DWORD pdwActiveProtocol;
00164         LONG rv;
00165     };
00166     typedef struct reconnect_struct reconnect_struct;
00167 
00173     struct disconnect_struct
00174     {
00175         SCARDHANDLE hCard;
00176         DWORD dwDisposition;
00177         LONG rv;
00178     };
00179     typedef struct disconnect_struct disconnect_struct;
00180 
00186     struct begin_struct
00187     {
00188         SCARDHANDLE hCard;
00189         LONG rv;
00190     };
00191     typedef struct begin_struct begin_struct;
00192 
00198     struct end_struct
00199     {
00200         SCARDHANDLE hCard;
00201         DWORD dwDisposition;
00202         LONG rv;
00203     };
00204     typedef struct end_struct end_struct;
00205 
00211     struct cancel_struct
00212     {
00213         SCARDHANDLE hCard;
00214         LONG rv;
00215     };
00216     typedef struct cancel_struct cancel_struct;
00217 
00223     struct status_struct
00224     {
00225         SCARDHANDLE hCard;
00226         char mszReaderNames[MAX_READERNAME];
00227         DWORD pcchReaderLen;
00228         DWORD pdwState;
00229         DWORD pdwProtocol;
00230         UCHAR pbAtr[MAX_ATR_SIZE];
00231         DWORD pcbAtrLen;
00232         LONG rv;
00233     };
00234     typedef struct status_struct status_struct;
00235 
00241     struct transmit_struct
00242     {
00243         SCARDHANDLE hCard;
00244         SCARD_IO_REQUEST pioSendPci;
00245         UCHAR pbSendBuffer[MAX_BUFFER_SIZE];
00246         DWORD cbSendLength;
00247         SCARD_IO_REQUEST pioRecvPci;
00248         BYTE pbRecvBuffer[MAX_BUFFER_SIZE];
00249         DWORD pcbRecvLength;
00250         LONG rv;
00251     };
00252     typedef struct transmit_struct transmit_struct;
00253 
00259     struct control_struct
00260     {
00261         SCARDHANDLE hCard;
00262         DWORD dwControlCode;
00263         UCHAR pbSendBuffer[MAX_BUFFER_SIZE];
00264         DWORD cbSendLength;
00265         UCHAR pbRecvBuffer[MAX_BUFFER_SIZE];
00266         DWORD cbRecvLength;
00267         DWORD dwBytesReturned;
00268         LONG rv;
00269     };
00270     typedef struct control_struct control_struct;
00271 
00277     struct getset_struct
00278     {
00279         SCARDHANDLE hCard;
00280         DWORD dwAttrId;
00281         UCHAR pbAttr[MAX_BUFFER_SIZE];
00282         DWORD cbAttrLen;
00283         LONG rv;
00284     };
00285     typedef struct getset_struct getset_struct;
00286 
00287     /*
00288      * Now some function definitions 
00289      */
00290 
00291     int SHMClientRead(psharedSegmentMsg, DWORD, int);
00292     int SHMClientSetupSession(PDWORD);
00293     int SHMClientCloseSession(DWORD);
00294     int SHMInitializeCommonSegment(void);
00295     int SHMProcessEventsContext(PDWORD, psharedSegmentMsg, int);
00296     int SHMProcessEventsServer(PDWORD, int);
00297     int SHMMessageSend(psharedSegmentMsg, int, int);
00298     int SHMMessageReceive(psharedSegmentMsg, int, int);
00299     int WrapSHMWrite(unsigned int, DWORD, unsigned int,
00300         unsigned int, void *);
00301     void SHMCleanupSharedSegment(int, char *);
00302 
00303 #ifdef __cplusplus
00304 }
00305 #endif
00306 
00307 #endif

Generated on Sat Oct 14 22:17:35 2006 for pcsc-lite by  doxygen 1.4.7