httprpc.h raw
1 // Copyright (c) 2015-present The Bitcoin Core 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_HTTPRPC_H
6 #define BITCOIN_HTTPRPC_H
7
8 #include <any>
9
10 class JSONRPCRequest;
11 class UniValue;
12 enum HTTPStatusCode : int;
13
14 /** Start HTTP RPC subsystem.
15 * Precondition; HTTP and RPC has been started.
16 */
17 bool StartHTTPRPC(const std::any& context);
18 /** Interrupt HTTP RPC subsystem.
19 */
20 void InterruptHTTPRPC();
21 /** Stop HTTP RPC subsystem.
22 * Precondition; HTTP and RPC has been stopped.
23 */
24 void StopHTTPRPC();
25
26 /** Execute a single HTTP request containing one or more JSONRPC requests.
27 * Specified `jreq` will be modified and `status` will be returned.
28 */
29 UniValue ExecuteHTTPRPC(const UniValue& valRequest, JSONRPCRequest& jreq, HTTPStatusCode& status);
30
31 /** Start HTTP REST subsystem.
32 * Precondition; HTTP and RPC has been started.
33 */
34 void StartREST(const std::any& context);
35 /** Interrupt RPC REST subsystem.
36 */
37 void InterruptREST();
38 /** Stop HTTP REST subsystem.
39 * Precondition; HTTP and RPC has been stopped.
40 */
41 void StopREST();
42
43 #endif // BITCOIN_HTTPRPC_H
44