HistorieServer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. Server *aServer;
  17. InitDatei *ini;
  18. HSDatenbank *db;
  19. CRITICAL_SECTION cs;
  20. RCArray< HSKlient > *klients;
  21. Text *fehler;
  22. int klientAnzahl;
  23. int id;
  24. bool nichtPausiert;
  25. int empfangen;
  26. int gesendet;
  27. bool end;
  28. int ref;
  29. public:
  30. // Konstruktor
  31. HistorieServer( InitDatei *zIni );
  32. // Destruktor
  33. virtual ~HistorieServer();
  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 setMaxSpiele( int ms );
  44. bool absturzKlient( int klientId );
  45. bool removeKlient( HSKlient *zKlient );
  46. void addGesendet( int bytes );
  47. void addEmpfangen( int bytes );
  48. // conatant
  49. bool istAn() const;
  50. Server *zServer() const;
  51. HSDatenbank *zDB() const;
  52. bool hatClients() const;
  53. int getId() const;
  54. char *getLetzterFehler() const;
  55. InitDatei *zIni() const;
  56. // Reference Counting
  57. HistorieServer *getThis();
  58. HistorieServer *release();
  59. };
  60. class HSAKlient : public Thread
  61. {
  62. private:
  63. SKlient *klient;
  64. Text *name;
  65. Text *passwort;
  66. int adminId;
  67. HistorieServer *hs;
  68. int version;
  69. public:
  70. // Konstruktor
  71. HSAKlient( SKlient *klient, HistorieServer *hs );
  72. // Destruktor
  73. virtual ~HSAKlient();
  74. // nicht constant
  75. void thread();
  76. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  77. };
  78. class HSKlient : public Thread
  79. {
  80. private:
  81. SKlient *klient;
  82. unsigned int klientNummer;
  83. HistorieServer *hs;
  84. int ref;
  85. // privat
  86. void sendeVerzeichnis( char *pfad, int gpl );
  87. public:
  88. // Konstruktor
  89. HSKlient( SKlient *klient, HistorieServer *hs );
  90. // Destruktor
  91. virtual ~HSKlient();
  92. // nicht constant
  93. void absturz();
  94. void thread();
  95. // constant
  96. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  97. int getKlientNummer() const;
  98. // Reference Counting
  99. HSKlient *getThis();
  100. HSKlient *release();
  101. };
  102. #endif