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
25#include <xrpl/basics/Log.h>
26#include <xrpl/json/json_value.h>
27
28#include <boost/asio/io_context.hpp>
29
30#include <functional>
31#include <string>
32#include <unordered_map>
33#include <vector>
34
35namespace ripple {
36
37// This a trusted interface, the user is expected to provide valid input to
38// perform valid requests. Error catching and reporting is not a requirement of
39// the command line interface.
40//
41// Improvements to be more strict and to provide better diagnostics are welcome.
42
44namespace RPCCall {
45
46int
48 Config const& config,
49 std::vector<std::string> const& vCmd,
50 Logs& logs);
51
52void
54 boost::asio::io_context& io_context,
55 std::string const& strIp,
56 std::uint16_t const iPort,
57 std::string const& strUsername,
58 std::string const& strPassword,
59 std::string const& strPath,
60 std::string const& strMethod,
61 Json::Value const& jvParams,
62 bool const bSSL,
63 bool quiet,
64 Logs& logs,
65 std::function<void(Json::Value const& jvInput)> callbackFuncP =
66 std::function<void(Json::Value const& jvInput)>(),
68} // namespace RPCCall
69
72 std::vector<std::string> const& args,
73 Json::Value& retParams,
74 unsigned int apiVersion,
76
82 std::vector<std::string> const& args,
83 Config const& config,
84 Logs& logs,
85 unsigned int apiVersion,
87
88} // namespace ripple
89
90#endif
Represents a JSON value.
Definition json_value.h:149
A generic endpoint for log messages.
Definition Journal.h:60
void fromNetwork(boost::asio::io_context &io_context, std::string const &strIp, std::uint16_t const iPort, std::string const &strUsername, std::string const &strPassword, std::string const &strPath, std::string const &strMethod, Json::Value const &jvParams, bool const bSSL, bool const quiet, Logs &logs, std::function< void(Json::Value const &jvInput)> callbackFuncP, std::unordered_map< std::string, std::string > headers)
Definition RPCCall.cpp:1649
int fromCommandLine(Config const &config, std::vector< std::string > const &vCmd, Logs &logs)
Definition RPCCall.cpp:1633
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
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:1480
Json::Value rpcCmdToJson(std::vector< std::string > const &args, Json::Value &retParams, unsigned int apiVersion, beast::Journal j)
Definition RPCCall.cpp:1439