Bitcoin ABC  0.26.3
P2P Digital Currency
httprpc.h
Go to the documentation of this file.
1 // Copyright (c) 2015 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 <httpserver.h>
9 #include <rpc/server.h>
10 
11 #include <any>
12 
13 class Config;
14 
16 private:
19 
20  bool ProcessHTTPRequest(HTTPRequest *request);
21 
22 public:
23  const std::any &context;
24 
25  HTTPRPCRequestProcessor(Config &configIn, RPCServer &rpcServerIn,
26  const std::any &contextIn)
27  : config(configIn), rpcServer(rpcServerIn), context(contextIn) {}
28 
29  static bool DelegateHTTPRequest(HTTPRPCRequestProcessor *requestProcessor,
30  HTTPRequest *request) {
31  return requestProcessor->ProcessHTTPRequest(request);
32  }
33 };
34 
39 bool StartHTTPRPC(HTTPRPCRequestProcessor &httpRPCRequestProcessor);
40 
42 void InterruptHTTPRPC();
43 
48 void StopHTTPRPC();
49 
54 void StartREST(const std::any &context);
55 
57 void InterruptREST();
58 
63 void StopREST();
64 
65 #endif // BITCOIN_HTTPRPC_H
Definition: config.h:17
bool ProcessHTTPRequest(HTTPRequest *request)
Definition: httprpc.cpp:288
const std::any & context
Definition: httprpc.h:23
RPCServer & rpcServer
Definition: httprpc.h:18
HTTPRPCRequestProcessor(Config &configIn, RPCServer &rpcServerIn, const std::any &contextIn)
Definition: httprpc.h:25
static bool DelegateHTTPRequest(HTTPRPCRequestProcessor *requestProcessor, HTTPRequest *request)
Definition: httprpc.h:29
In-flight HTTP request.
Definition: httpserver.h:74
Class for registering and managing all RPC calls.
Definition: server.h:39
void InterruptHTTPRPC()
Interrupt HTTP RPC subsystem.
Definition: httprpc.cpp:470
void StopHTTPRPC()
Stop HTTP RPC subsystem.
Definition: httprpc.cpp:474
void StartREST(const std::any &context)
Start HTTP REST subsystem.
Definition: rest.cpp:836
void StopREST()
Stop HTTP REST subsystem.
Definition: rest.cpp:848
void InterruptREST()
Interrupt RPC REST subsystem.
Definition: rest.cpp:846
bool StartHTTPRPC(HTTPRPCRequestProcessor &httpRPCRequestProcessor)
Start HTTP RPC subsystem.
Definition: httprpc.cpp:449