Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ctcore.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 $RCSfile: ctcore.h,v $ 00003 ------------------- 00004 cvs : $Id: ctcore.h,v 1.11 2003/04/22 22:59:24 aquamaniac Exp $ 00005 begin : Fri Nov 22 2002 00006 copyright : (C) 2001 by Martin Preuss 00007 email : martin@libchipcard.de 00008 00009 *************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 #ifndef CTDRIVER_H 00029 #define CTDRIVER_H 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 00036 #include <chameleon/error.h> 00037 #include <chameleon/conf.h> 00038 #include <ctcore_public.h> 00039 00040 #define CT_READERS_PER_CLIENT 16 00041 00042 00043 00044 typedef struct CTREADERSTRUCT CTREADERTABLE; 00045 typedef struct CTDRIVERSTRUCT CTDRIVERTABLE; 00046 typedef struct CTCLIENTSTRUCT CTCLIENTTABLE; 00047 typedef struct CTCORESTRUCT CTCORETABLE; 00048 00049 00050 /* driver functions */ 00051 typedef ERRORCODE (*CTDRIVER_ALLOCTERMPTR)(CTREADERTABLE *rt); 00052 typedef ERRORCODE (*CTDRIVER_RELEASETERMPTR)(CTREADERTABLE *rt); 00053 typedef ERRORCODE (*CTDRIVER_CONNTERMPTR)(CTREADERTABLE *rt, 00054 char *atrbuffer, 00055 int *atrbufferlen); 00056 typedef ERRORCODE (*CTDRIVER_DISCONNTERMPTR)(CTREADERTABLE *rt); 00057 typedef ERRORCODE (*CTDRIVER_STATUSPTR)(CTREADERTABLE *rt, 00058 char *atrbuffer, 00059 int *atrbufferlen); 00060 typedef ERRORCODE (*CTDRIVER_COMMANDPTR)(CTREADERTABLE *rt, 00061 const char *sendBuffer, 00062 int sendBufferLength, 00063 char *recvBuffer, 00064 int *recvBufferLength); 00065 00066 typedef CTREADERDESCRIPTION* (*CTDRIVER_ENUMTERMSPTR)(CTDRIVERTABLE *dt); 00067 typedef ERRORCODE (*CTDRIVER_CLOSEPTR)(CTDRIVERTABLE *dt); 00068 00069 00070 00071 struct CTREADERSTRUCT { 00072 CTREADERTABLE *next; 00073 int lockedByClient; 00074 int usageCount; 00075 int openCount; 00076 unsigned int lastStatus; 00077 unsigned int deltaStatus; 00078 unsigned int softDeltaStatus; 00079 int cardChanged; 00080 char atr[256]; 00081 int atrlen; 00082 CTREADERDESCRIPTION *descr; 00083 CTDRIVERTABLE *driver; 00084 void *driverData; 00085 unsigned int cardId; 00086 unsigned int lockedSince; 00087 }; 00088 00089 00090 struct CTDRIVERSTRUCT { 00091 CTDRIVERTABLE *next; 00092 int usageCount; 00093 char name[256]; 00094 void *driverData; 00095 CONFIGGROUP *driverDescription; 00096 CTDRIVER_CLOSEPTR closeDriver; 00097 CTDRIVER_ALLOCTERMPTR allocTerm; 00098 CTDRIVER_RELEASETERMPTR releaseTerm; 00099 CTDRIVER_STATUSPTR statTerm; 00100 CTDRIVER_CONNTERMPTR connectTerm; 00101 CTDRIVER_DISCONNTERMPTR disconnectTerm; 00102 CTDRIVER_ENUMTERMSPTR enumTerms; 00103 CTDRIVER_COMMANDPTR commandTerm; 00104 }; 00105 00106 00107 struct CTCLIENTSTRUCT { 00108 CTCLIENTTABLE *next; 00109 int id; 00110 CTREADERTABLE* readers[CT_READERS_PER_CLIENT]; 00111 }; 00112 00113 00114 struct CTCORESTRUCT { 00115 int nextReaderId; 00116 int nextClientId; 00117 CTREADERDESCRIPTION *readerDescriptions; 00118 CTCLIENTTABLE *clients; 00119 CTDRIVERTABLE *drivers; 00120 CTREADERTABLE *readers; 00121 CONFIGGROUP *driverDescriptions; 00122 }; 00123 00124 00125 // CTCore 00126 00127 00128 00129 CTREADERTABLE *CTCore_Reader_new(); 00130 void CTCore_Reader_free(CTREADERTABLE *rt); 00131 00132 CTDRIVERTABLE *CTCore_Driver_new(); 00133 void CTCore_Driver_free(CTDRIVERTABLE *dt); 00134 00135 CTCLIENTTABLE *CTCore_Client_new(); 00136 void CTCore_Client_free(CTCLIENTTABLE *ct); 00137 00138 CTCORETABLE *CTCore_new(); 00139 void CTCore_free(CTCORETABLE *ct); 00140 00141 00142 /* Application Programming Interface */ 00143 00144 int CTCore_RegisterClient(CTCORETABLE *ct); 00145 void CTCore_UnregisterClient(CTCORETABLE *ct, int id); 00146 00147 /* translate a reader number to a reader id */ 00148 int CTCore_GetClientReaderId(CTCORETABLE *ct, int id, int tid); 00149 00150 00154 int CTCore_AllocTerminal(CTCORETABLE *ct, int cid, int tid, 00155 CTREADERDESCRIPTION **descr); 00156 void CTCore_ReleaseTerminal(CTCORETABLE *ct, int cid, int tid); 00157 00158 ERRORCODE CTCore_ConnectTerminal(CTCORETABLE *ct, int cid, int tid, 00159 char *atrbuffer, 00160 int *atrbufferlen); 00161 ERRORCODE CTCore_DisconnectTerminal(CTCORETABLE *ct, int cid, int tid); 00162 00163 ERRORCODE CTCore_CommandTerminal(CTCORETABLE *ct, int cid, int tid, 00164 const char *sendBuffer, 00165 int sendBufferLength, 00166 char *recvBuffer, 00167 int *recvBufferLength); 00168 00172 ERRORCODE CTCore_Init(CTCORETABLE *ct, CONFIGGROUP *driverDescriptions); 00173 ERRORCODE CTCore_Fini(CTCORETABLE *ct); 00174 00181 ERRORCODE CTCore_AddReader(CTCORETABLE *ct, CTREADERDESCRIPTION *rd); 00182 00183 00188 ERRORCODE CTCore_ModuleInit(); 00189 00194 ERRORCODE CTCore_ModuleFini(); 00195 00201 void CTCore_WalkTerminals(CTCORETABLE *ct); 00202 00207 ERRORCODE CTCore_CheckReaderStatus(CTCORETABLE *ct, int cid, int tid, 00208 unsigned int *status, 00209 char *atrbuffer, 00210 int *atrbufferlen); 00211 00216 ERRORCODE CTCore_GetReaderStatus(CTCORETABLE *ct, int cid, int tid, 00217 unsigned int *status, 00218 char *atrbuffer, 00219 int *atrbufferlen); 00220 00221 00222 #ifdef __cplusplus 00223 } 00224 #endif 00225 00226 00227 #endif /* CTDRIVER_H */ 00228 00229

Generated on Wed Jul 28 14:56:49 2004 for libchipcard by doxygen 1.3.7