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 3260 2009-01-02 15:19:59Z rousseau $
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 
00044     typedef struct rxSharedSegment
00045     {
00046         uint32_t mtype;     
00047         uint32_t user_id;
00048         uint32_t group_id;
00049         uint32_t command;   
00050         uint64_t date;
00051         unsigned char key[PCSCLITE_MSG_KEY_LEN]; /* 16 bytes */
00052         unsigned char data[PCSCLITE_MAX_MESSAGE_SIZE];
00053     }
00054     sharedSegmentMsg, *psharedSegmentMsg;
00055 
00059     enum pcsc_adm_commands
00060     {
00061         CMD_FUNCTION = 0xF1,
00062         CMD_FAILED = 0xF2,
00063         CMD_SERVER_DIED = 0xF3,
00064         CMD_CLIENT_DIED = 0xF4,
00065         CMD_READER_EVENT = 0xF5,
00066         CMD_SYN = 0xF6,
00067         CMD_ACK = 0xF7,
00068         CMD_VERSION = 0xF8  
00069     };
00070 
00074     enum pcsc_msg_commands
00075     {
00076         SCARD_ESTABLISH_CONTEXT = 0x01, 
00077         SCARD_RELEASE_CONTEXT = 0x02,   
00078         SCARD_LIST_READERS = 0x03,      
00079         SCARD_CONNECT = 0x04,           
00080         SCARD_RECONNECT = 0x05,         
00081         SCARD_DISCONNECT = 0x06,        
00082         SCARD_BEGIN_TRANSACTION = 0x07, 
00083         SCARD_END_TRANSACTION = 0x08,   
00084         SCARD_TRANSMIT = 0x09,          
00085         SCARD_CONTROL = 0x0A,           
00086         SCARD_STATUS = 0x0B,            
00087         SCARD_GET_STATUS_CHANGE = 0x0C, 
00088         SCARD_CANCEL = 0x0D,            
00089         SCARD_CANCEL_TRANSACTION = 0x0E,
00090         SCARD_GET_ATTRIB = 0x0F,        
00091         SCARD_SET_ATTRIB = 0x10,        
00092         SCARD_TRANSMIT_EXTENDED = 0x11, 
00093         SCARD_CONTROL_EXTENDED = 0x12   
00094     };
00095 
00099     struct version_struct
00100     {
00101         int32_t major;  
00102         int32_t minor;  
00103         uint32_t rv;
00104     };
00105     typedef struct version_struct version_struct;
00106 
00107     struct client_struct
00108     {
00109         uint32_t hContext;
00110     };
00111     typedef struct client_struct client_struct;
00112 
00118     struct establish_struct
00119     {
00120         uint32_t dwScope;
00121         uint32_t phContext;
00122         uint32_t rv;
00123     };
00124     typedef struct establish_struct establish_struct;
00125 
00131     struct release_struct
00132     {
00133         uint32_t hContext;
00134         uint32_t rv;
00135     };
00136     typedef struct release_struct release_struct;
00137 
00143     struct connect_struct
00144     {
00145         uint32_t hContext;
00146         char szReader[MAX_READERNAME];
00147         uint32_t dwShareMode;
00148         uint32_t dwPreferredProtocols;
00149         int32_t phCard;
00150         uint32_t pdwActiveProtocol;
00151         uint32_t rv;
00152     };
00153     typedef struct connect_struct connect_struct;
00154 
00160     struct reconnect_struct
00161     {
00162         int32_t hCard;
00163         uint32_t dwShareMode;
00164         uint32_t dwPreferredProtocols;
00165         uint32_t dwInitialization;
00166         uint32_t pdwActiveProtocol;
00167         uint32_t rv;
00168     };
00169     typedef struct reconnect_struct reconnect_struct;
00170 
00176     struct disconnect_struct
00177     {
00178         int32_t hCard;
00179         uint32_t dwDisposition;
00180         uint32_t rv;
00181     };
00182     typedef struct disconnect_struct disconnect_struct;
00183 
00189     struct begin_struct
00190     {
00191         int32_t hCard;
00192         uint32_t rv;
00193     };
00194     typedef struct begin_struct begin_struct;
00195 
00201     struct end_struct
00202     {
00203         int32_t hCard;
00204         uint32_t dwDisposition;
00205         uint32_t rv;
00206     };
00207     typedef struct end_struct end_struct;
00208 
00214     struct cancel_struct
00215     {
00216         int32_t hCard;
00217         uint32_t rv;
00218     };
00219     typedef struct cancel_struct cancel_struct;
00220 
00226     struct status_struct
00227     {
00228         int32_t hCard;
00229         char mszReaderNames[MAX_READERNAME];
00230         uint32_t pcchReaderLen;
00231         uint32_t pdwState;
00232         uint32_t pdwProtocol;
00233         uint8_t pbAtr[MAX_ATR_SIZE];
00234         uint32_t pcbAtrLen;
00235         uint32_t rv;
00236     };
00237     typedef struct status_struct status_struct;
00238 
00244     struct transmit_struct
00245     {
00246         int32_t hCard;
00247         uint32_t pioSendPciProtocol;
00248         uint32_t pioSendPciLength;
00249         uint8_t pbSendBuffer[MAX_BUFFER_SIZE];
00250         uint32_t cbSendLength;
00251         uint32_t pioRecvPciProtocol;
00252         uint32_t pioRecvPciLength;
00253         uint8_t pbRecvBuffer[MAX_BUFFER_SIZE];
00254         uint32_t pcbRecvLength;
00255         uint32_t rv;
00256     };
00257     typedef struct transmit_struct transmit_struct;
00258 
00264     struct transmit_struct_extended
00265     {
00266         int32_t hCard;
00267         uint32_t pioSendPciProtocol;
00268         uint32_t pioSendPciLength;
00269         uint32_t cbSendLength;
00270         uint32_t pioRecvPciProtocol;
00271         uint32_t pioRecvPciLength;
00272         uint32_t pcbRecvLength;
00273         uint32_t rv;
00274         uint64_t size;
00275         uint8_t data[1];
00276     };
00277     typedef struct transmit_struct_extended transmit_struct_extended;
00278 
00284     struct control_struct
00285     {
00286         int32_t hCard;
00287         uint32_t dwControlCode;
00288         uint8_t pbSendBuffer[MAX_BUFFER_SIZE];
00289         uint32_t cbSendLength;
00290         uint8_t pbRecvBuffer[MAX_BUFFER_SIZE];
00291         uint32_t cbRecvLength;
00292         uint32_t dwBytesReturned;
00293         uint32_t rv;
00294     };
00295     typedef struct control_struct control_struct;
00296 
00302     struct control_struct_extended
00303     {
00304         int32_t hCard;
00305         uint32_t dwControlCode;
00306         uint32_t cbSendLength;
00307         uint32_t cbRecvLength;
00308         uint32_t pdwBytesReturned;
00309         uint32_t rv;
00310         uint64_t size;
00311         uint8_t data[1];
00312     };
00313     typedef struct control_struct_extended control_struct_extended;
00314 
00320     struct getset_struct
00321     {
00322         int32_t hCard;
00323         uint32_t dwAttrId;
00324         uint8_t pbAttr[MAX_BUFFER_SIZE];
00325         uint32_t cbAttrLen;
00326         uint32_t rv;
00327     };
00328     typedef struct getset_struct getset_struct;
00329 
00330     /*
00331      * Now some function definitions
00332      */
00333 
00334     int32_t SHMClientRead(psharedSegmentMsg, uint32_t, int32_t);
00335     int32_t SHMClientSetupSession(uint32_t *);
00336     int32_t SHMClientCloseSession(uint32_t);
00337     int32_t SHMInitializeCommonSegment(void);
00338     int32_t SHMProcessEventsContext(uint32_t, /*@out@*/ psharedSegmentMsg);
00339     int32_t SHMProcessEventsServer(/*@out@*/ uint32_t *);
00340     int32_t SHMMessageSend(void *buffer, uint64_t buffer_size, int32_t filedes,
00341         int32_t blockAmount);
00342     int32_t SHMMessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
00343         int32_t filedes, int32_t blockAmount);
00344     int32_t WrapSHMWrite(uint32_t command, uint32_t dwClientID, uint64_t size,
00345         uint32_t blockAmount, void *data);
00346     void SHMCleanupSharedSegment(int32_t, const char *);
00347 
00348 #ifdef __cplusplus
00349 }
00350 #endif
00351 
00352 #endif

Generated on Mon Aug 17 01:00:12 2009 for pcsc-lite by  doxygen 1.5.9