RegisterServer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef RegisterServer_H
  2. #define RegisterServer_H
  3. #include "Datenbank.h"
  4. #include <Server.h>
  5. #include <Thread.h>
  6. #include <Datei.h>
  7. #include <Text.h>
  8. #include <InitDatei.h>
  9. using namespace Framework;
  10. using namespace Network;
  11. class RSKlient;
  12. class RegisterServer : public Thread
  13. {
  14. private:
  15. Server* server;
  16. SSLServer* aServer;
  17. InitDatei* ini;
  18. RSDatenbank* db;
  19. CRITICAL_SECTION cs;
  20. RCArray< RSKlient >* klients;
  21. Text* fehler;
  22. int id;
  23. bool nichtPausiert;
  24. int empfangen;
  25. int gesendet;
  26. bool update;
  27. bool end;
  28. public:
  29. // Konstruktor
  30. RegisterServer(InitDatei* zIni);
  31. // Destruktor
  32. virtual ~RegisterServer();
  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 setMaxKlients(int mc);
  42. bool absturzKlient(int klientId);
  43. bool removeKlient(RSKlient* zKlient);
  44. void addGesendet(int bytes);
  45. void addEmpfangen(int bytes);
  46. // conatant
  47. bool istAn() const;
  48. Server* zServer() const;
  49. RSDatenbank* zDB() const;
  50. bool hatClients() const;
  51. int getId() const;
  52. const char* getLetzterFehler() const;
  53. InitDatei* zIni() const;
  54. };
  55. class RSAKlient : public Thread
  56. {
  57. private:
  58. SSLSKlient* klient;
  59. Text* name;
  60. Text* passwort;
  61. int adminId;
  62. RegisterServer* rs;
  63. int version;
  64. public:
  65. // Konstruktor
  66. RSAKlient(SSLSKlient* klient, RegisterServer* rs);
  67. // Destruktor
  68. virtual ~RSAKlient();
  69. // nicht constant
  70. void thread();
  71. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum AKlient
  72. };
  73. class RSKlient : public Thread
  74. {
  75. private:
  76. SKlient* klient;
  77. unsigned int klientNummer;
  78. RegisterServer* rs;
  79. public:
  80. // Konstruktor
  81. RSKlient(SKlient* klient, RegisterServer* rs);
  82. // Destruktor
  83. virtual ~RSKlient();
  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