ErhaltungServer.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. #ifndef ErhaltungServer_H
  2. #define ErhaltungServer_H
  3. #include <Server.h>
  4. #include <Thread.h>
  5. #include <Datei.h>
  6. #include <Text.h>
  7. #include <InitDatei.h>
  8. #include <Zeit.h>
  9. #ifdef WIN32
  10. #include "..\Datenbank\Datenbank.h"
  11. #else
  12. #include "Datenbank.h"
  13. #endif
  14. using namespace Network;
  15. class ErhaltungServer : public Thread
  16. {
  17. private:
  18. Server *server;
  19. Server *aServer;
  20. InitDatei *ini;
  21. ESDatenbank *db;
  22. Text *fehler;
  23. int clients;
  24. int id;
  25. bool nichtPausiert;
  26. int empfangen;
  27. int gesendet;
  28. bool end;
  29. int ref;
  30. public:
  31. // Konstruktor
  32. ErhaltungServer( InitDatei *zIni );
  33. // Destruktor
  34. virtual ~ErhaltungServer();
  35. // nicht constant
  36. void runn();
  37. void thread();
  38. void close();
  39. bool serverStarten();
  40. bool serverPause();
  41. bool serverFortsetzen();
  42. bool serverBeenden();
  43. bool setMaxKlients( unsigned char mc );
  44. void addGesendet( int bytes );
  45. void addEmpfangen( int bytes );
  46. void clientTrennung();
  47. // constant
  48. bool istAn() const;
  49. Server *zServer() const;
  50. ESDatenbank *zDB() const;
  51. bool hatClients() const;
  52. int getId() const;
  53. char *getLetzterFehler() const;
  54. // Reference Counting
  55. ErhaltungServer *getThis();
  56. ErhaltungServer *release();
  57. };
  58. class ESAKlient : public Thread
  59. {
  60. private:
  61. SKlient *klient;
  62. Text *name;
  63. Text *passwort;
  64. int adminId;
  65. ErhaltungServer *es;
  66. int version;
  67. public:
  68. // Konstruktor
  69. ESAKlient( SKlient *klient, ErhaltungServer *es );
  70. // Destruktor
  71. virtual ~ESAKlient();
  72. // nicht constant
  73. void thread();
  74. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  75. };
  76. class ESKlient;
  77. class ESKThread : public Thread
  78. {
  79. private:
  80. ESKlient *zKlient;
  81. int ref;
  82. public:
  83. // Konstruktor
  84. ESKThread( ESKlient *zKlient );
  85. // Destruktor
  86. virtual ~ESKThread();
  87. // nicht constant
  88. virtual void thread();
  89. // constant
  90. // Reference Counting
  91. ESKThread *getThis();
  92. ESKThread *release();
  93. };
  94. class ESKlient : public Thread
  95. {
  96. private:
  97. ESKThread *th;
  98. SKlient *klient;
  99. ZeitMesser *zeit;
  100. double sekunden;
  101. double letzteErhaltung;
  102. bool abgemeldet;
  103. unsigned int klientNummer;
  104. ErhaltungServer *es;
  105. bool encrypted;
  106. public:
  107. // Konstruktor
  108. ESKlient( SKlient *klient, ErhaltungServer *es );
  109. // Destruktor
  110. virtual ~ESKlient();
  111. // nicht constant
  112. bool erhalten();
  113. virtual void thread();
  114. // constant
  115. void errorZuKlient( const char *nachricht ) const;
  116. };
  117. class ESGWeiterleitung
  118. {
  119. private:
  120. ErhaltungServer *es;
  121. int ref;
  122. public:
  123. // Konstruktor
  124. ESGWeiterleitung( ErhaltungServer *es );
  125. // Destruktor
  126. ~ESGWeiterleitung();
  127. // nicht constant
  128. bool patchServerKlientAbsturz( int klientId );
  129. bool registerServerKlientAbsturz( int klientId );
  130. bool loginServerKlientAbsturz( int klientId );
  131. bool informationServerKlientAbsturz( int klientId );
  132. bool chatServerKlientAbsturz( int klientId );
  133. bool anmeldungServerKlientAbsturz( int klientId );
  134. bool spielServerKlientAbsturz( int klientId );
  135. bool shopServerKlientAbsturz( int klientId );
  136. bool historieServerKlientAbsturz( int klientId );
  137. bool newsServerKlientAbsturz( int klientId );
  138. bool kartenServerKlientAbsturz( int klientId );
  139. bool editorServerKlientAbsturz( int klientId );
  140. bool spielErstelltAbbrechen( int spielErstelltId );
  141. bool spielerLeavesGruppe( int gruppeId, int accountId );
  142. bool setGruppeAdmin( int gruppeId, int adminId );
  143. bool spielerLeavesChatroom( int chatroomId, int accountId );
  144. bool setChatroomAdmin( int chatroomId, int adminId );
  145. bool kickSpielerAusGruppe( int gruppeId );
  146. // constant
  147. // Reference Counting
  148. ESGWeiterleitung *getThis();
  149. ESGWeiterleitung *release();
  150. };
  151. #endif