Browse Source

Merge pull request #5174

7792040 Update comments in rpcserver to be doxygen compatible (Michael Ford)
0.10
Wladimir J. van der Laan 10 years ago
parent
commit
393a28a50c
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 22
      src/rpcserver.cpp
  2. 35
      src/rpcserver.h

22
src/rpcserver.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 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.
#include "rpcserver.h" #include "rpcserver.h"
@ -34,7 +34,7 @@ using namespace std;
static std::string strRPCUserColonPass; static std::string strRPCUserColonPass;
static bool fRPCRunning = false; static bool fRPCRunning = false;
// These are created by StartRPCThreads, destroyed in StopRPCThreads //! These are created by StartRPCThreads, destroyed in StopRPCThreads
static asio::io_service* rpc_io_service = NULL; static asio::io_service* rpc_io_service = NULL;
static map<string, boost::shared_ptr<deadline_timer> > deadlineTimers; static map<string, boost::shared_ptr<deadline_timer> > deadlineTimers;
static ssl::context* rpc_ssl_context = NULL; static ssl::context* rpc_ssl_context = NULL;
@ -134,9 +134,9 @@ vector<unsigned char> ParseHexO(const Object& o, string strKey)
} }
/// /**
/// Note: This interface may still be subject to change. * Note: This interface may still be subject to change.
/// */
string CRPCTable::help(string strCommand) const string CRPCTable::help(string strCommand) const
{ {
@ -232,11 +232,9 @@ Value stop(const Array& params, bool fHelp)
// /**
// Call Table * Call Table
// */
static const CRPCCommand vRPCCommands[] = static const CRPCCommand vRPCCommands[] =
{ // category name actor (function) okSafeMode threadSafe reqWallet { // category name actor (function) okSafeMode threadSafe reqWallet
// --------------------- ------------------------ ----------------------- ---------- ---------- --------- // --------------------- ------------------------ ----------------------- ---------- ---------- ---------
@ -453,7 +451,7 @@ private:
void ServiceConnection(AcceptedConnection *conn); void ServiceConnection(AcceptedConnection *conn);
// Forward declaration required for RPCListen //! Forward declaration required for RPCListen
template <typename Protocol, typename SocketAcceptorService> template <typename Protocol, typename SocketAcceptorService>
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor, static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
ssl::context& context, ssl::context& context,
@ -669,7 +667,7 @@ void StartRPCThreads()
fListening = true; fListening = true;
rpc_acceptors.push_back(acceptor); rpc_acceptors.push_back(acceptor);
// If dual IPv6/IPv4 bind succesful, skip binding to IPv4 separately // If dual IPv6/IPv4 bind successful, skip binding to IPv4 separately
if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error) if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error)
break; break;
} }

35
src/rpcserver.h

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 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 _BITCOINRPC_SERVER_H_ #ifndef _BITCOINRPC_SERVER_H_
@ -32,9 +32,10 @@ public:
virtual void close() = 0; virtual void close() = 0;
}; };
/* Start RPC threads */ /** Start RPC threads */
void StartRPCThreads(); void StartRPCThreads();
/* Alternative to StartRPCThreads for the GUI, when no server is /**
* Alternative to StartRPCThreads for the GUI, when no server is
* used. The RPC thread in this case is only used to handle timeouts. * used. The RPC thread in this case is only used to handle timeouts.
* If real RPC threads have already been started this is a no-op. * If real RPC threads have already been started this is a no-op.
*/ */
@ -44,23 +45,23 @@ void StopRPCThreads();
/* Query whether RPC is running */ /* Query whether RPC is running */
bool IsRPCRunning(); bool IsRPCRunning();
/* /**
Type-check arguments; throws JSONRPCError if wrong type given. Does not check that * Type-check arguments; throws JSONRPCError if wrong type given. Does not check that
the right number of arguments are passed, just that any passed are the correct type. * the right number of arguments are passed, just that any passed are the correct type.
Use like: RPCTypeCheck(params, boost::assign::list_of(str_type)(int_type)(obj_type)); * Use like: RPCTypeCheck(params, boost::assign::list_of(str_type)(int_type)(obj_type));
*/ */
void RPCTypeCheck(const json_spirit::Array& params, void RPCTypeCheck(const json_spirit::Array& params,
const std::list<json_spirit::Value_type>& typesExpected, bool fAllowNull=false); const std::list<json_spirit::Value_type>& typesExpected, bool fAllowNull=false);
/* /**
Check for expected keys/value types in an Object. * Check for expected keys/value types in an Object.
Use like: RPCTypeCheck(object, boost::assign::map_list_of("name", str_type)("value", int_type)); * Use like: RPCTypeCheck(object, boost::assign::map_list_of("name", str_type)("value", int_type));
*/ */
void RPCTypeCheck(const json_spirit::Object& o, void RPCTypeCheck(const json_spirit::Object& o,
const std::map<std::string, json_spirit::Value_type>& typesExpected, bool fAllowNull=false); const std::map<std::string, json_spirit::Value_type>& typesExpected, bool fAllowNull=false);
/* /**
Run func nSeconds from now. Uses boost deadline timers. * Run func nSeconds from now. Uses boost deadline timers.
Overrides previous timer <name> (if any). * Overrides previous timer <name> (if any).
*/ */
void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds); void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds);
@ -104,10 +105,10 @@ public:
extern const CRPCTable tableRPC; extern const CRPCTable tableRPC;
// /**
// Utilities: convert hex-encoded Values * Utilities: convert hex-encoded Values
// (throws error if not hex). * (throws error if not hex).
// */
extern uint256 ParseHashV(const json_spirit::Value& v, std::string strName); extern uint256 ParseHashV(const json_spirit::Value& v, std::string strName);
extern uint256 ParseHashO(const json_spirit::Object& o, std::string strKey); extern uint256 ParseHashO(const json_spirit::Object& o, std::string strKey);
extern std::vector<unsigned char> ParseHexV(const json_spirit::Value& v, std::string strName); extern std::vector<unsigned char> ParseHexV(const json_spirit::Value& v, std::string strName);

Loading…
Cancel
Save