server_l.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003                              -------------------
00004     cvs         : $Id: server_l.h 388 2007-05-02 19:24:12Z christian $
00005     begin       : Mon Mar 01 2004
00006     copyright   : (C) 2004 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *          Please see toplevel file COPYING for license details           *
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 #include <gwenhywfar/nl_ssl.h>
00020 
00021 #define LCS_MARK_SERVER 1
00022 #define LCS_MARK_DRIVER 2
00023 #define LCS_MARK_CLIENT 3
00024 #define LCS_MARK_SLAVE  4
00025 
00026 
00029 #define LCS_DEFAULT_DHFILE   "chipcardd-dh.pem"
00030 #define LCS_DEFAULT_CERTFILE "chipcardd-cert.pem"
00031 
00032 #define LCS_IPC_URL "/libchipcard2/server"
00033 
00037 #define LCS_PATH_DESTLIB                "libchipcard2"
00038 #define LCS_PATH_DRIVER_INFODIR         "DriverInfoDir"
00039 #define LCS_PATH_DRIVER_EXECDIR         "DriverExecDir"
00040 
00041 #define LCS_PATH_SERVICE_EXECDIR        "ServiceExecDir"
00042 
00043 #define LCS_PATH_SERVER_DATADIR         "DataDir"
00044 #define LCS_PATH_SERVER_NEWCERTDIR      "NewCertDir"
00045 #define LCS_PATH_SERVER_TRUSTEDCERTDIR  "TrustedCertDir"
00046 #define LCS_PATH_SERVER_LOGDIR          "LogDir"
00047 
00048 #define LCS_REGKEY_BASE                 "Software\\Libchipcard2\\Server\\Paths"
00049 
00054 #define LCS_PLUGIN_DRIVER "Libchipcard2_Driver"
00055 
00058 #define LCS_PLUGIN_SERVICE "Libchipcard2_Service"
00059 
00060 
00061 #define LCS_WORKRESULT_CHANGED    0
00062 #define LCS_WORKRESULT_UNCHANGED  1
00063 #define LCS_WORKRESULT_ERROR     (-1)
00064 #define LCS_WORKRESULT_RESTART   (-2)
00065 
00066 #define LCS_INITRESULT_OK       0
00067 #define LCS_INITRESULT_ERROR   (-1)
00068 #define LCS_INITRESULT_RESTART  1
00069 
00070 
00071 #include <gwenhywfar/ipc.h>
00072 #include <gwenhywfar/requestmgr.h>
00073 #include <gwenhywfar/inherit.h>
00074 #include <gwenhywfar/db.h>
00075 #include <gwenhywfar/buffer.h>
00076 #include <gwenhywfar/netlayer.h>
00077 
00078 
00079 typedef struct LCS_SERVER LCS_SERVER;
00080 GWEN_INHERIT_FUNCTION_DEFS(LCS_SERVER)
00081 
00082 typedef enum {
00083   LCS_Server_RoleStandAlone=0,
00084   LCS_Server_RoleMaster,
00085   LCS_Server_RoleSlave
00086 } LCS_SERVER_ROLE;
00087 
00088 
00089 #include <chipcard3/chipcard3.h>
00090 #include "common/card.h"
00091 #include "common/reader.h"
00092 #include "connection_l.h"
00093 #include "devicemanager/devicemanager_l.h"
00094 #include "clientmanager/clientmanager_l.h"
00095 #include "cardmanager/cardmanager_l.h"
00096 #include "servicemanager/servicemanager_l.h"
00097 #include "slavemanager/slavemanager_l.h"
00098 
00099 
00100 
00101 typedef GWEN_NL_SSL_ASKADDCERT_RESULT
00102   (*LCS_SERVER_ASKADDCERT_FN)(LCS_SERVER *cs,
00103                               GWEN_NETLAYER *nl,
00104                               const GWEN_SSLCERTDESCR *cert);
00105 
00106 
00107 LCS_SERVER *LCS_Server_new();
00108 void LCS_Server_free(LCS_SERVER *cs);
00109 
00110 int LCS_Server_Init(LCS_SERVER *cs, GWEN_DB_NODE *db);
00111 int LCS_Server_Fini(LCS_SERVER *cs, GWEN_DB_NODE *db);
00112 
00114 int LCS_Server_Work(LCS_SERVER *cs);
00115 
00116 
00120 void LCS_Server_BeginUseReaders(LCS_SERVER *cs);
00121 void LCS_Server_EndUseReaders(LCS_SERVER *cs, int count);
00122 
00123 
00124 
00125 LCS_SERVER_ASKADDCERT_FN
00126   LCS_Server_SetAskAddCertFn(LCS_SERVER *cs,
00127                              LCS_SERVER_ASKADDCERT_FN fn);
00128 
00129 
00135 void LCS_Server_UseConnectionFor(LCS_SERVER *cs,
00136                                  GWEN_NETLAYER *conn,
00137                                  LCS_CONNECTION_TYPE t,
00138                                  GWEN_TYPE_UINT32 ipcId);
00139 
00140 
00145 void LCS_Server_DriverChg(LCS_SERVER *cs,
00146                           GWEN_TYPE_UINT32 did,
00147                           const char *driverType,
00148                           const char *driverName,
00149                           const char *libraryFile,
00150                           LC_DRIVER_STATUS newSt,
00151                           const char *reason);
00152 
00153 void LCS_Server_ReaderChg(LCS_SERVER *cs,
00154                           GWEN_TYPE_UINT32 did,
00155                           LCCO_READER *r,
00156                           LC_READER_STATUS newSt,
00157                           const char *reason);
00158 
00162 void LCS_Server_NewReader(LCS_SERVER *cs, LCCO_READER *r);
00163 
00170 void LCS_Server_NewCard(LCS_SERVER *cs, LCCO_CARD *card);
00171 
00172 void LCS_Server_CardRemoved(LCS_SERVER *cs, LCCO_CARD *card);
00173 
00174 void LCS_Server_ConnectionDown(LCS_SERVER *cs,
00175                                GWEN_NETLAYER *conn);
00176 
00177 void LCS_Server_ServiceChg(LCS_SERVER *cs,
00178                            GWEN_TYPE_UINT32 sid,
00179                            const char *serviceType,
00180                            const char *serviceName,
00181                            LC_SERVICE_STATUS newSt,
00182                            const char *reason);
00183 
00188 GWEN_IPCMANAGER *LCS_Server_GetIpcManager(const LCS_SERVER *cs);
00189 GWEN_IPC_REQUEST_MANAGER *LCS_Server_GetRequestManager(const LCS_SERVER *cs);
00190 
00191 LCDM_DEVICEMANAGER *LCS_Server_GetDeviceManager(const LCS_SERVER *cs);
00192 
00193 LCCM_CARDMANAGER *LCS_Server_GetCardManager(const LCS_SERVER *cs);
00194 
00195 LCSV_SERVICEMANAGER *LCS_Server_GetServiceManager(const LCS_SERVER *cs);
00196 
00197 LCSL_SLAVEMANAGER *LCS_Server_GetSlaveManager(const LCS_SERVER *cs);
00198 
00199 
00200 int LCS_Server_ReplaceVar(const char *path,
00201                           const char *var,
00202                           const char *value,
00203                           GWEN_BUFFER *nbuf);
00204 
00205 
00206 int LCS_Server_SendErrorResponse(LCS_SERVER *cs,
00207                                  GWEN_TYPE_UINT32 rid,
00208                                  int code,
00209                                  const char *text);
00210 
00211 int LCS_Server_CheckIpcResponse(GWEN_DB_NODE *db);
00212 
00213 
00214 LCS_SERVER_ROLE LCS_Server_GetRole(const LCS_SERVER *cs);
00215 
00216 GWEN_NL_SSL_ASKADDCERT_RESULT
00217 LCS_Server_AskAddCert(GWEN_NETLAYER *nl,
00218                       const GWEN_SSLCERTDESCR *cert,
00219                       void *user_data);
00220 
00221 
00222 void LCS_Server_DumpState(const LCS_SERVER *cs);
00223 
00224 int LCS_Server_GetClientCount(LCS_SERVER *cs);
00225 
00226 void LCS_Server_TriggerHwScan(LCS_SERVER *cs);
00227 
00228 
00229 #endif /* CHIPCARD_SERVER2_SERVER_L_H */
00230 
00231 
00232 

Generated on Sat Sep 22 04:43:21 2007 for libchipcard2 by  doxygen 1.5.3