LoginServer.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. Server *aServer;
  17. InitDatei *ini;
  18. LSDatenbank *db;
  19. CRITICAL_SECTION cs;
  20. RCArray< LSKlient > *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. LoginServer( InitDatei *zIni );
  32. // Destruktor
  33. virtual ~LoginServer();
  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( LSKlient *zKlient );
  45. void addGesendet( int bytes );
  46. void addEmpfangen( int bytes );
  47. // conatant
  48. bool istAn() const;
  49. Server *zServer() const;
  50. LSDatenbank *zDB() const;
  51. bool hatClients() const;
  52. int getId() const;
  53. char *getLetzterFehler() const;
  54. // Reference Counting
  55. LoginServer *getThis();
  56. LoginServer *release();
  57. };
  58. class LSAKlient : public Thread
  59. {
  60. private:
  61. SKlient *klient;
  62. Text *name;
  63. Text *passwort;
  64. int adminId;
  65. LoginServer *ls;
  66. int version;
  67. public:
  68. // Konstruktor
  69. LSAKlient( SKlient *klient, LoginServer *ls );
  70. // Destruktor
  71. virtual ~LSAKlient();
  72. // nicht constant
  73. void thread();
  74. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum AKlient
  75. };
  76. class LSKlient : public Thread
  77. {
  78. private:
  79. SKlient *klient;
  80. unsigned int klientNummer;
  81. LoginServer *ls;
  82. int ref;
  83. public:
  84. // Konstruktor
  85. LSKlient( SKlient *klient, LoginServer *ls );
  86. // Destruktor
  87. virtual ~LSKlient();
  88. // nicht constant
  89. void absturz();
  90. void thread();
  91. // constant
  92. void errorZuKlient( const char *nachricht ) const; // sendet eine Fehlernachricht zum Klient
  93. int getKlientNummer() const;
  94. // Reference Counting
  95. LSKlient *getThis();
  96. LSKlient *release();
  97. };
  98. class MSGWeiterleitung
  99. {
  100. private:
  101. LoginServer *ls;
  102. int ref;
  103. public:
  104. // Konstruktor
  105. MSGWeiterleitung( LoginServer *ls );
  106. // Destruktor
  107. ~MSGWeiterleitung();
  108. // nicht constant
  109. bool spielErstelltAbbrechen( int spielErstelltId );
  110. bool spielerLeavesGruppe( int gruppeId, int accountId );
  111. bool setGruppeAdmin( int gruppeId, int adminId );
  112. bool spielerLeavesChatroom( int chatroomId, int accountId );
  113. bool setChatroomAdmin( int chatroomId, int adminId );
  114. bool kickSpielerAusGruppe( int gruppeId );
  115. // constant
  116. // Reference Counting
  117. MSGWeiterleitung *getThis();
  118. MSGWeiterleitung *release();
  119. };
  120. #endif