#include "net.h"
#include "init.h"
#include "ui_interface.h"
+#include "bitcoinrpc.h"
#undef printf
#include <boost/asio.hpp>
#include <boost/filesystem/fstream.hpp>
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
-#include "json/json_spirit_reader_template.h"
-#include "json/json_spirit_writer_template.h"
-#include "json/json_spirit_utils.h"
#define printf OutputDebugStringF
// MinGW 3.4.5 gets "fatal error: had to relocate PCH" if the json headers are
// precompiled in headers.h. The problem might be when the pch file goes over
using namespace json_spirit;
void ThreadRPCServer2(void* parg);
-typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
-
-class CRPCCommand
-{
-public:
- string name;
- rpcfn_type actor;
- bool okSafeMode;
-};
-
-class CRPCTable
-{
-private:
- map<string, const CRPCCommand*> mapCommands;
-public:
- CRPCTable();
- const CRPCCommand* operator[](string name) const;
- string help(string name) const;
-};
-
-const CRPCTable tableRPC;
static std::string strRPCUserColonPass;
//
-static CRPCCommand vRPCCommands[] =
+static const CRPCCommand vRPCCommands[] =
{ // name function safe mode?
// ------------------------ ----------------------- ----------
{ "help", &help, true },
unsigned int vcidx;
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++)
{
- CRPCCommand *pcmd;
+ const CRPCCommand *pcmd;
pcmd = &vRPCCommands[vcidx];
mapCommands[pcmd->name] = pcmd;
return 0;
}
#endif
+
+const CRPCTable tableRPC;
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
+#ifndef _BITCOINRPC_H_
+#define _BITCOINRPC_H_ 1
+
+#include <string>
+#include <map>
+
+#include "json/json_spirit_reader_template.h"
+#include "json/json_spirit_writer_template.h"
+#include "json/json_spirit_utils.h"
+
void ThreadRPCServer(void* parg);
int CommandLineRPC(int argc, char *argv[]);
+
+typedef json_spirit::Value(*rpcfn_type)(const json_spirit::Array& params, bool fHelp);
+
+class CRPCCommand
+{
+public:
+ std::string name;
+ rpcfn_type actor;
+ bool okSafeMode;
+};
+
+class CRPCTable
+{
+private:
+ std::map<std::string, const CRPCCommand*> mapCommands;
+public:
+ CRPCTable();
+ const CRPCCommand* operator[](std::string name) const;
+ std::string help(std::string name) const;
+};
+
+extern const CRPCTable tableRPC;
+
+#endif
#include "base58.h"
#include "util.h"
-#include "json/json_spirit_reader_template.h"
-#include "json/json_spirit_writer_template.h"
-#include "json/json_spirit_utils.h"
+#include "bitcoinrpc.h"
using namespace std;
using namespace json_spirit;
-typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
-extern map<string, rpcfn_type> mapCallTable;
-
BOOST_AUTO_TEST_SUITE(rpc_tests)
static Array
BOOST_FIXTURE_TEST_CASE(rpc_addmultisig, TestNetFixture)
{
- rpcfn_type addmultisig = mapCallTable["addmultisigaddress"];
+ rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor;
// old, 65-byte-long:
const char* address1Hex = "0434e3e09f49ea168c5bbf53f877ff4206923858aab7c7e1df25bc263978107c95e35065a27ef6f1b27222db0ec97e0e895eaca603d3ee0d4c060ce3d8a00286c8";