PatchServer.h 2.4 KB

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