RegisterServer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. Server *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. int ref;
  30. public:
  31. // Konstruktor
  32. RegisterServer( InitDatei *zIni );
  33. // Destruktor
  34. virtual ~RegisterServer();
  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 setMaxKlients( int mc );
  44. bool absturzKlient( int klientId );
  45. bool removeKlient( RSKlient *zKlient );
  46. void addGesendet( int bytes );
  47. void addEmpfangen( int bytes );
  48. // conatant
  49. bool istAn() const;
  50. Server *zServer() const;
  51. RSDatenbank *zDB() const;
  52. bool hatClients() const;
  53. int getId() const;
  54. char *getLetzterFehler() const;
  55. InitDatei *zIni() const;
  56. // Reference Counting
  57. RegisterServer *getThis();
  58. RegisterServer *release();
  59. };
  60. class RSAKlient : public Thread
  61. {
  62. private:
  63. SKlient *klient;
  64. Text *name;
  65. Text *passwort;
  66. int adminId;
  67. RegisterServer *rs;
  68. int version;
  69. public:
  70. // Konstruktor
  71. RSAKlient( SKlient *klient, RegisterServer *rs );
  72. // Destruktor
  73. virtual ~RSAKlient();
  74. // nicht constant
  75. void thread();
  76. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  77. };
  78. class RSKlient : public Thread
  79. {
  80. private:
  81. SKlient *klient;
  82. unsigned int klientNummer;
  83. RegisterServer *rs;
  84. int ref;
  85. public:
  86. // Konstruktor
  87. RSKlient( SKlient *klient, RegisterServer *rs );
  88. // Destruktor
  89. virtual ~RSKlient();
  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. RSKlient *getThis();
  98. RSKlient *release();
  99. };
  100. #endif