AnmeldungServer.h 2.8 KB

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