Server.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #pragma once
  2. #include <Server.h>
  3. #include <Thread.h>
  4. #include <Datei.h>
  5. #include <Text.h>
  6. #include <InitDatei.h>
  7. #include "Datenbank.h"
  8. using namespace Framework;
  9. using namespace Network;
  10. class FCKlient;
  11. class FactoryCraftServer : public Thread
  12. {
  13. private:
  14. Server *server;
  15. SSLServer *aServer;
  16. InitDatei *ini;
  17. LSDatenbank *db;
  18. CRITICAL_SECTION cs;
  19. RCArray< FCKlient > *klients;
  20. Text *fehler;
  21. int klientAnzahl;
  22. int id;
  23. bool nichtPausiert;
  24. int empfangen;
  25. int gesendet;
  26. bool end;
  27. public:
  28. // Konstruktor
  29. FactoryCraftServer( InitDatei *zIni );
  30. // Destruktor
  31. virtual ~FactoryCraftServer();
  32. // nicht constant
  33. void runn();
  34. void thread();
  35. void close();
  36. bool serverStarten();
  37. bool serverPause();
  38. bool serverFortsetzen();
  39. bool serverBeenden();
  40. bool setMaxKlients( int mc );
  41. bool absturzKlient( int klientId );
  42. bool removeKlient( FCKlient *zKlient );
  43. void addGesendet( int bytes );
  44. void addEmpfangen( int bytes );
  45. // conatant
  46. bool istAn() const;
  47. Server *zServer() const;
  48. LSDatenbank *zDB() const;
  49. bool hatClients() const;
  50. int getId() const;
  51. char *getLetzterFehler() const;
  52. };
  53. class FCAKlient : public Thread
  54. {
  55. private:
  56. SSLSKlient *klient;
  57. Text *name;
  58. Text *passwort;
  59. int adminId;
  60. FactoryCraftServer *ls;
  61. int version;
  62. public:
  63. // Konstruktor
  64. FCAKlient( SSLSKlient *klient, FactoryCraftServer *ls );
  65. // Destruktor
  66. virtual ~FCAKlient();
  67. // nicht constant
  68. void thread();
  69. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  70. };
  71. class FCKlient : public Thread
  72. {
  73. private:
  74. SKlient *klient;
  75. unsigned int klientNummer;
  76. FactoryCraftServer *ls;
  77. public:
  78. // Konstruktor
  79. FCKlient( SKlient *klient, FactoryCraftServer *ls );
  80. // Destruktor
  81. virtual ~FCKlient();
  82. // nicht constant
  83. void absturz();
  84. void thread();
  85. // constant
  86. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  87. int getKlientNummer() const;
  88. };
  89. class MSGWeiterleitung : public virtual ReferenceCounter
  90. {
  91. private:
  92. FactoryCraftServer *ls;
  93. public:
  94. // Konstruktor
  95. MSGWeiterleitung( FactoryCraftServer *ls );
  96. // Destruktor
  97. ~MSGWeiterleitung();
  98. };