rippled
Loading...
Searching...
No Matches
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 <xrpld/core/Config.h>
24#include <xrpl/basics/Log.h>
25#include <xrpl/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
33namespace 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
42namespace RPCCall {
43
44int
46 Config const& config,
47 const std::vector<std::string>& vCmd,
48 Logs& logs);
49
50void
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
70 std::vector<std::string> const& args,
71 Json::Value& retParams,
72 unsigned int apiVersion,
74
80 std::vector<std::string> const& args,
81 Config const& config,
82 Logs& logs,
83 unsigned int apiVersion,
85
86} // namespace ripple
87
88#endif
Represents a JSON value.
Definition: json_value.h:147
A generic endpoint for log messages.
Definition: Journal.h:59
int fromCommandLine(Config const &config, const std::vector< std::string > &vCmd, Logs &logs)
Definition: RPCCall.cpp:1617
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:1633
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
std::pair< int, Json::Value > rpcClient(std::vector< std::string > const &args, Config const &config, Logs &logs, unsigned int apiVersion, std::unordered_map< std::string, std::string > const &headers)
Internal invocation of RPC client.
Definition: RPCCall.cpp:1464
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition: RPCCall.cpp:1423