HistorieServer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef HistorieServer_H
  2. #define HistorieServer_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. using namespace Framework;
  10. using namespace Network;
  11. class HSKlient;
  12. class HistorieServer : public Thread
  13. {
  14. private:
  15. Server* server;
  16. SSLServer* aServer;
  17. InitDatei* ini;
  18. HSDatenbank* db;
  19. CRITICAL_SECTION cs;
  20. RCArray< HSKlient >* klients;
  21. Text* fehler;
  22. int id;
  23. bool nichtPausiert;
  24. int empfangen;
  25. int gesendet;
  26. bool end;
  27. public:
  28. // Konstruktor
  29. HistorieServer(InitDatei* zIni);
  30. // Destruktor
  31. virtual ~HistorieServer();
  32. // nicht constant
  33. void runn();
  34. void thread();
  35. void close();
  36. bool serverStarten();
  37. bool serverPause();
  38. bool serverFortsetzen();
  39. bool serverBeenden();
  40. bool setMaxSpiele(int ms);
  41. bool absturzKlient(int klientId);
  42. bool removeKlient(HSKlient* zKlient);
  43. void addGesendet(int bytes);
  44. void addEmpfangen(int bytes);
  45. // conatant
  46. bool istAn() const;
  47. Server* zServer() const;
  48. HSDatenbank* zDB() const;
  49. bool hatClients() const;
  50. int getId() const;
  51. const char* getLetzterFehler() const;
  52. InitDatei* zIni() const;
  53. };
  54. class HSAKlient : public Thread
  55. {
  56. private:
  57. SSLSKlient* klient;
  58. Text* name;
  59. Text* passwort;
  60. int adminId;
  61. HistorieServer* hs;
  62. int version;
  63. public:
  64. // Konstruktor
  65. HSAKlient(SSLSKlient* klient, HistorieServer* hs);
  66. // Destruktor
  67. virtual ~HSAKlient();
  68. // nicht constant
  69. void thread();
  70. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum AKlient
  71. };
  72. class HSKlient : public Thread
  73. {
  74. private:
  75. SKlient* klient;
  76. unsigned int klientNummer;
  77. HistorieServer* hs;
  78. // privat
  79. void sendeVerzeichnis(const char* pfad, int gpl);
  80. public:
  81. // Konstruktor
  82. HSKlient(SKlient* klient, HistorieServer* hs);
  83. // Destruktor
  84. virtual ~HSKlient();
  85. // nicht constant
  86. void absturz();
  87. void thread();
  88. // constant
  89. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum Klient
  90. int getKlientNummer() const;
  91. };
  92. #endif