| 1 | /*! |
|---|
| 2 | * @file player_stats.h |
|---|
| 3 | * @brief Definition of ProxyControl |
|---|
| 4 | * |
|---|
| 5 | * manages the clients on the proxies (connect/disconnect) |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifndef _PROXY_SETTINGS_H |
|---|
| 9 | #define _PROXY_SETTINGS_H |
|---|
| 10 | |
|---|
| 11 | #include "synchronizeable.h" |
|---|
| 12 | #include "message_manager.h" |
|---|
| 13 | |
|---|
| 14 | #include <string> |
|---|
| 15 | #include <list> |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | typedef enum proxyCommand { |
|---|
| 19 | PXY_RECONNECT = 0, //!< forces a reconnection of the node |
|---|
| 20 | |
|---|
| 21 | PXY_WEAKUP, //!< signal to weakup a sleeping proxy server (not impl. yet) |
|---|
| 22 | PXY_SLEEP, //!< signal to sleep and disconnect clients |
|---|
| 23 | |
|---|
| 24 | PXY_NUMBER |
|---|
| 25 | }; |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | //! A class for storing player information |
|---|
| 30 | class ProxyControl : public Synchronizeable |
|---|
| 31 | { |
|---|
| 32 | ObjectListDeclaration(ProxyControl); |
|---|
| 33 | public: |
|---|
| 34 | inline static ProxyControl* getInstance() { if (!ProxyControl::singletonRef) ProxyControl::singletonRef = new ProxyControl(); |
|---|
| 35 | return ProxyControl::singletonRef; } |
|---|
| 36 | virtual ~ProxyControl(); |
|---|
| 37 | |
|---|
| 38 | virtual void varChangeHandler( std::list<int> & id ); |
|---|
| 39 | |
|---|
| 40 | /* connection signal handling */ |
|---|
| 41 | void signalNewClient(int userId); |
|---|
| 42 | static bool messageHandlerNewClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); |
|---|
| 43 | |
|---|
| 44 | void signalLeaveClient(int userId); |
|---|
| 45 | static bool messageHandlerLeaveClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); |
|---|
| 46 | |
|---|
| 47 | /* proxy server network control */ |
|---|
| 48 | void forceReconnectionShellThumb(); |
|---|
| 49 | void forceReconnectionShell(int userId, int serverId); |
|---|
| 50 | void forceReconnection(int userId, int serverId); |
|---|
| 51 | void forceReconnection(int userId, int serverId, IP newAddress); |
|---|
| 52 | void forceReconnection(int userId, const std::string& newAddress); |
|---|
| 53 | static bool messageHandlerCommand( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); |
|---|
| 54 | |
|---|
| 55 | private: |
|---|
| 56 | ProxyControl(); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | private: |
|---|
| 60 | static ProxyControl* singletonRef; //!< Pointer to the only instance of this Class |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | #endif /* _PROXY_SETTINGS_H */ |
|---|