Browse Source

Merge pull request #5324

72fb3d2 Update comments in src/rpc* to be doxygen compatible (Michael Ford)
0.10
Wladimir J. van der Laan 10 years ago
parent
commit
cf9c4887f1
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 6
      src/rpcblockchain.cpp
  2. 10
      src/rpcclient.cpp
  3. 4
      src/rpcclient.h
  4. 2
      src/rpcdump.cpp
  5. 12
      src/rpcmining.cpp
  6. 10
      src/rpcmisc.cpp
  7. 2
      src/rpcnet.cpp
  8. 34
      src/rpcprotocol.cpp
  9. 72
      src/rpcprotocol.h
  10. 2
      src/rpcrawtransaction.cpp
  11. 7
      src/rpcserver.h
  12. 2
      src/rpcwallet.cpp

6
src/rpcblockchain.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 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 "checkpoints.h" #include "checkpoints.h"
@ -468,7 +468,7 @@ Value getblockchaininfo(const Array& params, bool fHelp)
return obj; return obj;
} }
/* Comparison function for sorting the getchaintips heads. */ /** Comparison function for sorting the getchaintips heads. */
struct CompareBlocksByHeight struct CompareBlocksByHeight
{ {
bool operator()(const CBlockIndex* a, const CBlockIndex* b) const bool operator()(const CBlockIndex* a, const CBlockIndex* b) const

10
src/rpcclient.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 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 "rpcclient.h" #include "rpcclient.h"
@ -18,8 +18,8 @@ using namespace json_spirit;
class CRPCConvertParam class CRPCConvertParam
{ {
public: public:
std::string methodName; // method whose params want conversion std::string methodName; //! method whose params want conversion
int paramIdx; // 0-based idx of param to convert int paramIdx; //! 0-based idx of param to convert
}; };
static const CRPCConvertParam vRPCConvertParams[] = static const CRPCConvertParam vRPCConvertParams[] =
@ -116,7 +116,7 @@ CRPCConvertTable::CRPCConvertTable()
static CRPCConvertTable rpcCvtTable; static CRPCConvertTable rpcCvtTable;
// Convert strings to command-specific RPC representation /** Convert strings to command-specific RPC representation */
Array RPCConvertValues(const std::string &strMethod, const std::vector<std::string> &strParams) Array RPCConvertValues(const std::string &strMethod, const std::vector<std::string> &strParams)
{ {
Array params; Array params;

4
src/rpcclient.h

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 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 BITCOIN_RPCCLIENT_H #ifndef BITCOIN_RPCCLIENT_H

2
src/rpcdump.cpp

@ -1,5 +1,5 @@
// 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 "base58.h" #include "base58.h"

12
src/rpcmining.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 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 "amount.h" #include "amount.h"
@ -28,9 +28,11 @@
using namespace json_spirit; using namespace json_spirit;
using namespace std; using namespace std;
// Return average network hashes per second based on the last 'lookup' blocks, /**
// or from the last difficulty change if 'lookup' is nonpositive. * Return average network hashes per second based on the last 'lookup' blocks,
// If 'height' is nonnegative, compute the estimate at the time when a given block was found. * or from the last difficulty change if 'lookup' is nonpositive.
* If 'height' is nonnegative, compute the estimate at the time when a given block was found.
*/
Value GetNetworkHashPS(int lookup, int height) { Value GetNetworkHashPS(int lookup, int height) {
CBlockIndex *pb = chainActive.Tip(); CBlockIndex *pb = chainActive.Tip();

10
src/rpcmisc.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 "base58.h" #include "base58.h"
@ -30,7 +30,7 @@ using namespace std;
/** /**
* @note Do not add or change anything in the information returned by this * @note Do not add or change anything in the information returned by this
* method. `getinfo` exists for backwards-compatibilty only. It combines * method. `getinfo` exists for backwards-compatibility only. It combines
* information from wildly different sources in the program, which is a mess, * information from wildly different sources in the program, which is a mess,
* and is thus planned to be deprecated eventually. * and is thus planned to be deprecated eventually.
* *
@ -198,9 +198,9 @@ Value validateaddress(const Array& params, bool fHelp)
return ret; return ret;
} }
// /**
// Used by addmultisigaddress / createmultisig: * Used by addmultisigaddress / createmultisig:
// */
CScript _createmultisig_redeemScript(const Array& params) CScript _createmultisig_redeemScript(const Array& params)
{ {
int nRequired = params[0].get_int(); int nRequired = params[0].get_int();

2
src/rpcnet.cpp

@ -1,5 +1,5 @@
// 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
src/rpcprotocol.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 "rpcprotocol.h" #include "rpcprotocol.h"
@ -30,15 +30,15 @@ using namespace boost;
using namespace boost::asio; using namespace boost::asio;
using namespace json_spirit; using namespace json_spirit;
// Number of bytes to allocate and read at most at once in post data //! Number of bytes to allocate and read at most at once in post data
const size_t POST_READ_SIZE = 256 * 1024; const size_t POST_READ_SIZE = 256 * 1024;
// /**
// HTTP protocol * HTTP protocol
// *
// This ain't Apache. We're just using HTTP header for the length field * This ain't Apache. We're just using HTTP header for the length field
// and to be compatible with other JSON-RPC implementations. * and to be compatible with other JSON-RPC implementations.
// */
string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeaders) string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeaders)
{ {
@ -246,15 +246,15 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
return HTTP_OK; return HTTP_OK;
} }
// /**
// JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility, * JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility,
// but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were * but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were
// unspecified (HTTP errors and contents of 'error'). * unspecified (HTTP errors and contents of 'error').
// *
// 1.0 spec: http://json-rpc.org/wiki/specification * 1.0 spec: http://json-rpc.org/wiki/specification
// 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html * 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html
// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx * http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
// */
string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id) string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id)
{ {

72
src/rpcprotocol.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 BITCOIN_RPCPROTOCOL_H #ifndef BITCOIN_RPCPROTOCOL_H
@ -19,7 +19,7 @@
#include "json/json_spirit_utils.h" #include "json/json_spirit_utils.h"
#include "json/json_spirit_writer_template.h" #include "json/json_spirit_writer_template.h"
// HTTP status codes //! HTTP status codes
enum HTTPStatusCode enum HTTPStatusCode
{ {
HTTP_OK = 200, HTTP_OK = 200,
@ -30,56 +30,56 @@ enum HTTPStatusCode
HTTP_INTERNAL_SERVER_ERROR = 500, HTTP_INTERNAL_SERVER_ERROR = 500,
}; };
// Bitcoin RPC error codes //! Bitcoin RPC error codes
enum RPCErrorCode enum RPCErrorCode
{ {
// Standard JSON-RPC 2.0 errors //! Standard JSON-RPC 2.0 errors
RPC_INVALID_REQUEST = -32600, RPC_INVALID_REQUEST = -32600,
RPC_METHOD_NOT_FOUND = -32601, RPC_METHOD_NOT_FOUND = -32601,
RPC_INVALID_PARAMS = -32602, RPC_INVALID_PARAMS = -32602,
RPC_INTERNAL_ERROR = -32603, RPC_INTERNAL_ERROR = -32603,
RPC_PARSE_ERROR = -32700, RPC_PARSE_ERROR = -32700,
// General application defined errors //! General application defined errors
RPC_MISC_ERROR = -1, // std::exception thrown in command handling RPC_MISC_ERROR = -1, //! std::exception thrown in command handling
RPC_FORBIDDEN_BY_SAFE_MODE = -2, // Server is in safe mode, and command is not allowed in safe mode RPC_FORBIDDEN_BY_SAFE_MODE = -2, //! Server is in safe mode, and command is not allowed in safe mode
RPC_TYPE_ERROR = -3, // Unexpected type was passed as parameter RPC_TYPE_ERROR = -3, //! Unexpected type was passed as parameter
RPC_INVALID_ADDRESS_OR_KEY = -5, // Invalid address or key RPC_INVALID_ADDRESS_OR_KEY = -5, //! Invalid address or key
RPC_OUT_OF_MEMORY = -7, // Ran out of memory during operation RPC_OUT_OF_MEMORY = -7, //! Ran out of memory during operation
RPC_INVALID_PARAMETER = -8, // Invalid, missing or duplicate parameter RPC_INVALID_PARAMETER = -8, //! Invalid, missing or duplicate parameter
RPC_DATABASE_ERROR = -20, // Database error RPC_DATABASE_ERROR = -20, //! Database error
RPC_DESERIALIZATION_ERROR = -22, // Error parsing or validating structure in raw format RPC_DESERIALIZATION_ERROR = -22, //! Error parsing or validating structure in raw format
RPC_VERIFY_ERROR = -25, // General error during transaction or block submission RPC_VERIFY_ERROR = -25, //! General error during transaction or block submission
RPC_VERIFY_REJECTED = -26, // Transaction or block was rejected by network rules RPC_VERIFY_REJECTED = -26, //! Transaction or block was rejected by network rules
RPC_VERIFY_ALREADY_IN_CHAIN = -27, // Transaction already in chain RPC_VERIFY_ALREADY_IN_CHAIN = -27, //! Transaction already in chain
RPC_IN_WARMUP = -28, // Client still warming up RPC_IN_WARMUP = -28, //! Client still warming up
// Aliases for backward compatibility //! Aliases for backward compatibility
RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR, RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR,
RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED, RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED,
RPC_TRANSACTION_ALREADY_IN_CHAIN= RPC_VERIFY_ALREADY_IN_CHAIN, RPC_TRANSACTION_ALREADY_IN_CHAIN= RPC_VERIFY_ALREADY_IN_CHAIN,
// P2P client errors //! P2P client errors
RPC_CLIENT_NOT_CONNECTED = -9, // Bitcoin is not connected RPC_CLIENT_NOT_CONNECTED = -9, //! Bitcoin is not connected
RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, // Still downloading initial blocks RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks
RPC_CLIENT_NODE_ALREADY_ADDED = -23, // Node is already added RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added
RPC_CLIENT_NODE_NOT_ADDED = -24, // Node has not been added before RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before
// Wallet errors //! Wallet errors
RPC_WALLET_ERROR = -4, // Unspecified problem with wallet (key not found etc.) RPC_WALLET_ERROR = -4, //! Unspecified problem with wallet (key not found etc.)
RPC_WALLET_INSUFFICIENT_FUNDS = -6, // Not enough funds in wallet or account RPC_WALLET_INSUFFICIENT_FUNDS = -6, //! Not enough funds in wallet or account
RPC_WALLET_INVALID_ACCOUNT_NAME = -11, // Invalid account name RPC_WALLET_INVALID_ACCOUNT_NAME = -11, //! Invalid account name
RPC_WALLET_KEYPOOL_RAN_OUT = -12, // Keypool ran out, call keypoolrefill first RPC_WALLET_KEYPOOL_RAN_OUT = -12, //! Keypool ran out, call keypoolrefill first
RPC_WALLET_UNLOCK_NEEDED = -13, // Enter the wallet passphrase with walletpassphrase first RPC_WALLET_UNLOCK_NEEDED = -13, //! Enter the wallet passphrase with walletpassphrase first
RPC_WALLET_PASSPHRASE_INCORRECT = -14, // The wallet passphrase entered was incorrect RPC_WALLET_PASSPHRASE_INCORRECT = -14, //! The wallet passphrase entered was incorrect
RPC_WALLET_WRONG_ENC_STATE = -15, // Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.) RPC_WALLET_WRONG_ENC_STATE = -15, //! Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.)
RPC_WALLET_ENCRYPTION_FAILED = -16, // Failed to encrypt the wallet RPC_WALLET_ENCRYPTION_FAILED = -16, //! Failed to encrypt the wallet
RPC_WALLET_ALREADY_UNLOCKED = -17, // Wallet is already unlocked RPC_WALLET_ALREADY_UNLOCKED = -17, //! Wallet is already unlocked
}; };
// /**
// IOStream device that speaks SSL but can also speak non-SSL * IOStream device that speaks SSL but can also speak non-SSL
// */
template <typename Protocol> template <typename Protocol>
class SSLIOStreamDevice : public boost::iostreams::device<boost::iostreams::bidirectional> { class SSLIOStreamDevice : public boost::iostreams::device<boost::iostreams::bidirectional> {
public: public:

2
src/rpcrawtransaction.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 "base58.h" #include "base58.h"

7
src/rpcserver.h

@ -40,12 +40,13 @@ void StartRPCThreads();
* 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.
*/ */
void StartDummyRPCThread(); void StartDummyRPCThread();
/* Stop RPC threads */ /** Stop RPC threads */
void StopRPCThreads(); void StopRPCThreads();
/* Query whether RPC is running */ /** Query whether RPC is running */
bool IsRPCRunning(); bool IsRPCRunning();
/* Set the RPC warmup status. When this is done, all RPC calls will error out /**
* Set the RPC warmup status. When this is done, all RPC calls will error out
* immediately with RPC_IN_WARMUP. * immediately with RPC_IN_WARMUP.
*/ */
void SetRPCWarmupStatus(const std::string& newStatus); void SetRPCWarmupStatus(const std::string& newStatus);

2
src/rpcwallet.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 "amount.h" #include "amount.h"

Loading…
Cancel
Save