KartenServer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef KartenServer_H
  2. #define KartenServer_H
  3. #include <Server.h>
  4. #include <Thread.h>
  5. #include <Datei.h>
  6. #include <Text.h>
  7. #include <InitDatei.h>
  8. #include "Datenbank.h"
  9. #include "Updater.h"
  10. using namespace Framework;
  11. using namespace Network;
  12. class KSKlient;
  13. class KartenServer : public Thread
  14. {
  15. private:
  16. Server *server;
  17. SSLServer *aServer;
  18. InitDatei *ini;
  19. KSDatenbank *db;
  20. CRITICAL_SECTION cs;
  21. RCArray< KSKlient > *klients;
  22. Text *fehler;
  23. Updater *updater;
  24. int updateKarte;
  25. int id;
  26. bool nichtPausiert;
  27. int empfangen;
  28. int gesendet;
  29. bool end;
  30. public:
  31. // Konstruktor
  32. KartenServer( InitDatei *zIni );
  33. // Destruktor
  34. virtual ~KartenServer();
  35. // nicht constant
  36. void runn();
  37. void thread();
  38. void close();
  39. bool serverStarten();
  40. bool serverPause();
  41. bool serverFortsetzen();
  42. bool serverBeenden();
  43. bool setMaxKarten( int mk );
  44. bool absturzKlient( int klientId );
  45. bool removeKlient( KSKlient *zKlient );
  46. void addGesendet( int bytes );
  47. void addEmpfangen( int bytes );
  48. void karteUpdateStart( int karteId );
  49. void karteUpdateEnde();
  50. // conatant
  51. bool istAn() const;
  52. Server *zServer() const;
  53. KSDatenbank *zDB() const;
  54. InitDatei *zIni() const;
  55. bool hatClients() const;
  56. int getId() const;
  57. char *getLetzterFehler() const;
  58. bool wirdKarteGeupdatet( int id ) const;
  59. };
  60. class KSAKlient : public Thread
  61. {
  62. private:
  63. SSLSKlient *klient;
  64. Text *name;
  65. Text *passwort;
  66. int adminId;
  67. KartenServer *ks;
  68. public:
  69. // Konstruktor
  70. KSAKlient( SSLSKlient *klient, KartenServer *ks );
  71. // Destruktor
  72. virtual ~KSAKlient();
  73. // nicht constant
  74. void thread();
  75. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  76. };
  77. class KSKlient : public Thread
  78. {
  79. private:
  80. SKlient *klient;
  81. unsigned int klientNummer;
  82. KartenServer *ks;
  83. void suchDateien( const char *pf, RCArray< Text > *zDL, const char *rem );
  84. public:
  85. // Konstruktor
  86. KSKlient( SKlient *klient, KartenServer *ks );
  87. // Destruktor
  88. virtual ~KSKlient();
  89. // nicht constant
  90. void absturz();
  91. void thread();
  92. // constant
  93. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  94. int getKlientNummer() const;
  95. };
  96. #endif