MainServer.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef MainServer_H
  2. #define MainServer_H
  3. #include <Server.h>
  4. #include <Thread.h>
  5. #include <InitDatei.h>
  6. #include "Datenbank.h"
  7. using namespace Framework;
  8. using namespace Network;
  9. class MainServer : public Thread
  10. {
  11. private:
  12. Server *server;
  13. Server *aServer;
  14. InitDatei *dat;
  15. MSDatenbank *db;
  16. CRITICAL_SECTION cs;
  17. int empfangen;
  18. int gesendet;
  19. int clients;
  20. bool end;
  21. int ref;
  22. public:
  23. // Konstruktor
  24. MainServer( InitDatei *zDat );
  25. // Destruktor
  26. virtual ~MainServer();
  27. // nicht constant
  28. void runn();
  29. void thread();
  30. void close();
  31. bool serverStarten();
  32. void serverBeenden();
  33. void addGesendet( int bytes );
  34. void addEmpfangen( int bytes );
  35. void clientTrennung();
  36. // constant
  37. Server *zServer() const;
  38. MSDatenbank *zDB() const;
  39. bool hatClients() const;
  40. // Reference Counting
  41. MainServer *getThis();
  42. MainServer *release();
  43. };
  44. class MSAKlient : public Thread
  45. {
  46. private:
  47. SKlient *klient;
  48. Text *name;
  49. Text *passwort;
  50. int adminId;
  51. MainServer *ms;
  52. public:
  53. // Konstruktor
  54. MSAKlient( SKlient *klient, MainServer *ms );
  55. // Destruktor
  56. virtual ~MSAKlient();
  57. // nicht constant
  58. void thread();
  59. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  60. };
  61. class MSKlient : public Thread
  62. {
  63. private:
  64. SKlient *klient;
  65. unsigned int klientNummer;
  66. MainServer *ms;
  67. bool encrypted;
  68. public:
  69. // Konstruktor
  70. MSKlient( SKlient *klient, MainServer *ms );
  71. // Destruktor
  72. virtual ~MSKlient();
  73. // nicht constant
  74. void thread();
  75. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  76. };
  77. class MSGWeiterleitung
  78. {
  79. private:
  80. MainServer *ms;
  81. int ref;
  82. public:
  83. // Konstruktor
  84. MSGWeiterleitung( MainServer *ms );
  85. // Destruktor
  86. ~MSGWeiterleitung();
  87. // nicht constant
  88. bool patchServerKlientAbsturz( int klientId );
  89. bool registerServerKlientAbsturz( int klientId );
  90. bool loginServerKlientAbsturz( int klientId );
  91. bool informationServerKlientAbsturz( int klientId );
  92. bool chatServerKlientAbsturz( int klientId );
  93. bool anmeldungServerKlientAbsturz( int klientId );
  94. bool spielServerKlientAbsturz( int klientId );
  95. bool shopServerKlientAbsturz( int klientId );
  96. bool newsServerKlientAbsturz( int klientId );
  97. bool historieServerKlientAbsturz( int klientId );
  98. bool kartenServerKlientAbsturz( int klientId );
  99. bool editorServerKlientAbsturz( int klientId );
  100. bool spielErstelltAbbrechen( int spielErstelltId );
  101. bool spielerLeavesGruppe( int gruppeId, int accountId );
  102. bool setGruppeAdmin( int gruppeId, int adminId );
  103. bool spielerLeavesChatroom( int chatroomId, int accountId );
  104. bool setChatroomAdmin( int chatroomId, int adminId );
  105. bool kickSpielerAusGruppe( int gruppeId );
  106. // constant
  107. // Reference Counting
  108. MSGWeiterleitung *getThis();
  109. MSGWeiterleitung *release();
  110. };
  111. #endif