RegisterServer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 klientAnzahl;
  23. int id;
  24. bool nichtPausiert;
  25. int empfangen;
  26. int gesendet;
  27. bool update;
  28. bool end;
  29. public:
  30. // Konstruktor
  31. RegisterServer( InitDatei *zIni );
  32. // Destruktor
  33. virtual ~RegisterServer();
  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 setMaxKlients( int mc );
  43. bool absturzKlient( int klientId );
  44. bool removeKlient( RSKlient *zKlient );
  45. void addGesendet( int bytes );
  46. void addEmpfangen( int bytes );
  47. // conatant
  48. bool istAn() const;
  49. Server *zServer() const;
  50. RSDatenbank *zDB() const;
  51. bool hatClients() const;
  52. int getId() const;
  53. char *getLetzterFehler() const;
  54. InitDatei *zIni() const;
  55. };
  56. class RSAKlient : public Thread
  57. {
  58. private:
  59. SSLSKlient *klient;
  60. Text *name;
  61. Text *passwort;
  62. int adminId;
  63. RegisterServer *rs;
  64. int version;
  65. public:
  66. // Konstruktor
  67. RSAKlient( SSLSKlient *klient, RegisterServer *rs );
  68. // Destruktor
  69. virtual ~RSAKlient();
  70. // nicht constant
  71. void thread();
  72. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  73. };
  74. class RSKlient : public Thread
  75. {
  76. private:
  77. SKlient *klient;
  78. unsigned int klientNummer;
  79. RegisterServer *rs;
  80. public:
  81. // Konstruktor
  82. RSKlient( SKlient *klient, RegisterServer *rs );
  83. // Destruktor
  84. virtual ~RSKlient();
  85. // nicht constant
  86. void absturz();
  87. void thread();
  88. // constant
  89. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  90. int getKlientNummer() const;
  91. };
  92. #endif