Datenbank.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef Datenbank_H
  2. #define Datenbank_H
  3. #include <sql.h>
  4. #include <Text.h>
  5. #include <InitDatei.h>
  6. using namespace Framework;
  7. using namespace sql;
  8. namespace Admin_Recht
  9. {
  10. const int MSStarten = 1;
  11. const int MSBeenden = 2;
  12. }
  13. struct ServerData
  14. {
  15. int id;
  16. Text name;
  17. Text ip;
  18. unsigned short port;
  19. unsigned short adminPort;
  20. Text status;
  21. };
  22. struct ServerDetails
  23. {
  24. Text name;
  25. Text ip;
  26. unsigned short port;
  27. unsigned short adminPort;
  28. int tasks;
  29. int maxTasks;
  30. };
  31. class MSDatenbank : public virtual ReferenceCounter
  32. {
  33. private:
  34. Datenbank* datenbank;
  35. CRITICAL_SECTION ths;
  36. public:
  37. // Konstruktor
  38. MSDatenbank(InitDatei* zDat);
  39. // Detruktor
  40. ~MSDatenbank();
  41. // nicht constant
  42. void lock();
  43. void unlock();
  44. int istAdministrator(const char* name, const char* passwort);
  45. bool adminHatRecht(int id, int recht);
  46. unsigned int getNextClientId();
  47. Text* getKlientKey(int cId);
  48. bool proveRegisteredClient(unsigned int num);
  49. int* unregisterClient(unsigned int num, int* len);
  50. int suchPatchServer(unsigned int client);
  51. int suchRegisterServer(unsigned int client);
  52. int suchLoginServer(unsigned int client);
  53. int suchInformationServer(unsigned int client);
  54. int suchChatServer(unsigned int client);
  55. int suchAnmeldungServer(unsigned int client);
  56. int suchErhaltungServer(unsigned int client);
  57. int suchShopServer(unsigned int client);
  58. int suchNewsServer(unsigned int client);
  59. int suchMinigameServer(unsigned int client);
  60. unsigned char* getServerPortIp(int sId);
  61. int logoutKlient(int klientId, Array< int >* ret);
  62. bool getSpielServerPortIp(int spielErstelltId, unsigned short* port, Text* ip);
  63. int getSpielerAusGruppe(int gruppeId, Array< int >* accountId);
  64. int kickSpielerAusGruppe(int gruppeId, int accountId);
  65. bool getChatServerPortIp(int accountId, unsigned short* port, Text* ip);
  66. int getGruppeAdmin(int gruppeId);
  67. int getSpielerAusChatroom(int chatroomId, Array< int >* accountId);
  68. int getChatroomAdmin(int chatroomId);
  69. int clientistEingeloggt(int clientId);
  70. bool getPatchServer(int client, Text* ip, int* port);
  71. bool getRegisterServer(int client, Text* ip, int* port);
  72. bool getLoginServer(int client, Text* ip, int* port);
  73. bool getInformationServer(int client, Text* ip, int* port);
  74. bool getChatServer(int client, Text* ip, int* port);
  75. bool getAnmeldungServer(int client, Text* ip, int* port);
  76. bool getSpielServer(int client, Text* ip, int* port);
  77. bool getShopServer(int client, Text* ip, int* port);
  78. bool getNewsServer(int client, Text* ip, int* port);
  79. bool getHistorieServer(int client, Text* ip, int* port);
  80. bool getKartenServer(int client, Text* ip, int* port);
  81. bool getEditorServer(int client, Text* ip, int* port);
  82. bool getMinigameServer(int client, Text* ip, int* port);
  83. bool getPatchServerList(Array< ServerData* >* list);
  84. bool getPatchServerDetails(int id, ServerDetails* details);
  85. };
  86. #endif