Expose CRPCTable via bitcoinrpc.h for testing
[novacoin.git] / src / bitcoinrpc.h
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
5
6 #ifndef _BITCOINRPC_H_
7 #define _BITCOINRPC_H_ 1
8
9 #include <string>
10 #include <map>
11
12 #include "json/json_spirit_reader_template.h"
13 #include "json/json_spirit_writer_template.h"
14 #include "json/json_spirit_utils.h"
15
16 void ThreadRPCServer(void* parg);
17 int CommandLineRPC(int argc, char *argv[]);
18
19 typedef json_spirit::Value(*rpcfn_type)(const json_spirit::Array& params, bool fHelp);
20
21 class CRPCCommand
22 {
23 public:
24     std::string name;
25     rpcfn_type actor;
26     bool okSafeMode;
27 };
28
29 class CRPCTable
30 {
31 private:
32     std::map<std::string, const CRPCCommand*> mapCommands;
33 public:
34     CRPCTable();
35     const CRPCCommand* operator[](std::string name) const;
36     std::string help(std::string name) const;
37 };
38
39 extern const CRPCTable tableRPC;
40
41 #endif