Bitcoin Core  21.99.0
P2P Digital Currency
request.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 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
JSONRPCRequest::context
std::any context
Definition: request.h:38
JSONRPCRequest::Mode
Mode
Definition: request.h:34
JSONRPCReply
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:45
UniValue
Definition: univalue.h:19
DeleteAuthCookie
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition: request.cpp:124
JSONRPCRequest::peerAddr
std::string peerAddr
Definition: request.h:37
JSONRPCError
UniValue JSONRPCError(int code, const std::string &message)
Definition: request.cpp:51
JSONRPCRequest::id
UniValue id
Definition: request.h:31
JSONRPCRequest::strMethod
std::string strMethod
Definition: request.h:32
univalue.h
JSONRPCProcessBatchReply
std::vector< UniValue > JSONRPCProcessBatchReply(const UniValue &in)
Parse JSON-RPC batch reply into a vector.
Definition: request.cpp:133
JSONRPCRequestObj
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: request.cpp:24
JSONRPCRequest::mode
enum JSONRPCRequest::Mode mode
JSONRPCReplyObj
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: request.cpp:33
GetAuthCookie
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition: request.cpp:108
JSONRPCRequest::parse
void parse(const UniValue &valRequest)
Definition: request.cpp:153
JSONRPCRequest::params
UniValue params
Definition: request.h:33
JSONRPCRequest::GET_HELP
@ GET_HELP
Definition: request.h:34
JSONRPCRequest::GET_ARGS
@ GET_ARGS
Definition: request.h:34
JSONRPCRequest::URI
std::string URI
Definition: request.h:35
JSONRPCRequest
Definition: request.h:28
GenerateAuthCookie
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition: request.cpp:76
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:49
JSONRPCRequest::EXECUTE
@ EXECUTE
Definition: request.h:34
JSONRPCRequest::authUser
std::string authUser
Definition: request.h:36