1 #ifndef SKYWAY_ROUTER_H 2 #define SKYWAY_ROUTER_H 4 #include <fruit/fruit.h> 5 #include <rapidjson/document.h> 6 #include <rapidjson/stringbuffer.h> 7 #include <rapidjson/writer.h> 16 using fruit::Component;
17 using fruit::Injector;
21 virtual ~
Router() =
default;
23 virtual PluginResult OnConnectData(std::string target_ip,
25 std::string plugin_type,
26 std::string plugin_param) = 0;
32 std::string peer_id_ =
"";
33 std::string token_ =
"";
42 std::unordered_map<std::string, std::unique_ptr<PluginRouter>>
plugin_map_;
46 std::string on_control_message(std::string);
47 std::string on_event_request();
54 std::shared_ptr<IPluginRouterFactory> plugin_router_factory));
57 control_service_->Shutdown();
58 event_service_->Shutdown();
61 virtual void OnCreatePeer(
char* peer_id,
char* token)
override;
62 virtual PluginResult OnConnectData(std::string target_ip, uint16_t,
63 std::string, std::string)
override;
64 virtual void OnDeleteData(uint16_t port_num)
override;
69 #endif // SKYWAY_ROUTER_H virtual void OnCreatePeer(char *peer_id, char *token)
Component< Router > getRouterComponent()
virtual void OnDeleteData(uint16_t port_num)
std::function< std::unique_ptr< EventsService >(std::string, std::function< std::string()>)> EventsServiceFactory
std::unordered_map< std::string, std::unique_ptr< PluginRouter > > plugin_map_
std::function< std::unique_ptr< ControlService >(std::string, std::function< std::string(std::string)>)> ControlServiceFactory
std::shared_ptr< IPluginRouterFactory > plugin_router_factory_
ROSCONSOLE_DECL void shutdown()
std::unique_ptr< EventsService > event_service_
std::unique_ptr< ControlService > control_service_
ControlServiceFactory control_service_factory_
EventsServiceFactory event_service_factory_