EditorServer.h 2.2 KB

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