HistorieServer.h 2.2 KB

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