PatchServer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef PatchServer_H
  2. #define PatchServer_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 PSKlient;
  12. class PatchServer : public Thread
  13. {
  14. private:
  15. Server* server;
  16. SSLServer* aServer;
  17. InitDatei* ini;
  18. PSDatenbank* db;
  19. CRITICAL_SECTION cs;
  20. RCArray< PSKlient >* klients;
  21. Text* fehler;
  22. int id;
  23. bool nichtPausiert;
  24. int empfangen;
  25. int gesendet;
  26. int updateAnzahl;
  27. Array< int >* updateGruppe;
  28. bool end;
  29. public:
  30. // Konstruktor
  31. PatchServer(InitDatei* zIni);
  32. // Destruktor
  33. virtual ~PatchServer();
  34. // nicht constant
  35. void runn();
  36. void thread();
  37. void close();
  38. bool serverStarten();
  39. bool serverPause();
  40. bool serverFortsetzen();
  41. bool serverBeenden();
  42. bool setMaxKlients(int mc);
  43. bool absturzKlient(int klientId);
  44. bool removeKlient(PSKlient* zKlient);
  45. void addGesendet(int bytes);
  46. void addEmpfangen(int bytes);
  47. bool beginnUpdate(int gruppe);
  48. void endUpdate(int gruppe);
  49. void updateAbbruch(int gruppe);
  50. // conatant
  51. bool istAn() const;
  52. Server* zServer() const;
  53. PSDatenbank* zDB() const;
  54. bool hatClients() const;
  55. int getId() const;
  56. const char* getLetzterFehler() const;
  57. bool proveVersion(int gruppe) const;
  58. bool proveVersion() const;
  59. };
  60. class PSAKlient : public Thread
  61. {
  62. private:
  63. SSLSKlient* klient;
  64. Text* name;
  65. Text* passwort;
  66. int adminId;
  67. PatchServer* ps;
  68. int updateGruppe;
  69. Text* gruppeN;
  70. InitDatei* ini;
  71. public:
  72. // Konstruktor
  73. PSAKlient(SSLSKlient* klient, PatchServer* ps, InitDatei* ini);
  74. // Destruktor
  75. virtual ~PSAKlient();
  76. // nicht constant
  77. void thread();
  78. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum AKlient
  79. };
  80. class PSKlient : public Thread
  81. {
  82. private:
  83. SKlient* klient;
  84. unsigned int klientNummer;
  85. char system;
  86. PatchServer* ps;
  87. InitDatei* ini;
  88. bool encrypted;
  89. public:
  90. // Konstruktor
  91. PSKlient(SKlient* klient, PatchServer* ps, InitDatei* ini);
  92. // Destruktor
  93. virtual ~PSKlient();
  94. // nicht constant
  95. void absturz();
  96. void thread();
  97. // constant
  98. bool errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum Klient
  99. int getKlientNummer() const; // gibt die KlientId zurück
  100. };
  101. #endif