AnmeldungServer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef AnmeldungServer_H
  2. #define AnmeldungServer_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. using namespace Framework;
  10. using namespace Network;
  11. class ASKlient;
  12. class AnmeldungServer : public Thread
  13. {
  14. private:
  15. Server *server;
  16. Server *aServer;
  17. InitDatei *ini;
  18. ASDatenbank *db;
  19. CRITICAL_SECTION cs;
  20. RCArray< ASKlient > *klients;
  21. Text *fehler;
  22. int klientAnzahl;
  23. int id;
  24. bool nichtPausiert;
  25. int empfangen;
  26. int gesendet;
  27. bool end;
  28. int ref;
  29. public:
  30. // Konstruktor
  31. AnmeldungServer( InitDatei *zIni );
  32. // Destruktor
  33. virtual ~AnmeldungServer();
  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 setMaxKlients( int mc );
  43. bool absturzKlient( int klientId );
  44. bool removeKlient( ASKlient *zKlient );
  45. void addGesendet( int bytes );
  46. void addEmpfangen( int bytes );
  47. // conatant
  48. bool istAn() const;
  49. Server *zServer() const;
  50. ASDatenbank *zDB() const;
  51. bool hatClients() const;
  52. int getId() const;
  53. char *getLetzterFehler() const;
  54. char *getIp() const;
  55. // Reference Counting
  56. AnmeldungServer *getThis();
  57. AnmeldungServer *release();
  58. };
  59. class ASAKlient : public Thread
  60. {
  61. private:
  62. SKlient *klient;
  63. Text *name;
  64. Text *passwort;
  65. int adminId;
  66. AnmeldungServer *as;
  67. int version;
  68. public:
  69. // Konstruktor
  70. ASAKlient( SKlient *klient, AnmeldungServer *as );
  71. // Destruktor
  72. virtual ~ASAKlient();
  73. // nicht constant
  74. void thread();
  75. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  76. };
  77. class ASKlient : public Thread
  78. {
  79. private:
  80. SKlient *klient;
  81. unsigned int klientNummer;
  82. AnmeldungServer *as;
  83. int accountId;
  84. int ref;
  85. public:
  86. // Konstruktor
  87. ASKlient( SKlient *klient, AnmeldungServer *as );
  88. // Destruktor
  89. virtual ~ASKlient();
  90. // nicht constant
  91. void absturz();
  92. virtual void thread();
  93. // constant
  94. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  95. int getKlientNummer() const;
  96. // Reference Counting
  97. ASKlient *getThis();
  98. ASKlient *release();
  99. };
  100. class MsgWeiterleitung
  101. {
  102. private:
  103. AnmeldungServer *as;
  104. int accountId;
  105. int ref;
  106. Text *fehler;
  107. public:
  108. // Konstruktor
  109. MsgWeiterleitung( int accountId, AnmeldungServer *as );
  110. // Destruktor
  111. virtual ~MsgWeiterleitung();
  112. // nicht constant
  113. bool spielerBetrittGruppe( int gruppeId );
  114. bool spielerLeavesGruppe( int gruppeId );
  115. bool setGruppeAdmin( int gruppeId, int admin );
  116. bool kickSpielerAusGruppe( int accountId, int gruppeId );
  117. bool gruppenNachricht( int gruppeId, char *txt );
  118. bool gruppeAngemeldet( int gruppeId );
  119. bool gruppeAbgemeldet( int gruppeId );
  120. bool gruppeSpielStarten( int gruppeId, bool starten );
  121. bool spielEinladung( int gruppeId, int accountId );
  122. bool spielEinladungAbbrechen( int gruppeId, int accountId );
  123. bool spielEinladungAblehnen( int gruppeId );
  124. // constant
  125. int getAccountId() const;
  126. Text *getLetzterFehler() const;
  127. Text *zLetzterFehler() const;
  128. // Reference Counting
  129. MsgWeiterleitung *getThis();
  130. MsgWeiterleitung *release();
  131. };
  132. #endif