Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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
13UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params,
14 const UniValue &id);
15UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error,
16 const UniValue &id);
17std::string JSONRPCReply(const UniValue &result, const UniValue &error,
18 const UniValue &id);
19UniValue JSONRPCError(int code, const std::string &message);
20
22bool GenerateAuthCookie(std::string *cookie_out);
24bool GetAuthCookie(std::string *cookie_out);
26void DeleteAuthCookie();
28std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in);
29
31public:
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:164
std::string URI
Definition request.h:36
std::string authUser
Definition request.h:37
std::any context
Definition request.h:39
bool error(const char *fmt, const Args &...args)
Definition logging.h:226
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
std::vector< UniValue > JSONRPCProcessBatchReply(const UniValue &in)
Parse JSON-RPC batch reply into a vector.
Definition request.cpp:144
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition request.cpp:118
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition request.cpp:52
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition request.cpp:30
UniValue JSONRPCError(int code, const std::string &message)
Definition request.cpp:58
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition request.cpp:135
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition request.cpp:82
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition request.cpp:39