/** @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: std::vector> m_GateWayList; //!< List of all service availlable with their specific connection interface std::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 propertyClientIp; eproperty::Value propertyClientPort; eproperty::Value propertyClientMax; eproperty::Value propertyGateWayIp; eproperty::Value propertyGateWayPort; eproperty::Value propertyGateWayMax; public: Router(); virtual ~Router(); void start(); void stop(); // Get a specific user gateway: ememory::SharedPtr get(const std::string& _userName); bool userIsConnected(const std::string& _userName); std::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); }; }