|
|
@ -1,11 +1,3 @@ |
|
|
|
/*
|
|
|
|
|
|
|
|
* Copyright (c) 2013-2020, The PurpleI2P Project |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* This file is part of Purple i2pd project and licensed under BSD3 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* See full license text in LICENSE file at top of project tree |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <sstream> |
|
|
|
#include <sstream> |
|
|
|
#include <openssl/x509.h> |
|
|
|
#include <openssl/x509.h> |
|
|
@ -14,12 +6,7 @@ |
|
|
|
#include <boost/date_time/local_time/local_time.hpp> |
|
|
|
#include <boost/date_time/local_time/local_time.hpp> |
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp> |
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp> |
|
|
|
#include <boost/property_tree/ini_parser.hpp> |
|
|
|
#include <boost/property_tree/ini_parser.hpp> |
|
|
|
|
|
|
|
|
|
|
|
// There is bug in boost 1.49 with gcc 4.7 coming with Debian Wheezy
|
|
|
|
|
|
|
|
#define GCC47_BOOST149 ((BOOST_VERSION == 104900) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) |
|
|
|
|
|
|
|
#if !GCC47_BOOST149 |
|
|
|
|
|
|
|
#include <boost/property_tree/json_parser.hpp> |
|
|
|
#include <boost/property_tree/json_parser.hpp> |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Crypto.h" |
|
|
|
#include "Crypto.h" |
|
|
|
#include "FS.h" |
|
|
|
#include "FS.h" |
|
|
@ -88,7 +75,8 @@ namespace client |
|
|
|
m_RouterInfoHandlers["i2p.router.net.bw.outbound.1s"] = &I2PControlService::OutboundBandwidth1S; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.bw.outbound.1s"] = &I2PControlService::OutboundBandwidth1S; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.status"] = &I2PControlService::NetStatusHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.status"] = &I2PControlService::NetStatusHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.tunnels.participating"] = &I2PControlService::TunnelsParticipatingHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.tunnels.participating"] = &I2PControlService::TunnelsParticipatingHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.tunnels.successrate"] = &I2PControlService::TunnelsSuccessRateHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.tunnels.successrate"] = |
|
|
|
|
|
|
|
&I2PControlService::TunnelsSuccessRateHandler; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.total.received.bytes"] = &I2PControlService::NetTotalReceivedBytes; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.total.received.bytes"] = &I2PControlService::NetTotalReceivedBytes; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.total.sent.bytes"] = &I2PControlService::NetTotalSentBytes; |
|
|
|
m_RouterInfoHandlers["i2p.router.net.total.sent.bytes"] = &I2PControlService::NetTotalSentBytes; |
|
|
|
|
|
|
|
|
|
|
@ -242,12 +230,6 @@ namespace client |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
std::ostringstream response; |
|
|
|
std::ostringstream response; |
|
|
|
#if GCC47_BOOST149 |
|
|
|
|
|
|
|
LogPrint (eLogError, "I2PControl: json_read is not supported due bug in boost 1.49 with gcc 4.7"); |
|
|
|
|
|
|
|
response << "{\"id\":null,\"error\":"; |
|
|
|
|
|
|
|
response << "{\"code\":-32603,\"message\":\"JSON requests is not supported with this version of boost\"},"; |
|
|
|
|
|
|
|
response << "\"jsonrpc\":\"2.0\"}"; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
boost::property_tree::ptree pt; |
|
|
|
boost::property_tree::ptree pt; |
|
|
|
boost::property_tree::read_json (ss, pt); |
|
|
|
boost::property_tree::read_json (ss, pt); |
|
|
|
|
|
|
|
|
|
|
@ -267,7 +249,6 @@ namespace client |
|
|
|
response << "{\"code\":-32601,\"message\":\"Method not found\"},"; |
|
|
|
response << "{\"code\":-32601,\"message\":\"Method not found\"},"; |
|
|
|
response << "\"jsonrpc\":\"2.0\"}"; |
|
|
|
response << "\"jsonrpc\":\"2.0\"}"; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
SendResponse (socket, buf, response, isHtml); |
|
|
|
SendResponse (socket, buf, response, isHtml); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (std::exception& ex) |
|
|
|
catch (std::exception& ex) |
|
|
|