AnmeldungServer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. SSLServer *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. public:
  29. // Konstruktor
  30. AnmeldungServer( InitDatei *zIni );
  31. // Destruktor
  32. virtual ~AnmeldungServer();
  33. // nicht constant
  34. void runn();
  35. void thread();
  36. void close();
  37. bool serverStarten();
  38. bool serverPause();
  39. bool serverFortsetzen();
  40. bool serverBeenden();
  41. bool setMaxKlients( int mc );
  42. bool absturzKlient( int klientId );
  43. bool removeKlient( ASKlient *zKlient );
  44. void addGesendet( int bytes );
  45. void addEmpfangen( int bytes );
  46. // conatant
  47. bool istAn() const;
  48. Server *zServer() const;
  49. ASDatenbank *zDB() const;
  50. bool hatClients() const;
  51. int getId() const;
  52. char *getLetzterFehler() const;
  53. char *getIp() const;
  54. };
  55. class ASAKlient : public Thread
  56. {
  57. private:
  58. SSLSKlient *klient;
  59. Text *name;
  60. Text *passwort;
  61. int adminId;
  62. AnmeldungServer *as;
  63. int version;
  64. public:
  65. // Konstruktor
  66. ASAKlient( SSLSKlient *klient, AnmeldungServer *as );
  67. // Destruktor
  68. virtual ~ASAKlient();
  69. // nicht constant
  70. void thread();
  71. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  72. };
  73. class ASKlient : public Thread
  74. {
  75. private:
  76. SKlient *klient;
  77. unsigned int klientNummer;
  78. AnmeldungServer *as;
  79. int accountId;
  80. public:
  81. // Konstruktor
  82. ASKlient( SKlient *klient, AnmeldungServer *as );
  83. // Destruktor
  84. virtual ~ASKlient();
  85. // nicht constant
  86. void absturz();
  87. virtual void thread();
  88. // constant
  89. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  90. int getKlientNummer() const;
  91. };
  92. class MsgWeiterleitung : public virtual ReferenceCounter
  93. {
  94. private:
  95. AnmeldungServer *as;
  96. int accountId;
  97. Text *fehler;
  98. public:
  99. // Konstruktor
  100. MsgWeiterleitung( int accountId, AnmeldungServer *as );
  101. // Destruktor
  102. virtual ~MsgWeiterleitung();
  103. // nicht constant
  104. bool spielerBetrittGruppe( int gruppeId );
  105. bool spielerLeavesGruppe( int gruppeId );
  106. bool setGruppeAdmin( int gruppeId, int admin );
  107. bool kickSpielerAusGruppe( int accountId, int gruppeId );
  108. bool gruppenNachricht( int gruppeId, char *txt );
  109. bool gruppeAngemeldet( int gruppeId );
  110. bool gruppeAbgemeldet( int gruppeId );
  111. bool gruppeSpielStarten( int gruppeId, bool starten );
  112. bool spielEinladung( int gruppeId, int accountId );
  113. bool spielEinladungAbbrechen( int gruppeId, int accountId );
  114. bool spielEinladungAblehnen( int gruppeId );
  115. // constant
  116. int getAccountId() const;
  117. Text *getLetzterFehler() const;
  118. Text *zLetzterFehler() const;
  119. };
  120. #endif