rippled
RPCCall.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_NET_RPCCALL_H_INCLUDED
21 #define RIPPLE_NET_RPCCALL_H_INCLUDED
22 
23 #include <ripple/basics/Log.h>
24 #include <ripple/core/Config.h>
25 #include <ripple/json/json_value.h>
26 #include <boost/asio/io_service.hpp>
27 #include <functional>
28 #include <string>
29 #include <unordered_map>
30 #include <utility>
31 #include <vector>
32 
33 namespace ripple {
34 
35 // This a trusted interface, the user is expected to provide valid input to
36 // perform valid requests. Error catching and reporting is not a requirement of
37 // the command line interface.
38 //
39 // Improvements to be more strict and to provide better diagnostics are welcome.
40 
42 namespace RPCCall {
43 
44 int
46  Config const& config,
47  const std::vector<std::string>& vCmd,
48  Logs& logs);
49 
50 void
52  boost::asio::io_service& io_service,
53  std::string const& strIp,
54  const std::uint16_t iPort,
55  std::string const& strUsername,
56  std::string const& strPassword,
57  std::string const& strPath,
58  std::string const& strMethod,
59  Json::Value const& jvParams,
60  const bool bSSL,
61  bool quiet,
62  Logs& logs,
63  std::function<void(Json::Value const& jvInput)> callbackFuncP =
64  std::function<void(Json::Value const& jvInput)>(),
66 } // namespace RPCCall
67 
72 
76 rpcClient(
77  std::vector<std::string> const& args,
78  Config const& config,
79  Logs& logs,
81 
82 } // namespace ripple
83 
84 #endif
std::string
STL class.
utility
functional
std::pair< int, Json::Value >
vector
std::function
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint16_t
ripple::RPCCall::fromCommandLine
int fromCommandLine(Config const &config, const std::vector< std::string > &vCmd, Logs &logs)
Definition: RPCCall.cpp:1670
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::cmdLineToJSONRPC
Json::Value cmdLineToJSONRPC(std::vector< std::string > const &args, beast::Journal j)
Given a rippled command line, return the corresponding JSON.
Definition: RPCCall.cpp:1488
ripple::rpcClient
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition: RPCCall.cpp:1519
ripple::RPCCall::fromNetwork
void fromNetwork(boost::asio::io_service &io_service, std::string const &strIp, const std::uint16_t iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, const bool bSSL, const bool quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition: RPCCall.cpp:1685
unordered_map
Json::Value
Represents a JSON value.
Definition: json_value.h:145
string