AppServer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. SSLServer *aServer;
  16. InitDatei *dat;
  17. AppSDatenbank *db;
  18. CRITICAL_SECTION cs;
  19. int empfangen;
  20. int gesendet;
  21. int clients;
  22. bool end;
  23. public:
  24. // Konstruktor
  25. AppServer( InitDatei *zDat );
  26. // Destruktor
  27. virtual ~AppServer();
  28. // nicht constant
  29. void runn();
  30. void thread();
  31. void close();
  32. bool serverStarten();
  33. void serverBeenden();
  34. void addGesendet( int bytes );
  35. void addEmpfangen( int bytes );
  36. void clientTrennung();
  37. // constant
  38. InitDatei *zIni() const;
  39. Server *zServer() const;
  40. AppSDatenbank *zDB() const;
  41. int getClients() const;
  42. bool hatClients() const;
  43. };
  44. class AppSAKlient : public Thread
  45. {
  46. private:
  47. SSLSKlient *klient;
  48. Text *name;
  49. Text *passwort;
  50. int adminId;
  51. AppServer *appS;
  52. public:
  53. // Konstruktor
  54. AppSAKlient( SSLSKlient *klient, AppServer *appS );
  55. // Destruktor
  56. virtual ~AppSAKlient();
  57. // nicht constant
  58. void thread();
  59. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  60. };
  61. class AppSKlient : public Thread
  62. {
  63. private:
  64. SKlient *klient;
  65. AppServer *appS;
  66. int accountId;
  67. AppSKTimeOut *tmo;
  68. public:
  69. // Konstruktor
  70. AppSKlient( SKlient *klient, AppServer *appS );
  71. // Destruktor
  72. virtual ~AppSKlient();
  73. // nicht constant
  74. void thread() override;
  75. void timeout();
  76. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  77. };
  78. class AppSKTimeOut : public Thread
  79. {
  80. private:
  81. __int64 lastConnect;
  82. AppSKlient *zKlient;
  83. ZeitMesser *zm;
  84. bool st;
  85. public:
  86. // Konstruktor
  87. AppSKTimeOut( AppSKlient *zK );
  88. // Destruktor
  89. virtual ~AppSKTimeOut();
  90. // nicht constant
  91. void thread() override;
  92. void stop();
  93. void addConnect();
  94. };
  95. #endif