Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
JoelKatz
2012-06-09 19:12:20 -07:00
3 changed files with 449 additions and 535 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,54 @@
class RPCServer : public boost::enable_shared_from_this<RPCServer>
{
public:
enum {
rpcSUCCESS,
// Networking
rpcNO_NETWORK,
rpcNO_CLOSED,
rpcNO_CURRENT,
// Ledger state
rpcINSUF_FUNDS,
rpcPASSWD_CHANGED,
rpcSRC_MISSING,
rpcSRC_UNCLAIMED,
rpcWRONG_SEED,
rpcNICKNAME_MISSING,
// Malformed command
rpcINVALID_PARAMS,
rpcUNKNOWN_COMMAND,
// Bad paramater
rpcBAD_SEED,
rpcSRC_ACT_MALFORMED,
rpcDST_ACT_MALFORMED,
rpcPUBLIC_MALFORMED,
rpcHOST_IP_MALFORMED,
rpcSRC_AMT_MALFORMED,
rpcDST_AMT_MALFORMED,
rpcNICKNAME_MALFORMED,
rpcNICKNAME_PERM,
// Internal error (should never happen)
rpcINTERNAL, // Generic internal error.
rpcNO_GEN_DECRPYT,
rpcNOT_IMPL,
};
Json::Value RPCError(int iError);
private:
typedef Json::Value (RPCServer::*doFuncPtr)(Json::Value &params);
enum {
optNetwork = 1, // Need network
optCurrent = 2+optNetwork, // Need current ledger
optClosed = 4+optNetwork, // Need closed ledger
};
NetworkOPs* mNetOps;
boost::asio::ip::tcp::socket mSocket;
@@ -52,6 +99,7 @@ private:
Json::Value doAccountInfo(Json::Value& params);
Json::Value doAccountLines(Json::Value &params);
Json::Value doAccountMessageSet(Json::Value &params);
Json::Value doAccountTransactions(Json::Value& params);
Json::Value doAccountWalletSet(Json::Value &params);
Json::Value doConnect(Json::Value& params);
Json::Value doCreditSet(Json::Value& params);
@@ -91,8 +139,6 @@ private:
Json::Value doWalletUnlock(Json::Value& params);
Json::Value doWalletVerify(Json::Value& params);
Json::Value doAccountTransactions(Json::Value& params);
void validatorsResponse(const boost::system::error_code& err, std::string strResponse);
public:

View File

@@ -9,7 +9,8 @@
#include "types.h"
#define nothing() do {} while (0)
#define fallthru() do {} while (0)
#define fallthru() do {} while (0)
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
#ifndef MAX
#define MAX(x,y) ((x) < (y) ? (y) : (x))