Bitcoin Core  24.99.0
P2P Digital Currency
request.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2021 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_RPC_REQUEST_H
7 #define BITCOIN_RPC_REQUEST_H
8 
9 #include <any>
10 #include <string>
11 
12 #include <univalue.h>
13 
14 UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
15 UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
16 std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
17 UniValue JSONRPCError(int code, const std::string& message);
18 
20 bool GenerateAuthCookie(std::string *cookie_out);
22 bool GetAuthCookie(std::string *cookie_out);
24 void DeleteAuthCookie();
26 std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue& in);
27 
29 {
30 public:
32  std::string strMethod;
35  std::string URI;
36  std::string authUser;
37  std::string peerAddr;
38  std::any context;
39 
40  void parse(const UniValue& valRequest);
41 };
42 
43 #endif // BITCOIN_RPC_REQUEST_H
UniValue params
Definition: request.h:33
std::string strMethod
Definition: request.h:32
enum JSONRPCRequest::Mode mode
std::string peerAddr
Definition: request.h:37
UniValue id
Definition: request.h:31
void parse(const UniValue &valRequest)
Definition: request.cpp:158
std::string URI
Definition: request.h:35
std::string authUser
Definition: request.h:36
std::any context
Definition: request.h:38
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:113
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:50
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: request.cpp:29
UniValue JSONRPCError(int code, const std::string &message)
Definition: request.cpp:56
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:81
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:38
bool error(const char *fmt, const Args &... args)
Definition: system.h:48