Browse Source

handle i2p.router.net.bw requests

pull/164/head
orignal 10 years ago
parent
commit
708e17162c
  1. 12
      I2PControl.cpp
  2. 4
      I2PControl.h

12
I2PControl.cpp

@ -40,6 +40,8 @@ namespace client
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS] = &I2PControlService::NetDbActivePeersHandler; 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_STATUS] = &I2PControlService::StatusHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = &I2PControlService::TunnelsParticipatingHandler; 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 // RouterManager
m_RouterManagerHandlers[I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN] = &I2PControlService::ShutdownHandler; 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 ()); 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 // RouterManager
void I2PControlService::RouterManagerHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results) void I2PControlService::RouterManagerHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)

4
I2PControl.h

@ -50,6 +50,8 @@ namespace client
const char I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS[] = "i2p.router.netdb.activepeers"; 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_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 // RouterManager requests
const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN[] = "Shutdown"; const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN[] = "Shutdown";
@ -102,6 +104,8 @@ namespace client
void NetDbActivePeersHandler (std::map<std::string, std::string>& results); void NetDbActivePeersHandler (std::map<std::string, std::string>& results);
void StatusHandler (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 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 // RouterManager
typedef void (I2PControlService::*RouterManagerRequestHandler)(std::map<std::string, std::string>& results); typedef void (I2PControlService::*RouterManagerRequestHandler)(std::map<std::string, std::string>& results);

Loading…
Cancel
Save