LoginServer.h 2.5 KB

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