mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
NetworkSetting method
This commit is contained in:
parent
dcae7fc541
commit
1eef996701
|
@ -24,6 +24,7 @@ namespace client
|
|||
m_MethodHandlers[I2P_CONTROL_METHOD_ECHO] = &I2PControlService::EchoHandler;
|
||||
m_MethodHandlers[I2P_CONTROL_METHOD_ROUTER_INFO] = &I2PControlService::RouterInfoHandler;
|
||||
m_MethodHandlers[I2P_CONTROL_METHOD_ROUTER_MANAGER] = &I2PControlService::RouterManagerHandler;
|
||||
m_MethodHandlers[I2P_CONTROL_METHOD_NETWORK_SETTING] = &I2PControlService::NetworkSettingHandler;
|
||||
|
||||
// RouterInfo
|
||||
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_NETDB_KNOWNPEERS] = &I2PControlService::NetDbKnownPeersHandler;
|
||||
|
@ -272,5 +273,21 @@ namespace client
|
|||
Daemon.running = 0;
|
||||
});
|
||||
}
|
||||
|
||||
// network setting
|
||||
void I2PControlService::NetworkSettingHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
|
||||
{
|
||||
LogPrint (eLogDebug, "I2PControl NetworkSetting");
|
||||
for (auto& it: params)
|
||||
{
|
||||
LogPrint (eLogDebug, it.first);
|
||||
auto it1 = m_NetworkSettingHandlers.find (it.first);
|
||||
if (it1 != m_NetworkSettingHandlers.end ())
|
||||
(this->*(it1->second))(it.second, results);
|
||||
else
|
||||
LogPrint (eLogError, "I2PControl NetworkSetting unknown request ", it.first);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace client
|
|||
const char I2P_CONTROL_METHOD_ECHO[] = "Echo";
|
||||
const char I2P_CONTROL_METHOD_ROUTER_INFO[] = "RouterInfo";
|
||||
const char I2P_CONTROL_METHOD_ROUTER_MANAGER[] = "RouterManager";
|
||||
const char I2P_CONTROL_METHOD_NETWORK_SETTING[] = "NetworkSetting";
|
||||
|
||||
// params
|
||||
const char I2P_CONTROL_PARAM_API[] = "API";
|
||||
|
@ -75,6 +76,7 @@ namespace client
|
|||
void EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
|
||||
void RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
|
||||
void RouterManagerHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
|
||||
void NetworkSettingHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
|
||||
|
||||
// RouterInfo
|
||||
typedef void (I2PControlService::*RouterInfoRequestHandler)(std::map<std::string, std::string>& results);
|
||||
|
@ -86,6 +88,9 @@ namespace client
|
|||
void ShutdownHandler (std::map<std::string, std::string>& results);
|
||||
void ShutdownGracefulHandler (std::map<std::string, std::string>& results);
|
||||
|
||||
// NetworkSetting
|
||||
typedef void (I2PControlService::*NetworkSettingRequestHandler)(const std::string& value, std::map<std::string, std::string>& results);
|
||||
|
||||
private:
|
||||
|
||||
bool m_IsRunning;
|
||||
|
@ -95,10 +100,10 @@ namespace client
|
|||
boost::asio::ip::tcp::acceptor m_Acceptor;
|
||||
boost::asio::deadline_timer m_ShutdownTimer;
|
||||
|
||||
|
||||
std::map<std::string, MethodHandler> m_MethodHandlers;
|
||||
std::map<std::string, RouterInfoRequestHandler> m_RouterInfoHandlers;
|
||||
std::map<std::string, RouterManagerRequestHandler> m_RouterManagerHandlers;
|
||||
std::map<std::string, NetworkSettingRequestHandler> m_NetworkSettingHandlers;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue