/** @file * @author Edouard DUPIN * @copyright 2016, Edouard DUPIN, all right reserved * @license MPL v2.0 (see license file) */ #pragma once #include #include #include #include namespace appl { class TcpServerInput; class Router : public eproperty::Interface { private: uint64_t m_clientUID; private: etk::Vector> m_GateWayList; //!< List of all service availlable with their specific connection interface etk::Vector> m_clientList; //!< List of all Client interface with their own connection ememory::SharedPtr m_interfaceClientServer; ememory::SharedPtr m_interfaceGateWayServer; ejson::Document m_listUser; public: eproperty::Value propertyStdOut; //!< not set the log in the stdout or in the local file eproperty::Value propertyClientIp; eproperty::Value propertyClientPort; eproperty::Value propertyClientMax; eproperty::Value propertyGateWayIp; eproperty::Value propertyGateWayPort; eproperty::Value propertyGateWayMax; eproperty::Value propertyDelayToStop; public: Router(); virtual ~Router(); void start(); void stop(); // Get a specific user gateway: ememory::SharedPtr get(const etk::String& _userName); bool userIsConnected(const etk::String& _userName); etk::Vector getAllUserName(); void newClientGateWay(enet::Tcp _connection); void newClient(enet::Tcp _connection); void cleanIO(); private: void onPropertyChangeClientIp(); void onPropertyChangeClientPort(); void onPropertyChangeClientMax(); void onPropertyChangeGateWayIp(); void onPropertyChangeGateWayPort(); void onPropertyChangeGateWayMax(); void onClientConnect(const bool& _value); void onServiceConnect(const bool& _value); }; }