Drop nexmo SMS support. Reverts 58b3cc1d.

This commit is contained in:
Torrie Fischer
2015-03-19 17:17:47 -07:00
committed by Nik Bougalis
parent b450d62138
commit a90bb53cd2
16 changed files with 15 additions and 217 deletions

View File

@@ -3237,9 +3237,6 @@
<ClCompile Include="..\..\src\ripple\rpc\handlers\Sign.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\SMS.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\Stop.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -3789,9 +3789,6 @@
<ClCompile Include="..\..\src\ripple\rpc\handlers\Sign.cpp">
<Filter>ripple\rpc\handlers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\SMS.cpp">
<Filter>ripple\rpc\handlers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\Stop.cpp">
<Filter>ripple\rpc\handlers</Filter>
</ClCompile>

View File

@@ -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
#
#--------------------
#

View File

@@ -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)
{

View File

@@ -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
//

View File

@@ -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 ();

View File

@@ -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"

View File

@@ -546,12 +546,6 @@ void Config::loadFromString (std::string const& fileContents)
if (getSingleSection (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
ACCOUNT_PROBE_MAX = beast::lexicalCastThrow <int> (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;

View File

@@ -67,13 +67,6 @@ public:
std::size_t responseMax,
boost::posix_time::time_duration timeout,
std::function <bool (const boost::system::error_code& ecResult, int iStatus, std::string const& strData)> complete);
enum
{
smsTimeoutSeconds = 30
};
static void sendSMS (boost::asio::io_service& io_service, std::string const& strText);
};
} // ripple

View File

@@ -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<HTTPClient> 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<std::string> 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 <HTTPClientImp> 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

View File

@@ -635,16 +635,6 @@ private:
return rpcError (rpcINVALID_PARAMS);
}
// sms <text>
Json::Value parseSMS (Json::Value const& jvParams)
{
Json::Value jvRequest;
jvRequest[jss::text] = jvParams[0u].asString ();
return jvRequest;
}
// tx <transaction_id>
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 },

View File

@@ -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

View File

@@ -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&);

View File

@@ -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 <BeastConfig.h>
#include <ripple/net/HTTPClient.h>
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

View File

@@ -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 },

View File

@@ -69,7 +69,6 @@
#include <ripple/rpc/handlers/Print.cpp>
#include <ripple/rpc/handlers/Random.cpp>
#include <ripple/rpc/handlers/RipplePathFind.cpp>
#include <ripple/rpc/handlers/SMS.cpp>
#include <ripple/rpc/handlers/ServerInfo.cpp>
#include <ripple/rpc/handlers/ServerState.cpp>
#include <ripple/rpc/handlers/Sign.cpp>