EditorServer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 id;
  24. bool nichtPausiert;
  25. int empfangen;
  26. int gesendet;
  27. bool end;
  28. public:
  29. // Konstruktor
  30. EditorServer( InitDatei *zIni );
  31. // Destruktor
  32. virtual ~EditorServer();
  33. // nicht constant
  34. void runn();
  35. void thread();
  36. void close();
  37. bool serverStarten();
  38. bool serverPause();
  39. bool serverFortsetzen();
  40. bool serverBeenden();
  41. bool setMaxKarten( int mk );
  42. bool absturzKlient( int klientId );
  43. bool removeKlient( EdSKlient *zKlient );
  44. void addGesendet( int bytes );
  45. void addEmpfangen( int bytes );
  46. // conatant
  47. bool istAn() const;
  48. Server *zServer() const;
  49. EdSDatenbank *zDB() const;
  50. InitDatei *zIni() const;
  51. bool hatClients() const;
  52. int getId() const;
  53. char *getLetzterFehler() const;
  54. };
  55. class EdSAKlient : public Thread
  56. {
  57. private:
  58. SSLSKlient *klient;
  59. Text *name;
  60. Text *passwort;
  61. int adminId;
  62. EditorServer *eds;
  63. public:
  64. // Konstruktor
  65. EdSAKlient( SSLSKlient *klient, EditorServer *eds );
  66. // Destruktor
  67. virtual ~EdSAKlient();
  68. // nicht constant
  69. void thread();
  70. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  71. };
  72. class EdSKlient : public Thread
  73. {
  74. private:
  75. SKlient *klient;
  76. unsigned int klientNummer;
  77. EditorServer *eds;
  78. KarteEditor *ked;
  79. public:
  80. // Konstruktor
  81. EdSKlient( SKlient *klient, EditorServer *eds );
  82. // Destruktor
  83. virtual ~EdSKlient();
  84. // nicht constant
  85. void absturz();
  86. void thread();
  87. // constant
  88. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  89. int getKlientNummer() const;
  90. };
  91. #endif