Datenbank.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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
  32. {
  33. private:
  34. Datenbank *datenbank;
  35. CRITICAL_SECTION ths;
  36. int ref;
  37. public:
  38. // Konstruktor
  39. MSDatenbank( InitDatei *zDat );
  40. // Detruktor
  41. ~MSDatenbank();
  42. // nicht constant
  43. void lock();
  44. void unlock();
  45. int istAdministrator( const char *name, const char *passwort );
  46. bool adminHatRecht( int id, int recht );
  47. unsigned int getNextClientId();
  48. Text *getKlientKey( int cId );
  49. bool proveRegisteredClient( unsigned int num );
  50. int *unregisterClient( unsigned int num, int *len);
  51. int suchPatchServer( unsigned int client );
  52. int suchRegisterServer( unsigned int client );
  53. int suchLoginServer( unsigned int client );
  54. int suchInformationServer( unsigned int client );
  55. int suchChatServer( unsigned int client );
  56. int suchAnmeldungServer( unsigned int client );
  57. int suchErhaltungServer( unsigned int client );
  58. int suchShopServer( unsigned int client );
  59. int suchNewsServer( unsigned int client );
  60. int suchMinigameServer( unsigned int client );
  61. unsigned char *getServerPortIp( int sId );
  62. int logoutKlient( int klientId, Array< int > *ret );
  63. bool getSpielServerPortIp( int spielErstelltId, unsigned short *port, Text *ip );
  64. int getSpielerAusGruppe( int gruppeId, Array< int > *accountId );
  65. int kickSpielerAusGruppe( int gruppeId, int accountId );
  66. bool getChatServerPortIp( int accountId, unsigned short *port, Text *ip );
  67. int getGruppeAdmin( int gruppeId );
  68. int getSpielerAusChatroom( int chatroomId, Array< int > *accountId );
  69. int getChatroomAdmin( int chatroomId );
  70. int clientistEingeloggt( int clientId );
  71. bool getPatchServer( int client, Text *ip, int *port );
  72. bool getRegisterServer( int client, Text *ip, int *port );
  73. bool getLoginServer( int client, Text *ip, int *port );
  74. bool getInformationServer( int client, Text *ip, int *port );
  75. bool getChatServer( int client, Text *ip, int *port );
  76. bool getAnmeldungServer( int client, Text *ip, int *port );
  77. bool getSpielServer( int client, Text *ip, int *port );
  78. bool getShopServer( int client, Text *ip, int *port );
  79. bool getNewsServer( int client, Text *ip, int *port );
  80. bool getHistorieServer( int client, Text *ip, int *port );
  81. bool getKartenServer( int client, Text *ip, int *port );
  82. bool getEditorServer( int client, Text *ip, int *port );
  83. bool getMinigameServer( int client, Text *ip, int *port );
  84. bool getPatchServerList( Array< ServerData* > *list );
  85. bool getPatchServerDetails( int id, ServerDetails *details );
  86. // Reference Counting
  87. MSDatenbank *getThis();
  88. MSDatenbank *release();
  89. };
  90. #endif