diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj
index 1c860a8a93..6c9d3b6efd 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj
+++ b/Builds/VisualStudio2012/RippleD.vcxproj
@@ -84,7 +84,19 @@
true
-
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
true
true
true
@@ -1562,7 +1574,10 @@
-
+
+
+
+
diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters
index 7ed0294ccd..cf499ed920 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters
@@ -211,6 +211,9 @@
{386ebc1c-0cbe-43a6-b48e-ac3c503da0ee}
+
+ {95c93134-7e8d-47ec-9649-4a8d5d97ce12}
+
@@ -993,9 +996,6 @@
[1] Ripple\rpc
-
- [1] Ripple\rpc\api
-
[1] Ripple\http
@@ -1020,6 +1020,15 @@
[1] Ripple\http\impl
+
+ [1] Ripple\rpc\impl
+
+
+ [1] Ripple\rpc\impl
+
+
+ [1] Ripple\rpc\impl
+
@@ -1980,9 +1989,6 @@
[1] Ripple\rpc
-
- [1] Ripple\rpc\api
-
[1] Ripple\http
@@ -2016,6 +2022,18 @@
[1] Ripple\http\impl
+
+ [1] Ripple\rpc\api
+
+
+ [1] Ripple\rpc\api
+
+
+ [1] Ripple\rpc\api
+
+
+ [1] Ripple\rpc\impl
+
diff --git a/src/BeastConfig.h b/src/BeastConfig.h
index 576b16cefe..7cf102fe55 100644
--- a/src/BeastConfig.h
+++ b/src/BeastConfig.h
@@ -174,7 +174,7 @@
#endif
// Here temporarily
-// Controls whether or not the new RPCService::Manager logic will be
+// Controls whether or not the new RPC::Manager logic will be
// used to invoke RPC commands before they pass to the original code.
#ifndef RIPPLE_USE_RPC_SERVICE_MANAGER
#define RIPPLE_USE_RPC_SERVICE_MANAGER 0
diff --git a/src/ripple/rpc/api/Handler.h b/src/ripple/rpc/api/Handler.h
new file mode 100644
index 0000000000..00da71a7a1
--- /dev/null
+++ b/src/ripple/rpc/api/Handler.h
@@ -0,0 +1,52 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+#ifndef RIPPLE_RPC_HANDLER_H_INCLUDED
+#define RIPPLE_RPC_HANDLER_H_INCLUDED
+
+#include
+
+namespace ripple {
+using namespace beast;
+
+namespace RPC {
+
+/** An invokable handler for a particular RPC method. */
+class Handler
+{
+public:
+ /** Create a handler with the specified method and function. */
+ template // allocator
+ Handler (std::string const& method_, Function function)
+ : m_method (method_)
+ , m_function (function)
+ {
+ }
+
+ Handler (Handler const& other);
+ Handler& operator= (Handler const& other);
+
+ /** Returns the method called when this handler is invoked. */
+ std::string const& method() const;
+
+ /** Synchronously invoke the method on the associated service.
+ Thread safety:
+ Determined by the owner.
+ */
+ Json::Value operator() (Json::Value const& args) const;
+
+private:
+ std::string m_method;
+ SharedFunction m_function;
+};
+
+/** The type of container that holds a set of Handler objects. */
+typedef std::vector Handlers;
+
+}
+}
+
+#endif
diff --git a/src/ripple/rpc/api/Manager.h b/src/ripple/rpc/api/Manager.h
new file mode 100644
index 0000000000..15ac079770
--- /dev/null
+++ b/src/ripple/rpc/api/Manager.h
@@ -0,0 +1,65 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+#ifndef RIPPLE_RPC_MANAGER_H_INCLUDED
+#define RIPPLE_RPC_MANAGER_H_INCLUDED
+
+#include "../../../beast/beast/utility/Journal.h"
+
+#include "Handler.h"
+#include "Service.h"
+
+namespace ripple {
+using namespace beast;
+
+namespace RPC {
+
+/** Manages a collection of Service interface objects. */
+class Manager
+{
+public:
+ static Manager* New (Journal journal);
+
+ virtual ~Manager() { }
+
+ /** Add a service.
+ The list of commands that the service handles is enumerated and
+ added to the manager's dispatch table.
+ Thread safety:
+ Safe to call from any thread.
+ May only be called once for a given service.
+ */
+ virtual void add (Service& service) = 0;
+
+ /** Add a subclass of Service and return the original pointer.
+ This is provided as a convenient so that RPCService objects may
+ be added from ctor-initializer lists.
+ */
+ template
+ Derived* add (Derived* derived)
+ {
+ add (*(static_cast (derived)));
+ return derived;
+ }
+
+ /** Execute an RPC command synchronously.
+ On return, if result.first == `true` then result.second will
+ have the Json return value from the call of the handler.
+ */
+ virtual std::pair call (
+ std::string const& method, Json::Value const& args) = 0;
+
+ /** Returns the Handler for the specified method, or nullptr.
+ Thread safety:
+ Safe to call from any threads.
+ */
+ virtual Handler const* find (std::string const& method) = 0;
+};
+
+}
+}
+
+#endif
diff --git a/src/ripple/rpc/api/RPCService.h b/src/ripple/rpc/api/RPCService.h
deleted file mode 100644
index c227f71c71..0000000000
--- a/src/ripple/rpc/api/RPCService.h
+++ /dev/null
@@ -1,152 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- Copyright (c) 2011-2013, OpenCoin, Inc.
-*/
-//==============================================================================
-
-#ifndef RIPPLE_FRAME_RPCSERVICE_H_INCLUDED
-#define RIPPLE_FRAME_RPCSERVICE_H_INCLUDED
-
-#include "../../../beast/beast/utility/Journal.h"
-
-namespace ripple
-{
-
-using namespace beast;
-
-/** Interface for abstacting RPC commands processing. */
-class RPCService : public Uncopyable
-{
-public:
- //--------------------------------------------------------------------------
-
- /** An invokable handler for a particular method. */
- class Handler
- {
- public:
- /** Create a handler with the specified method and function. */
- template // allocator
- Handler (std::string const& method_, Function function)
- : m_method (method_)
- , m_function (function)
- {
- }
-
- Handler (Handler const& other)
- : m_method (other.m_method)
- , m_function (other.m_function)
- {
- }
-
- Handler& operator= (Handler const& other)
- {
- m_method = other.m_method;
- m_function = other.m_function;
- return *this;
- }
-
- /** Returns the method called when this handler is invoked. */
- std::string const& method() const
- {
- return m_method;
- }
-
- /** Synchronously invoke the method on the associated service.
- Thread safety:
- Determined by the owner.
- */
- Json::Value operator() (Json::Value const& args) const
- {
- return m_function (args);
- }
-
- private:
- std::string m_method;
- SharedFunction m_function;
- };
-
- //--------------------------------------------------------------------------
-
- /** Manages a collection of RPCService interface objects. */
- class Manager
- {
- public:
- static Manager* New (Journal journal);
-
- virtual ~Manager() { }
-
- /** Add a service.
- The list of commands that the service handles is enumerated and
- added to the manager's dispatch table.
- Thread safety:
- Safe to call from any thread.
- May only be called once for a given service.
- */
- virtual void add (RPCService& service) = 0;
-
- /** Add a subclass of RPCService and return the original pointer.
- This is provided as a convenient so that RPCService objects may
- be added from ctor-initializer lists.
- */
- template
- Derived* add (Derived* derived)
- {
- add (*(static_cast (derived)));
- return derived;
- }
-
- /** Execute an RPC command synchronously.
- On return, if result.first == `true` then result.second will
- have the Json return value from the call of the handler.
- */
- virtual std::pair call (
- std::string const& method, Json::Value const& args) = 0;
-
- /** Returns the Handler for the specified method, or nullptr.
- Thread safety:
- Safe to call from any threads.
- */
- virtual Handler const* find (std::string const& method) = 0;
- };
-
- //--------------------------------------------------------------------------
-public:
- typedef std::vector Handlers;
-
- /** Create the service.
- Derived classes will usually call add() repeatedly from their
- constructor to fill in the list of handlers prior to Manager::add.
- */
- RPCService ();
-
- virtual ~RPCService ();
-
- /** Returns the handlers associated with this service. */
- Handlers const& handlers() const
- {
- return m_handlers;
- }
-
- /** Add a handler for the specified method.
- Adding a handler after the service is already associated with a
- Manager results in undefined behavior.
- Thread safety:
- May not be called concurrently.
- */
- template
- void addRPCHandler (std::string const& method, Function function)
- {
- m_handlers.push_back (Handler (method, function));
- }
-
-private:
- class ManagerImp;
-
- Handlers m_handlers;
-};
-
-//------------------------------------------------------------------------------
-
-}
-
-#endif
diff --git a/src/ripple/rpc/api/Service.h b/src/ripple/rpc/api/Service.h
new file mode 100644
index 0000000000..80fa32568c
--- /dev/null
+++ b/src/ripple/rpc/api/Service.h
@@ -0,0 +1,49 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+#ifndef RIPPLE_RPC_SERVCE_H_INCLUDED
+#define RIPPLE_RPC_SERVCE_H_INCLUDED
+
+#include "Handler.h"
+
+namespace ripple {
+namespace RPC {
+
+/** Interface for abstacting RPC commands processing. */
+class Service : public Uncopyable
+{
+public:
+ /** Create the service.
+ Derived classes will usually call add() repeatedly from their
+ constructor to fill in the list of handlers prior to Manager::add.
+ */
+ Service ();
+
+ virtual ~Service ();
+
+ /** Returns the handlers associated with this service. */
+ Handlers const& handlers() const;
+
+ /** Add a handler for the specified method.
+ Adding a handler after the service is already associated with a
+ Manager results in undefined behavior.
+ Thread safety:
+ May not be called concurrently.
+ */
+ template
+ void addRPCHandler (std::string const& method, Function function)
+ {
+ m_handlers.push_back (Handler (method, function));
+ }
+
+private:
+ Handlers m_handlers;
+};
+
+}
+}
+
+#endif
diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp
new file mode 100644
index 0000000000..79bbcd4477
--- /dev/null
+++ b/src/ripple/rpc/impl/Handler.cpp
@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+namespace ripple {
+namespace RPC {
+
+Handler::Handler (Handler const& other)
+ : m_method (other.m_method)
+ , m_function (other.m_function)
+{
+}
+
+Handler& Handler::operator= (Handler const& other)
+{
+ m_method = other.m_method;
+ m_function = other.m_function;
+ return *this;
+}
+
+std::string const& Handler::method() const
+{
+ return m_method;
+}
+
+Json::Value Handler::operator() (Json::Value const& args) const
+{
+ return m_function (args);
+}
+
+}
+}
diff --git a/src/ripple/rpc/impl/Manager.cpp b/src/ripple/rpc/impl/Manager.cpp
new file mode 100644
index 0000000000..206af9b1a1
--- /dev/null
+++ b/src/ripple/rpc/impl/Manager.cpp
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+namespace ripple {
+namespace RPC {
+
+Manager* Manager::New (Journal journal)
+{
+ return new ManagerImpl (journal);
+}
+
+}
+}
diff --git a/src/ripple/rpc/api/RPCService.cpp b/src/ripple/rpc/impl/ManagerImpl.h
similarity index 76%
rename from src/ripple/rpc/api/RPCService.cpp
rename to src/ripple/rpc/impl/ManagerImpl.h
index df053ff185..8502d83efe 100644
--- a/src/ripple/rpc/api/RPCService.cpp
+++ b/src/ripple/rpc/impl/ManagerImpl.h
@@ -4,10 +4,13 @@
*/
//==============================================================================
-namespace ripple
-{
+#ifndef RIPPLE_RPC_MANAGERIMPL_H_INCLUDED
+#define RIPPLE_RPC_MANAGERIMPL_H_INCLUDED
-class RPCService::ManagerImp : public RPCService::Manager
+namespace ripple {
+namespace RPC {
+
+class ManagerImpl : public Manager
{
public:
// The type of map we use to look up by function name.
@@ -16,18 +19,18 @@ public:
//--------------------------------------------------------------------------
- explicit ManagerImp (Journal journal)
+ explicit ManagerImpl (Journal journal)
: m_journal (journal)
{
}
- ~ManagerImp()
+ ~ManagerImpl()
{
}
- void add (RPCService& service)
+ void add (Service& service)
{
- Handlers const& handlers (service.m_handlers);
+ Handlers const& handlers (service.handlers());
SharedState::Access state (m_state);
@@ -76,21 +79,7 @@ private:
SharedState m_state;
};
-//------------------------------------------------------------------------------
-
-RPCService::Manager* RPCService::Manager::New (Journal journal)
-{
- return new RPCService::ManagerImp (journal);
+}
}
-//------------------------------------------------------------------------------
-
-RPCService::RPCService ()
-{
-}
-
-RPCService::~RPCService ()
-{
-}
-
-}
+#endif
diff --git a/src/ripple/rpc/impl/Service.cpp b/src/ripple/rpc/impl/Service.cpp
new file mode 100644
index 0000000000..95135dc8f3
--- /dev/null
+++ b/src/ripple/rpc/impl/Service.cpp
@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+namespace ripple {
+namespace RPC {
+
+Service::Service ()
+{
+}
+
+Service::~Service ()
+{
+}
+
+Handlers const& Service::handlers() const
+{
+ return m_handlers;
+}
+
+}
+}
diff --git a/src/ripple/rpc/ripple_rpc.cpp b/src/ripple/rpc/ripple_rpc.cpp
index 4b838c37ac..f0772f66d8 100644
--- a/src/ripple/rpc/ripple_rpc.cpp
+++ b/src/ripple/rpc/ripple_rpc.cpp
@@ -11,4 +11,7 @@
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
#include
-#include "api/RPCService.cpp"
+# include "impl/ManagerImpl.h"
+#include "impl/Manager.cpp"
+#include "impl/Handler.cpp"
+#include "impl/Service.cpp"
diff --git a/src/ripple/rpc/ripple_rpc.h b/src/ripple/rpc/ripple_rpc.h
index 2e1033795f..419432b054 100644
--- a/src/ripple/rpc/ripple_rpc.h
+++ b/src/ripple/rpc/ripple_rpc.h
@@ -11,6 +11,8 @@
#include "../json/ripple_json.h"
-#include "api/RPCService.h"
+# include "api/Handler.h"
+# include "api/Service.h"
+#include "api/Manager.h"
#endif
diff --git a/src/ripple/validators/api/Manager.h b/src/ripple/validators/api/Manager.h
index 7a5618dc32..9df6d74e82 100644
--- a/src/ripple/validators/api/Manager.h
+++ b/src/ripple/validators/api/Manager.h
@@ -17,7 +17,7 @@ namespace Validators
All operations are performed asynchronously on an internal thread.
*/
-class Manager : public RPCService
+class Manager : public RPC::Service
{
public:
/** Create a new Manager object.
diff --git a/src/ripple/validators/impl/Manager.cpp b/src/ripple/validators/impl/Manager.cpp
index 7daad67fc7..0c3e240d50 100644
--- a/src/ripple/validators/impl/Manager.cpp
+++ b/src/ripple/validators/impl/Manager.cpp
@@ -125,7 +125,7 @@ public:
//--------------------------------------------------------------------------
//
- // RPCService
+ // RPC::Service
//
Json::Value rpcPrint (Json::Value const& args)
diff --git a/src/ripple_app/main/Application.cpp b/src/ripple_app/main/Application.cpp
index 9785910e26..8dc5268e24 100644
--- a/src/ripple_app/main/Application.cpp
+++ b/src/ripple_app/main/Application.cpp
@@ -56,7 +56,7 @@ public:
, m_tempNodeCache ("NodeCache", 16384, 90)
, m_sleCache ("LedgerEntryCache", 4096, 120)
- , m_rpcServiceManager (RPCService::Manager::New (
+ , m_rpcServiceManager (RPC::Manager::New (
LogJournal::get ()))
// The JobQueue has to come pretty early since
@@ -173,7 +173,7 @@ public:
//--------------------------------------------------------------------------
- RPCService::Manager& getRPCServiceManager()
+ RPC::Manager& getRPCServiceManager()
{
return *m_rpcServiceManager;
}
@@ -800,7 +800,7 @@ private:
LocalCredentials m_localCredentials;
TransactionMaster m_txMaster;
- ScopedPointer m_rpcServiceManager;
+ ScopedPointer m_rpcServiceManager;
// These are Stoppable-related
ScopedPointer m_jobQueue;
diff --git a/src/ripple_app/main/Application.h b/src/ripple_app/main/Application.h
index 6249521b7b..2ae5c1bcad 100644
--- a/src/ripple_app/main/Application.h
+++ b/src/ripple_app/main/Application.h
@@ -76,7 +76,7 @@ public:
virtual boost::asio::io_service& getIOService () = 0;
- virtual RPCService::Manager& getRPCServiceManager() = 0;
+ virtual RPC::Manager& getRPCServiceManager() = 0;
virtual NodeCache& getTempNodeCache () = 0;
virtual SLECache& getSLECache () = 0;
virtual Validators::Manager& getValidators () = 0;
diff --git a/src/ripple_net/rpc/RPCUtil.cpp b/src/ripple_net/rpc/RPCUtil.cpp
index 042e4e67d0..56e6e8eaff 100644
--- a/src/ripple_net/rpc/RPCUtil.cpp
+++ b/src/ripple_net/rpc/RPCUtil.cpp
@@ -5,9 +5,9 @@
//==============================================================================
// Used for logging
-struct RPC;
+struct RPCLog;
-SETUP_LOG (RPC)
+SETUP_LOGN (RPCLog, "RPC")
unsigned int const gMaxHTTPHeaderSize = 0x02000000;
@@ -75,7 +75,7 @@ std::string rfc1123Time ()
std::string HTTPReply (int nStatus, const std::string& strMsg)
{
- WriteLog (lsTRACE, RPC) << "HTTP Reply " << nStatus << " " << strMsg;
+ WriteLog (lsTRACE, RPCLog) << "HTTP Reply " << nStatus << " " << strMsg;
if (nStatus == 401)
return strprintf ("HTTP/1.0 401 Authorization Required\r\n"