00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CHIPCARD_SERVER2_SERVER_L_H
00016 #define CHIPCARD_SERVER2_SERVER_L_H
00017
00018 #include <gwenhywfar/plugin.h>
00019
00020 #define LCS_MARK_SERVER 1
00021 #define LCS_MARK_DRIVER 2
00022 #define LCS_MARK_CLIENT 3
00023 #define LCS_MARK_SLAVE 4
00024
00025
00028 #define LCS_DEFAULT_DHFILE "chipcardd-dh.pem"
00029 #define LCS_DEFAULT_CERTFILE "chipcardd-cert.pem"
00030
00031 #define LCS_IPC_URL "/libchipcard2/server"
00032
00036 #define LCS_PATH_DESTLIB "libchipcard2"
00037 #define LCS_PATH_DRIVER_INFODIR "DriverInfoDir"
00038 #define LCS_PATH_DRIVER_EXECDIR "DriverExecDir"
00039
00040 #define LCS_PATH_SERVICE_EXECDIR "ServiceExecDir"
00041
00042 #define LCS_PATH_SERVER_DATADIR "DataDir"
00043 #define LCS_PATH_SERVER_NEWCERTDIR "NewCertDir"
00044 #define LCS_PATH_SERVER_TRUSTEDCERTDIR "TrustedCertDir"
00045 #define LCS_PATH_SERVER_LOGDIR "LogDir"
00046
00047 #define LCS_REGKEY_BASE "Software\\Libchipcard2\\Server\\Paths"
00048
00053 #define LCS_PLUGIN_DRIVER "Libchipcard2_Driver"
00054
00057 #define LCS_PLUGIN_SERVICE "Libchipcard2_Service"
00058
00059
00060 #define LCS_WORKRESULT_CHANGED 0
00061 #define LCS_WORKRESULT_UNCHANGED 1
00062 #define LCS_WORKRESULT_ERROR (-1)
00063 #define LCS_WORKRESULT_RESTART (-2)
00064
00065 #define LCS_INITRESULT_OK 0
00066 #define LCS_INITRESULT_ERROR (-1)
00067 #define LCS_INITRESULT_RESTART 1
00068
00069
00070 #include <gwenhywfar/ipc.h>
00071 #include <gwenhywfar/requestmgr.h>
00072 #include <gwenhywfar/inherit.h>
00073 #include <gwenhywfar/db.h>
00074 #include <gwenhywfar/buffer.h>
00075 #include <gwenhywfar/iolayer.h>
00076
00077
00078 typedef struct LCS_SERVER LCS_SERVER;
00079 GWEN_INHERIT_FUNCTION_DEFS(LCS_SERVER)
00080
00081 typedef enum {
00082 LCS_Server_RoleStandAlone=0,
00083 LCS_Server_RoleMaster,
00084 LCS_Server_RoleSlave
00085 } LCS_SERVER_ROLE;
00086
00087
00088 #include <chipcard/chipcard.h>
00089 #include "common/card.h"
00090 #include "common/reader.h"
00091 #include "connection_l.h"
00092 #include "devicemanager/devicemanager_l.h"
00093 #include "clientmanager/clientmanager_l.h"
00094 #include "cardmanager/cardmanager_l.h"
00095 #include "servicemanager/servicemanager_l.h"
00096 #include "slavemanager/slavemanager_l.h"
00097
00098
00099
00100 LCS_SERVER *LCS_Server_new();
00101 void LCS_Server_free(LCS_SERVER *cs);
00102
00103 int LCS_Server_Init(LCS_SERVER *cs, GWEN_DB_NODE *db);
00104 int LCS_Server_Fini(LCS_SERVER *cs, GWEN_DB_NODE *db);
00105
00107 int LCS_Server_Work(LCS_SERVER *cs);
00108
00109
00113 void LCS_Server_BeginUseReaders(LCS_SERVER *cs);
00114 void LCS_Server_EndUseReaders(LCS_SERVER *cs, int count);
00115
00116
00117
00123 void LCS_Server_UseConnectionFor(LCS_SERVER *cs,
00124 GWEN_IO_LAYER *conn,
00125 LCS_CONNECTION_TYPE t,
00126 uint32_t ipcId);
00127
00128
00133 void LCS_Server_DriverChg(LCS_SERVER *cs,
00134 uint32_t did,
00135 const char *driverType,
00136 const char *driverName,
00137 const char *libraryFile,
00138 LC_DRIVER_STATUS newSt,
00139 const char *reason);
00140
00141 void LCS_Server_ReaderChg(LCS_SERVER *cs,
00142 uint32_t did,
00143 LCCO_READER *r,
00144 LC_READER_STATUS newSt,
00145 const char *reason);
00146
00150 void LCS_Server_NewReader(LCS_SERVER *cs, LCCO_READER *r);
00151
00158 void LCS_Server_NewCard(LCS_SERVER *cs, LCCO_CARD *card);
00159
00160 void LCS_Server_CardRemoved(LCS_SERVER *cs, LCCO_CARD *card);
00161
00162 void LCS_Server_ConnectionDown(LCS_SERVER *cs, uint32_t id, GWEN_IO_LAYER *conn);
00163
00164 void LCS_Server_ServiceChg(LCS_SERVER *cs,
00165 uint32_t sid,
00166 const char *serviceType,
00167 const char *serviceName,
00168 LC_SERVICE_STATUS newSt,
00169 const char *reason);
00170
00175 GWEN_IPCMANAGER *LCS_Server_GetIpcManager(const LCS_SERVER *cs);
00176 GWEN_IPC_REQUEST_MANAGER *LCS_Server_GetRequestManager(const LCS_SERVER *cs);
00177
00178 LCDM_DEVICEMANAGER *LCS_Server_GetDeviceManager(const LCS_SERVER *cs);
00179
00180 LCCM_CARDMANAGER *LCS_Server_GetCardManager(const LCS_SERVER *cs);
00181
00182 LCSV_SERVICEMANAGER *LCS_Server_GetServiceManager(const LCS_SERVER *cs);
00183
00184 LCSL_SLAVEMANAGER *LCS_Server_GetSlaveManager(const LCS_SERVER *cs);
00185
00186
00187 int LCS_Server_ReplaceVar(const char *path,
00188 const char *var,
00189 const char *value,
00190 GWEN_BUFFER *nbuf);
00191
00192
00193 int LCS_Server_SendErrorResponse(LCS_SERVER *cs,
00194 uint32_t rid,
00195 int code,
00196 const char *text);
00197
00198 int LCS_Server_CheckIpcResponse(GWEN_DB_NODE *db);
00199
00200
00201 LCS_SERVER_ROLE LCS_Server_GetRole(const LCS_SERVER *cs);
00202
00203 void LCS_Server_DumpState(const LCS_SERVER *cs);
00204
00205 int LCS_Server_GetClientCount(LCS_SERVER *cs);
00206
00207 void LCS_Server_TriggerHwScan(LCS_SERVER *cs);
00208
00209 int LCS_Server_GetPollModeDisabled(const LCS_SERVER *cs);
00210 void LCS_Server_SetPollModeDisabled(LCS_SERVER *cs, int i);
00211
00212
00213 #endif
00214
00215
00216