handle i2p.router.net.bw requests

This commit is contained in:
orignal 2015-03-17 15:36:15 -04:00
parent 60c60b4db1
commit 708e17162c
2 changed files with 18 additions and 2 deletions

View File

@ -40,6 +40,8 @@ namespace client
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS] = &I2PControlService::NetDbActivePeersHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_STATUS] = &I2PControlService::StatusHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = &I2PControlService::TunnelsParticipatingHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_BW_IB_1S] = &I2PControlService::InboundBandwidth1S ;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_BW_OB_1S] = &I2PControlService::OutboundBandwidth1S ;
// RouterManager
m_RouterManagerHandlers[I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN] = &I2PControlService::ShutdownHandler;
@ -332,6 +334,16 @@ namespace client
results[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = boost::lexical_cast<std::string>(i2p::tunnel::tunnels.GetTransitTunnels ().size ());
}
void I2PControlService::InboundBandwidth1S (std::map<std::string, std::string>& results)
{
results[I2P_CONTROL_ROUTER_INFO_BW_IB_1S] = boost::lexical_cast<std::string>(i2p::transport::transports.GetInBandwidth ());
}
void I2PControlService::OutboundBandwidth1S (std::map<std::string, std::string>& results)
{
results[I2P_CONTROL_ROUTER_INFO_BW_OB_1S] = boost::lexical_cast<std::string>(i2p::transport::transports.GetOutBandwidth ());
}
// RouterManager
void I2PControlService::RouterManagerHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)

View File

@ -49,8 +49,10 @@ namespace client
const char I2P_CONTROL_ROUTER_INFO_NETDB_KNOWNPEERS[] = "i2p.router.netdb.knownpeers";
const char I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS[] = "i2p.router.netdb.activepeers";
const char I2P_CONTROL_ROUTER_INFO_STATUS[] = "i2p.router.net.status";
const char I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING[] = "i2p.router.net.tunnels.participating";
const char I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING[] = "i2p.router.net.tunnels.participating";
const char I2P_CONTROL_ROUTER_INFO_BW_IB_1S[] = "i2p.router.net.bw.inbound.1s";
const char I2P_CONTROL_ROUTER_INFO_BW_OB_1S[] = "i2p.router.net.bw.outbound.1s";
// RouterManager requests
const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN[] = "Shutdown";
const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN_GRACEFUL[] = "ShutdownGraceful";
@ -102,6 +104,8 @@ namespace client
void NetDbActivePeersHandler (std::map<std::string, std::string>& results);
void StatusHandler (std::map<std::string, std::string>& results);
void TunnelsParticipatingHandler (std::map<std::string, std::string>& results);
void InboundBandwidth1S (std::map<std::string, std::string>& results);
void OutboundBandwidth1S (std::map<std::string, std::string>& results);
// RouterManager
typedef void (I2PControlService::*RouterManagerRequestHandler)(std::map<std::string, std::string>& results);