LoginServer.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef LoginServer_H
  2. #define LoginServer_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 LSKlient;
  12. class LoginServer : public Thread
  13. {
  14. private:
  15. Server* server;
  16. SSLServer* aServer;
  17. InitDatei* ini;
  18. LSDatenbank* db;
  19. CRITICAL_SECTION cs;
  20. RCArray< LSKlient >* klients;
  21. Text* fehler;
  22. int id;
  23. bool nichtPausiert;
  24. int empfangen;
  25. int gesendet;
  26. bool end;
  27. public:
  28. // Konstruktor
  29. LoginServer(InitDatei* zIni);
  30. // Destruktor
  31. virtual ~LoginServer();
  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(LSKlient* zKlient);
  43. void addGesendet(int bytes);
  44. void addEmpfangen(int bytes);
  45. // conatant
  46. bool istAn() const;
  47. Server* zServer() const;
  48. LSDatenbank* zDB() const;
  49. bool hatClients() const;
  50. int getId() const;
  51. const char* getLetzterFehler() const;
  52. };
  53. class LSAKlient : public Thread
  54. {
  55. private:
  56. SSLSKlient* klient;
  57. Text* name;
  58. Text* passwort;
  59. int adminId;
  60. LoginServer* ls;
  61. int version;
  62. public:
  63. // Konstruktor
  64. LSAKlient(SSLSKlient* klient, LoginServer* ls);
  65. // Destruktor
  66. virtual ~LSAKlient();
  67. // nicht constant
  68. void thread();
  69. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum AKlient
  70. };
  71. class LSKlient : public Thread
  72. {
  73. private:
  74. SKlient* klient;
  75. unsigned int klientNummer;
  76. LoginServer* ls;
  77. public:
  78. // Konstruktor
  79. LSKlient(SKlient* klient, LoginServer* ls);
  80. // Destruktor
  81. virtual ~LSKlient();
  82. // nicht constant
  83. void absturz();
  84. void thread();
  85. // constant
  86. void errorZuKlient(const char* nachricht) const; // sendet eine Fehlernachricht zum Klient
  87. int getKlientNummer() const;
  88. };
  89. class MSGWeiterleitung : public virtual ReferenceCounter
  90. {
  91. private:
  92. LoginServer* ls;
  93. public:
  94. // Konstruktor
  95. MSGWeiterleitung(LoginServer* ls);
  96. // Destruktor
  97. ~MSGWeiterleitung();
  98. // nicht constant
  99. bool spielErstelltAbbrechen(int spielErstelltId);
  100. bool spielerLeavesGruppe(int gruppeId, int accountId);
  101. bool setGruppeAdmin(int gruppeId, int adminId);
  102. bool spielerLeavesChatroom(int chatroomId, int accountId);
  103. bool setChatroomAdmin(int chatroomId, int adminId);
  104. bool kickSpielerAusGruppe(int gruppeId);
  105. };
  106. #endif