Bitcoin ABC  0.26.3
P2P Digital Currency
request.h
Go to the documentation of this file.
1 // Copyright (c) 2018 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_RPC_REQUEST_H
6 #define BITCOIN_RPC_REQUEST_H
7 
8 #include <univalue.h>
9 
10 #include <any>
11 #include <string>
12 
13 UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params,
14  const UniValue &id);
15 UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error,
16  const UniValue &id);
17 std::string JSONRPCReply(const UniValue &result, const UniValue &error,
18  const UniValue &id);
19 UniValue JSONRPCError(int code, const std::string &message);
20 
22 bool GenerateAuthCookie(std::string *cookie_out);
24 bool GetAuthCookie(std::string *cookie_out);
26 void DeleteAuthCookie();
28 std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in);
29 
31 public:
33  std::string strMethod;
36  std::string URI;
37  std::string authUser;
38  std::string peerAddr;
39  std::any context;
40 
41  void parse(const UniValue &valRequest);
42 };
43 
44 #endif // BITCOIN_RPC_REQUEST_H
UniValue params
Definition: request.h:34
std::string strMethod
Definition: request.h:33
enum JSONRPCRequest::Mode mode
std::string peerAddr
Definition: request.h:38
UniValue id
Definition: request.h:32
void parse(const UniValue &valRequest)
Definition: request.cpp:158
std::string URI
Definition: request.h:36
std::string authUser
Definition: request.h:37
std::any context
Definition: request.h:39
std::vector< UniValue > JSONRPCProcessBatchReply(const UniValue &in)
Parse JSON-RPC batch reply into a vector.
Definition: request.cpp:138
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition: request.cpp:112
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:46
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: request.cpp:24
UniValue JSONRPCError(int code, const std::string &message)
Definition: request.cpp:52
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition: request.cpp:129
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition: request.cpp:76
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:33
bool error(const char *fmt, const Args &...args)
Definition: system.h:46