#ifndef TCPSERVERPLUGIN_H #define TCPSERVERPLUGIN_H #include "PluginInterface.h" #include "IPC.h" #include #include #include #include class TcpServerPlugin : public IPlugin { public: TcpServerPlugin(IPC *ipc); ~TcpServerPlugin(); void handleMessage(const Command& cmd) override; void updateConfig(const nlohmann::json& config) override; const std::string getPluginName() override; void onClientConnect(sockets::ClientHandle client); void onClientDisconnect(sockets::ClientHandle client, const sockets::SocketRet& ret); void onReceiveClientData(sockets::ClientHandle client, const char* data, size_t size); const std::string plugin_name = "TcpServer"; private: void startServer(); void stopServer(); IPC *ipc; nlohmann::json config; bool running; std::unique_ptr> server; }; extern "C" IPlugin* create(IPC * ipc); #endif // TCPSERVERPLUGIN_H