From a90bb53cd295ad5558cbf63441351e8038a78862 Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Thu, 19 Mar 2015 17:17:47 -0700 Subject: [PATCH] Drop nexmo SMS support. Reverts 58b3cc1d. --- Builds/VisualStudio2013/RippleD.vcxproj | 3 - .../VisualStudio2013/RippleD.vcxproj.filters | 3 - doc/rippled-example.cfg | 68 ++++--------------- src/ripple/basics/StringUtilities.h | 2 - src/ripple/basics/impl/StringUtilities.cpp | 33 --------- src/ripple/core/Config.h | 6 -- src/ripple/core/ConfigSections.h | 5 -- src/ripple/core/impl/Config.cpp | 6 -- src/ripple/net/HTTPClient.h | 7 -- src/ripple/net/impl/HTTPClient.cpp | 48 ------------- src/ripple/net/impl/RPCCall.cpp | 11 --- src/ripple/protocol/JsonFields.h | 1 - src/ripple/rpc/handlers/Handlers.h | 1 - src/ripple/rpc/handlers/SMS.cpp | 36 ---------- src/ripple/rpc/impl/Handler.cpp | 1 - src/ripple/unity/rpcx.cpp | 1 - 16 files changed, 15 insertions(+), 217 deletions(-) delete mode 100644 src/ripple/rpc/handlers/SMS.cpp diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 28202b34d..3a4bd1bdf 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -3237,9 +3237,6 @@ True - - True - True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index bcc76f5fb..b3712c26e 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -3789,9 +3789,6 @@ ripple\rpc\handlers - - ripple\rpc\handlers - ripple\rpc\handlers diff --git a/doc/rippled-example.cfg b/doc/rippled-example.cfg index 64d1fb034..385a8af95 100644 --- a/doc/rippled-example.cfg +++ b/doc/rippled-example.cfg @@ -10,19 +10,17 @@ # # 2. Peer Protocol # -# 3. SMS Gateway +# 3. Ripple Protocol # -# 4. Ripple Protocol +# 4. HTTPS Client # -# 5. HTTPS Client +# 5. Database # -# 6. Database +# 6. Diagnostics # -# 7. Diagnostics +# 7. Voting # -# 8. Voting -# -# 9. Example Settings +# 8. Example Settings # #------------------------------------------------------------------------------- # @@ -397,43 +395,7 @@ # #------------------------------------------------------------------------------- # -# 3. SMS Gateway -# -#--------------- -# -# If you have a certain SMS messaging provider you can configure these -# settings to allow the rippled server instance to send an SMS text to the -# configured gateway in response to an admin-level RPC command "sms" with -# one parameter, 'text' containing the message to send. This allows backend -# applications to use the rippled instance to securely notify administrators -# of custom events or information via SMS gateway. -# -# When the 'sms' RPC command is issued, the configured SMS gateway will be -# contacted via HTTPS GET at the URL indicated by sms_url. The URI formed -# will be in this format: -# -# [sms_url]?from=[sms_from]&to=[sms_to]&api_key=[sms_key]&api_secret=[sms_secret]&text=['text'] -# -# Where [...] are the corresponding values from the configuration file, and -# ['test'] is the value of the JSON field with name 'text'. -# -# [sms_url] -# -# The URL to contact via HTTPS when sending SMS messages -# -# [sms_from] -# [sms_to] -# [sms_key] -# [sms_secret] -# -# These are all strings passed directly in the URI as query parameters -# to the provider of the SMS gateway. -# -# -# -#------------------------------------------------------------------------------- -# -# 4. Ripple Protocol +# 3. Ripple Protocol # #------------------- # @@ -579,14 +541,14 @@ # #------------------------------------------------------------------------------- # -# 5. HTTPS Client +# 4. HTTPS Client # #---------------- # # The rippled server instance uses HTTPS GET requests in a variety of -# circumstances, including but not limited to the SMS Messaging Gateway -# feature and also for contacting trusted domains to fetch information -# such as mapping an email address to a Ripple Payment Network address. +# circumstances, including but not limited to contacting trusted domains to +# fetch information such as mapping an email address to a Ripple Payment +# Network address. # # [ssl_verify] # @@ -621,7 +583,7 @@ # #------------------------------------------------------------------------------- # -# 6. Database +# 5. Database # #------------ # @@ -700,7 +662,7 @@ # #------------------------------------------------------------------------------- # -# 7. Diagnostics +# 6. Diagnostics # #--------------- # @@ -756,7 +718,7 @@ # #------------------------------------------------------------------------------- # -# 8. Voting +# 7. Voting # #---------- # @@ -807,7 +769,7 @@ # #------------------------------------------------------------------------------- # -# 9. Example Settings +# 8. Example Settings # #-------------------- # diff --git a/src/ripple/basics/StringUtilities.h b/src/ripple/basics/StringUtilities.h index b32546873..bac014d85 100644 --- a/src/ripple/basics/StringUtilities.h +++ b/src/ripple/basics/StringUtilities.h @@ -29,8 +29,6 @@ namespace ripple { -extern std::string urlEncode (std::string const& strSrc); - // NIKB TODO Remove the need for all these overloads. Move them out of here. inline const std::string strHex (std::string const& strSrc) { diff --git a/src/ripple/basics/impl/StringUtilities.cpp b/src/ripple/basics/impl/StringUtilities.cpp index 7a4cd4d54..e12a42ec8 100644 --- a/src/ripple/basics/impl/StringUtilities.cpp +++ b/src/ripple/basics/impl/StringUtilities.cpp @@ -131,39 +131,6 @@ std::string strCopy (Blob const& vucSrc) } -extern std::string urlEncode (std::string const& strSrc) -{ - std::string strDst; - int iOutput = 0; - int iSize = strSrc.length (); - - strDst.resize (iSize * 3); - - for (int iInput = 0; iInput < iSize; iInput++) - { - unsigned char c = strSrc[iInput]; - - if (c == ' ') - { - strDst[iOutput++] = '+'; - } - else if (isalnum (c)) - { - strDst[iOutput++] = c; - } - else - { - strDst[iOutput++] = '%'; - strDst[iOutput++] = charHex (c >> 4); - strDst[iOutput++] = charHex (c & 15); - } - } - - strDst.resize (iOutput); - - return strDst; -} - // // IP Port parsing // diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index 5ed904152..44bc9a349 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -251,12 +251,6 @@ public: std::string SSL_VERIFY_FILE; std::string SSL_VERIFY_DIR; - std::string SMS_FROM; - std::string SMS_KEY; - std::string SMS_SECRET; - std::string SMS_TO; - std::string SMS_URL; - public: Config (); diff --git a/src/ripple/core/ConfigSections.h b/src/ripple/core/ConfigSections.h index f6dd5bdf5..31257a219 100644 --- a/src/ripple/core/ConfigSections.h +++ b/src/ripple/core/ConfigSections.h @@ -58,11 +58,6 @@ struct ConfigSection #define SECTION_PEER_PRIVATE "peer_private" #define SECTION_PEERS_MAX "peers_max" #define SECTION_RPC_STARTUP "rpc_startup" -#define SECTION_SMS_FROM "sms_from" -#define SECTION_SMS_KEY "sms_key" -#define SECTION_SMS_SECRET "sms_secret" -#define SECTION_SMS_TO "sms_to" -#define SECTION_SMS_URL "sms_url" #define SECTION_SNTP "sntp_servers" #define SECTION_SSL_VERIFY "ssl_verify" #define SECTION_SSL_VERIFY_FILE "ssl_verify_file" diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index f0044e1c6..3110408f3 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -546,12 +546,6 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp)) ACCOUNT_PROBE_MAX = beast::lexicalCastThrow (strTemp); - (void) getSingleSection (secConfig, SECTION_SMS_FROM, SMS_FROM); - (void) getSingleSection (secConfig, SECTION_SMS_KEY, SMS_KEY); - (void) getSingleSection (secConfig, SECTION_SMS_SECRET, SMS_SECRET); - (void) getSingleSection (secConfig, SECTION_SMS_TO, SMS_TO); - (void) getSingleSection (secConfig, SECTION_SMS_URL, SMS_URL); - if (getSingleSection (secConfig, SECTION_VALIDATORS_FILE, strTemp)) { VALIDATORS_FILE = strTemp; diff --git a/src/ripple/net/HTTPClient.h b/src/ripple/net/HTTPClient.h index aa3bcb48f..8d8a77fbf 100644 --- a/src/ripple/net/HTTPClient.h +++ b/src/ripple/net/HTTPClient.h @@ -67,13 +67,6 @@ public: std::size_t responseMax, boost::posix_time::time_duration timeout, std::function complete); - - enum - { - smsTimeoutSeconds = 30 - }; - - static void sendSMS (boost::asio::io_service& io_service, std::string const& strText); }; } // ripple diff --git a/src/ripple/net/impl/HTTPClient.cpp b/src/ripple/net/impl/HTTPClient.cpp index af17f2c4f..64d00c06c 100644 --- a/src/ripple/net/impl/HTTPClient.cpp +++ b/src/ripple/net/impl/HTTPClient.cpp @@ -489,13 +489,6 @@ public: } } - static bool onSMSResponse (const boost::system::error_code& ecResult, int iStatus, std::string const& strData) - { - WriteLog (lsINFO, HTTPClient) << "SMS: Response:" << iStatus << " :" << strData; - - return true; - } - private: typedef std::shared_ptr pointer; @@ -579,45 +572,4 @@ void HTTPClient::request ( client->request (bSSL, deqSites, setRequest, timeout, complete); } -void HTTPClient::sendSMS (boost::asio::io_service& io_service, std::string const& strText) -{ - std::string strScheme; - std::string strDomain; - int iPort; - std::string strPath; - - if (getConfig ().SMS_URL == "" || !parseUrl (getConfig ().SMS_URL, strScheme, strDomain, iPort, strPath)) - { - WriteLog (lsWARNING, HTTPClient) << "SMSRequest: Bad URL:" << getConfig ().SMS_URL; - } - else - { - bool const bSSL = strScheme == "https"; - - std::deque deqSites (1, strDomain); - std::string strURI = - boost::str (boost::format ("%s?from=%s&to=%s&api_key=%s&api_secret=%s&text=%s") - % (strPath.empty () ? "/" : strPath) - % getConfig ().SMS_FROM - % getConfig ().SMS_TO - % getConfig ().SMS_KEY - % getConfig ().SMS_SECRET - % urlEncode (strText)); - - // WriteLog (lsINFO) << "SMS: Request:" << strURI; - WriteLog (lsINFO, HTTPClient) << "SMS: Request: '" << strText << "'"; - - if (iPort < 0) - iPort = bSSL ? 443 : 80; - - std::shared_ptr client ( - new HTTPClientImp (io_service, iPort, maxClientHeaderBytes)); - - client->get (bSSL, deqSites, strURI, boost::posix_time::seconds (smsTimeoutSeconds), - std::bind (&HTTPClientImp::onSMSResponse, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); - } -} - } // ripple diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 962714291..3eb905d91 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -635,16 +635,6 @@ private: return rpcError (rpcINVALID_PARAMS); } - // sms - Json::Value parseSMS (Json::Value const& jvParams) - { - Json::Value jvRequest; - - jvRequest[jss::text] = jvParams[0u].asString (); - - return jvRequest; - } - // tx Json::Value parseTx (Json::Value const& jvParams) { @@ -850,7 +840,6 @@ public: { "random", &RPCParser::parseAsIs, 0, 0 }, { "ripple_path_find", &RPCParser::parseRipplePathFind, 1, 2 }, { "sign", &RPCParser::parseSignSubmit, 2, 3 }, - { "sms", &RPCParser::parseSMS, 1, 1 }, { "submit", &RPCParser::parseSignSubmit, 1, 3 }, { "server_info", &RPCParser::parseAsIs, 0, 0 }, { "server_state", &RPCParser::parseAsIs, 0, 0 }, diff --git a/src/ripple/protocol/JsonFields.h b/src/ripple/protocol/JsonFields.h index c383c508d..9fdd62b7c 100644 --- a/src/ripple/protocol/JsonFields.h +++ b/src/ripple/protocol/JsonFields.h @@ -327,7 +327,6 @@ JSS ( taker_gets ); // in: Subscribe, Unsubscribe, BookOffers JSS ( taker_gets_funded ); // out: NetworkOPs JSS ( taker_pays ); // in: Subscribe, Unsubscribe, BookOffers JSS ( taker_pays_funded ); // out: NetworkOPs -JSS ( text ); // in: SMS JSS ( threshold ); // in: Blacklist JSS ( timeouts ); // out: InboundLedger JSS ( totalCoins ); // out: LedgerToJson diff --git a/src/ripple/rpc/handlers/Handlers.h b/src/ripple/rpc/handlers/Handlers.h index 0f0fb3b5c..20825717a 100644 --- a/src/ripple/rpc/handlers/Handlers.h +++ b/src/ripple/rpc/handlers/Handlers.h @@ -56,7 +56,6 @@ Json::Value doPing (RPC::Context&); Json::Value doPrint (RPC::Context&); Json::Value doRandom (RPC::Context&); Json::Value doRipplePathFind (RPC::Context&); -Json::Value doSMS (RPC::Context&); Json::Value doServerInfo (RPC::Context&); // for humans Json::Value doServerState (RPC::Context&); // for machines Json::Value doSessionClose (RPC::Context&); diff --git a/src/ripple/rpc/handlers/SMS.cpp b/src/ripple/rpc/handlers/SMS.cpp deleted file mode 100644 index 7f518aaab..000000000 --- a/src/ripple/rpc/handlers/SMS.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012-2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include - -namespace ripple { - -Json::Value doSMS (RPC::Context& context) -{ - if (!context.params.isMember (jss::text)) - return rpcError (rpcINVALID_PARAMS); - - HTTPClient::sendSMS ( - getApp().getIOService (), context.params[jss::text].asString ()); - - return RPC::makeObjectValue ("sms dispatched"); -} - -} // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index b7df51eaf..47f0a26b6 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -134,7 +134,6 @@ HandlerTable HANDLERS({ { "submit", byRef (&doSubmit), Role::USER, NEEDS_CURRENT_LEDGER }, { "server_info", byRef (&doServerInfo), Role::USER, NO_CONDITION }, { "server_state", byRef (&doServerState), Role::USER, NO_CONDITION }, - { "sms", byRef (&doSMS), Role::ADMIN, NO_CONDITION }, { "stop", byRef (&doStop), Role::ADMIN, NO_CONDITION }, { "transaction_entry", byRef (&doTransactionEntry), Role::USER, NEEDS_CURRENT_LEDGER }, { "tx", byRef (&doTx), Role::USER, NEEDS_NETWORK_CONNECTION }, diff --git a/src/ripple/unity/rpcx.cpp b/src/ripple/unity/rpcx.cpp index dcc835402..b286e93d4 100644 --- a/src/ripple/unity/rpcx.cpp +++ b/src/ripple/unity/rpcx.cpp @@ -69,7 +69,6 @@ #include #include #include -#include #include #include #include