MainServer.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. SSLServer *aServer;
  14. SSLServer *serverSSL;
  15. InitDatei *dat;
  16. MSDatenbank *db;
  17. CRITICAL_SECTION cs;
  18. int empfangen;
  19. int gesendet;
  20. int clients;
  21. bool end;
  22. int ref;
  23. public:
  24. // Konstruktor
  25. MainServer( InitDatei *zDat );
  26. // Destruktor
  27. virtual ~MainServer();
  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. Server *zServer() const;
  39. MSDatenbank *zDB() const;
  40. bool hatClients() const;
  41. InitDatei *zInit() const;
  42. // Reference Counting
  43. MainServer *getThis();
  44. MainServer *release();
  45. };
  46. class MSAKlient : public Thread
  47. {
  48. private:
  49. SSLSKlient *klient;
  50. Text *name;
  51. Text *passwort;
  52. int adminId;
  53. MainServer *ms;
  54. public:
  55. // Konstruktor
  56. MSAKlient( SSLSKlient *klient, MainServer *ms );
  57. // Destruktor
  58. virtual ~MSAKlient();
  59. // nicht constant
  60. void thread();
  61. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  62. };
  63. class MSKlient : public Thread
  64. {
  65. private:
  66. SKlient *klient;
  67. unsigned int klientNummer;
  68. MainServer *ms;
  69. bool encrypted;
  70. public:
  71. // Konstruktor
  72. MSKlient( SKlient *klient, MainServer *ms );
  73. // Destruktor
  74. virtual ~MSKlient();
  75. // nicht constant
  76. void thread();
  77. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  78. };
  79. class MSKlientSSL : public Thread
  80. {
  81. private:
  82. SSLSKlient * klient;
  83. unsigned int klientNummer;
  84. MainServer *ms;
  85. public:
  86. // Konstruktor
  87. MSKlientSSL( SSLSKlient *klient, MainServer *ms );
  88. // Destruktor
  89. virtual ~MSKlientSSL();
  90. // nicht constant
  91. void thread();
  92. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  93. };
  94. class MSGWeiterleitung
  95. {
  96. private:
  97. MainServer *ms;
  98. int ref;
  99. public:
  100. // Konstruktor
  101. MSGWeiterleitung( MainServer *ms );
  102. // Destruktor
  103. ~MSGWeiterleitung();
  104. // nicht constant
  105. bool patchServerKlientAbsturz( int klientId );
  106. bool registerServerKlientAbsturz( int klientId );
  107. bool loginServerKlientAbsturz( int klientId );
  108. bool informationServerKlientAbsturz( int klientId );
  109. bool chatServerKlientAbsturz( int klientId );
  110. bool anmeldungServerKlientAbsturz( int klientId );
  111. bool spielServerKlientAbsturz( int klientId );
  112. bool shopServerKlientAbsturz( int klientId );
  113. bool newsServerKlientAbsturz( int klientId );
  114. bool historieServerKlientAbsturz( int klientId );
  115. bool kartenServerKlientAbsturz( int klientId );
  116. bool editorServerKlientAbsturz( int klientId );
  117. bool minigameServerKlientAbsturz( int klientId );
  118. bool spielErstelltAbbrechen( int spielErstelltId );
  119. bool spielerLeavesGruppe( int gruppeId, int accountId );
  120. bool setGruppeAdmin( int gruppeId, int adminId );
  121. bool spielerLeavesChatroom( int chatroomId, int accountId );
  122. bool setChatroomAdmin( int chatroomId, int adminId );
  123. bool kickSpielerAusGruppe( int gruppeId );
  124. // constant
  125. // Reference Counting
  126. MSGWeiterleitung *getThis();
  127. MSGWeiterleitung *release();
  128. };
  129. #endif