EditorServer.h 2.1 KB

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