1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #pragma once
- #include <Datei.h>
- #include <InitDatei.h>
- #ifdef _WINDOWS
- #include <Network\Server.h>
- #else
- #include <Server.h>
- #endif
- #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 removeKlient(FCKlient* zKlient);
- bool hatClients() const;
- int getUnencryptedPort() const;
- };
- class FCKlient : public Thread
- {
- private:
- Network::SSLSKlient* klient;
- Network::SKlient* background;
- Network::SKlient* foreground;
- FactoryCraftServer* ls;
- GameClient* zGameClient;
- NetworkReader* backgroundReader;
- NetworkReader* foregroundReader;
- NetworkWriter* backgroundWriter;
- NetworkWriter* foregroundWriter;
- Critical cs;
- bool backgroundRunning;
- bool foregroundRunning;
- Framework::Text authKey;
- Framework::Text name;
- public:
- // Konstruktor
- FCKlient(Network::SSLSKlient* klient, FactoryCraftServer* ls);
- // Destruktor
- virtual ~FCKlient();
- void setForegroundClient(Network::SKlient* foreground);
- void setBackgroundClient(Network::SKlient* background);
- // nicht constant
- void absturz();
- void thread();
- // constant
- NetworkWriter* zBackgroundWriter() const;
- NetworkWriter* zForegroundWriter() const;
- bool matchAuthKey(char* key, int len) const;
- };
|