12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #pragma once
- #include <Datei.h>
- #include <InitDatei.h>
- #include <Server.h>
- #include <Text.h>
- #include <Thread.h>
- #include "Game.h"
- using namespace Framework;
- using namespace Network;
- class FCKlient;
- class GameClient;
- class FactoryCraftServer : virtual public ReferenceCounter
- {
- private:
- SSLServer* sslServer;
- Server* server;
- InitDatei* ini;
- CRITICAL_SECTION cs;
- RCArray<FCKlient>* klients;
- int runningThreads;
- int id;
- public:
- // Konstruktor
- FactoryCraftServer(InitDatei* zIni);
- // Destruktor
- virtual ~FactoryCraftServer();
- // nicht constant
- void run();
- void close();
- bool absturzKlient(int accountId);
- bool removeKlient(FCKlient* zKlient);
- bool hatClients() const;
- int getUnencryptedPort() const;
- };
- class FCKlient : public Thread
- {
- private:
- SSLSKlient* klient;
- SKlient* background;
- SKlient* foreground;
- unsigned int accountId;
- FactoryCraftServer* ls;
- GameClient* zGameClient;
- NetworkReader* backgroundReader;
- NetworkReader* foregroundReader;
- NetworkWriter* backgroundWriter;
- NetworkWriter* foregroundWriter;
- Critical cs;
- bool backgroundRunning;
- bool foregroundRunning;
- char* authKey;
- int authKeyLen;
- public:
- // Konstruktor
- FCKlient(SSLSKlient* klient, FactoryCraftServer* ls);
- // Destruktor
- virtual ~FCKlient();
- void setForegroundClient(SKlient* foreground);
- void setBackgroundClient(SKlient* background);
- // nicht constant
- void absturz();
- void thread();
- // constant
- int getAccountId() const;
- NetworkWriter* zBackgroundWriter() const;
- NetworkWriter* zForegroundWriter() const;
- bool matchAuthKey(char* key, int len) const;
- };
|