AppServer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef AppServer_H
  2. #define AppServer_H
  3. #include <Server.h>
  4. #include <Thread.h>
  5. #include <InitDatei.h>
  6. #include <Zeit.h>
  7. #include "Datenbank.h"
  8. using namespace Framework;
  9. using namespace Network;
  10. class AppSKTimeOut;
  11. class AppServer : public Thread
  12. {
  13. private:
  14. Server *server;
  15. Server *aServer;
  16. InitDatei *dat;
  17. AppSDatenbank *db;
  18. CRITICAL_SECTION cs;
  19. int empfangen;
  20. int gesendet;
  21. int clients;
  22. bool end;
  23. int ref;
  24. public:
  25. // Konstruktor
  26. AppServer( InitDatei *zDat );
  27. // Destruktor
  28. virtual ~AppServer();
  29. // nicht constant
  30. void runn();
  31. void thread();
  32. void close();
  33. bool serverStarten();
  34. void serverBeenden();
  35. void addGesendet( int bytes );
  36. void addEmpfangen( int bytes );
  37. void clientTrennung();
  38. // constant
  39. InitDatei *zIni() const;
  40. Server *zServer() const;
  41. AppSDatenbank *zDB() const;
  42. int getClients() const;
  43. bool hatClients() const;
  44. // Reference Counting
  45. AppServer *getThis();
  46. AppServer *release();
  47. };
  48. class AppSAKlient : public Thread
  49. {
  50. private:
  51. SKlient *klient;
  52. Text *name;
  53. Text *passwort;
  54. int adminId;
  55. AppServer *appS;
  56. public:
  57. // Konstruktor
  58. AppSAKlient( SKlient *klient, AppServer *appS );
  59. // Destruktor
  60. virtual ~AppSAKlient();
  61. // nicht constant
  62. void thread();
  63. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  64. };
  65. class AppSKlient : public Thread
  66. {
  67. private:
  68. SKlient *klient;
  69. AppServer *appS;
  70. int accountId;
  71. AppSKTimeOut *tmo;
  72. public:
  73. // Konstruktor
  74. AppSKlient( SKlient *klient, AppServer *appS );
  75. // Destruktor
  76. virtual ~AppSKlient();
  77. // nicht constant
  78. void thread() override;
  79. void timeout();
  80. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  81. };
  82. class AppSKTimeOut : public Thread
  83. {
  84. private:
  85. __int64 lastConnect;
  86. AppSKlient *zKlient;
  87. ZeitMesser *zm;
  88. bool st;
  89. public:
  90. // Konstruktor
  91. AppSKTimeOut( AppSKlient *zK );
  92. // Destruktor
  93. virtual ~AppSKTimeOut();
  94. // nicht constant
  95. void thread() override;
  96. void stop();
  97. void addConnect();
  98. };
  99. #endif