Changeset View
Changeset View
Standalone View
Standalone View
src/httprpc.h
// Copyright (c) 2015 The Bitcoin Core developers | // Copyright (c) 2015 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_HTTPRPC_H | #ifndef BITCOIN_HTTPRPC_H | ||||
#define BITCOIN_HTTPRPC_H | #define BITCOIN_HTTPRPC_H | ||||
#include "httpserver.h" | |||||
#include "rpc/server.h" | |||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
class Config; | class Config; | ||||
class HTTPRequest; | class HTTPRequest; | ||||
class HTTPRPCRequestProcessor { | |||||
private: | |||||
Config &config; | |||||
bool ProcessHTTPRequest(HTTPRequest *request); | |||||
public: | |||||
HTTPRPCRequestProcessor(Config &configIn) : config(configIn) {} | |||||
static bool DelegateHTTPRequest(HTTPRPCRequestProcessor *requestProcessor, | |||||
HTTPRequest *request) { | |||||
return requestProcessor->ProcessHTTPRequest(request); | |||||
} | |||||
}; | |||||
/** | /** | ||||
* Start HTTP RPC subsystem. | * Start HTTP RPC subsystem. | ||||
* Precondition; HTTP and RPC has been started. | * Precondition; HTTP and RPC has been started. | ||||
*/ | */ | ||||
bool StartHTTPRPC(Config &config); | bool StartHTTPRPC(Config &config, | ||||
HTTPRPCRequestProcessor &httpRPCRequestProcessor); | |||||
/** Interrupt HTTP RPC subsystem */ | /** Interrupt HTTP RPC subsystem */ | ||||
void InterruptHTTPRPC(); | void InterruptHTTPRPC(); | ||||
/** | /** | ||||
* Stop HTTP RPC subsystem. | * Stop HTTP RPC subsystem. | ||||
* Precondition; HTTP and RPC has been stopped. | * Precondition; HTTP and RPC has been stopped. | ||||
*/ | */ | ||||
Show All 18 Lines |