ShopServer.h 1.9 KB

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