diff --git a/doc/todo/VFALCO_TODO.txt b/doc/todo/VFALCO_TODO.txt index bea40b3b2e..1821d5906f 100644 --- a/doc/todo/VFALCO_TODO.txt +++ b/doc/todo/VFALCO_TODO.txt @@ -22,7 +22,7 @@ David Features: - std::priority_queue for DeadlineTimer -- Change ProxyInfo to use IPAddress, get rid of IPv4Address from the parsing +- Change ProxyInfo to use IP::Endpoint, get rid of IPv4Address from the parsing code - Validators should delay the application of newly downloaded lists from @@ -34,7 +34,7 @@ David Features: - Look into using CMake -- IPv6 support in IPAddress +- IPv6 support in IP::Endpoint - Configuration list for Jenkins diff --git a/src/beast/beast/Net.h b/src/beast/beast/Net.h index 99a348bea5..cd03ad1127 100644 --- a/src/beast/beast/Net.h +++ b/src/beast/beast/Net.h @@ -23,15 +23,9 @@ #include "net/BufferType.h" #include "net/DynamicBuffer.h" -#include "net/IPAddress.h" +#include "net/IPEndpoint.h" #include "net/IPAddressV4.h" #include "net/IPAddressV6.h" #include "net/IPEndpoint.h" -// VFALCO DEPRECATED, REMOVE ASAP! -namespace beast { -typedef IP::Endpoint IPAddress; -} - - #endif diff --git a/src/beast/beast/insight/StatsDCollector.h b/src/beast/beast/insight/StatsDCollector.h index 33a8682066..b5efbbc813 100644 --- a/src/beast/beast/insight/StatsDCollector.h +++ b/src/beast/beast/insight/StatsDCollector.h @@ -22,7 +22,7 @@ #include "Collector.h" -#include "../net/IPAddress.h" +#include "../net/IPEndpoint.h" namespace beast { namespace insight { @@ -39,7 +39,7 @@ public: @param prefix A string pre-pended before each metric name. @param journal Destination for logging output. */ - static std::shared_ptr New (IPAddress const& address, + static std::shared_ptr New (IP::Endpoint const& address, std::string const& prefix, Journal journal); }; diff --git a/src/beast/beast/insight/impl/StatsDCollector.cpp b/src/beast/beast/insight/impl/StatsDCollector.cpp index 9f475a4e2d..4625bc1180 100644 --- a/src/beast/beast/insight/impl/StatsDCollector.cpp +++ b/src/beast/beast/insight/impl/StatsDCollector.cpp @@ -200,7 +200,7 @@ private: typedef SharedData State; Journal m_journal; - IPAddress m_address; + IP::Endpoint m_address; std::string m_prefix; boost::asio::io_service m_io_service; boost::optional m_work; @@ -213,7 +213,7 @@ private: std::thread m_thread; static boost::asio::ip::udp::endpoint to_endpoint ( - IPAddress const &address) + IP::Endpoint const &address) { if (address.is_v4 ()) { @@ -230,7 +230,7 @@ private: public: StatsDCollectorImp ( - IPAddress const& address, + IP::Endpoint const& address, std::string const& prefix, Journal journal) : m_journal (journal) @@ -697,7 +697,7 @@ void StatsDMeterImpl::do_process () //------------------------------------------------------------------------------ std::shared_ptr StatsDCollector::New ( - IPAddress const& address, std::string const& prefix, Journal journal) + IP::Endpoint const& address, std::string const& prefix, Journal journal) { return std::make_shared ( address, prefix, journal); diff --git a/src/beast/beast/net/impl/IPAddress.cpp b/src/beast/beast/net/impl/IPAddress.cpp index c8314019fc..e01e74c8b5 100644 --- a/src/beast/beast/net/impl/IPAddress.cpp +++ b/src/beast/beast/net/impl/IPAddress.cpp @@ -389,7 +389,7 @@ public: testParse ("Parse Endpoint"); } - IPAddressTests () : UnitTest ("IPAddress", "beast") + IPAddressTests () : UnitTest ("IP::Endpoint", "beast") { } }; diff --git a/src/beast/beast/net/impl/IPEndpoint.cpp b/src/beast/beast/net/impl/IPEndpoint.cpp index a5815f8d71..0f6f232534 100644 --- a/src/beast/beast/net/impl/IPEndpoint.cpp +++ b/src/beast/beast/net/impl/IPEndpoint.cpp @@ -17,6 +17,8 @@ */ //============================================================================== +#include "../detail/Parse.h" + namespace beast { namespace IP { diff --git a/src/ripple/common/Resolver.h b/src/ripple/common/Resolver.h index 6bd49cc8ae..78e13d41c1 100644 --- a/src/ripple/common/Resolver.h +++ b/src/ripple/common/Resolver.h @@ -34,7 +34,7 @@ class Resolver public: typedef std::function < void (std::string, - std::vector ) > + std::vector ) > HandlerType; virtual ~Resolver () = 0; diff --git a/src/ripple/common/impl/ResolverAsio.cpp b/src/ripple/common/impl/ResolverAsio.cpp index 9eeacb9dd9..6d93f36cfe 100644 --- a/src/ripple/common/impl/ResolverAsio.cpp +++ b/src/ripple/common/impl/ResolverAsio.cpp @@ -171,7 +171,7 @@ public: if (ec == boost::asio::error::operation_aborted) return; - std::vector addresses; + std::vector addresses; // If we get an error message back, we don't return any // results that we may have gotten. diff --git a/src/ripple/http/api/Port.h b/src/ripple/http/api/Port.h index eff163c2db..432b61c30b 100644 --- a/src/ripple/http/api/Port.h +++ b/src/ripple/http/api/Port.h @@ -38,11 +38,11 @@ struct Port Port (); Port (Port const& other); Port& operator= (Port const& other); - Port (uint16 port_, IPAddress const& addr_, + Port (uint16 port_, IP::Endpoint const& addr_, Security security_, SSLContext* context_); uint16 port; - IPAddress addr; + IP::Endpoint addr; Security security; SSLContext* context; }; diff --git a/src/ripple/http/api/Session.h b/src/ripple/http/api/Session.h index bb5695c223..26b01ea7a8 100644 --- a/src/ripple/http/api/Session.h +++ b/src/ripple/http/api/Session.h @@ -45,7 +45,7 @@ public: virtual Journal journal() = 0; /** Returns the remote address of the connection. */ - virtual IPAddress remoteAddress() = 0; + virtual IP::Endpoint remoteAddress() = 0; /** Returns `true` if the full HTTP headers have been received. */ virtual bool headersComplete() = 0; diff --git a/src/ripple/http/impl/Peer.h b/src/ripple/http/impl/Peer.h index 40e1ebe389..beaa465148 100644 --- a/src/ripple/http/impl/Peer.h +++ b/src/ripple/http/impl/Peer.h @@ -120,7 +120,7 @@ public: return m_impl.journal(); } - IPAddress remoteAddress() + IP::Endpoint remoteAddress() { return from_asio (get_socket().remote_endpoint()); } diff --git a/src/ripple/http/impl/Port.cpp b/src/ripple/http/impl/Port.cpp index ec308ce911..e29dd71b04 100644 --- a/src/ripple/http/impl/Port.cpp +++ b/src/ripple/http/impl/Port.cpp @@ -46,7 +46,7 @@ Port& Port::operator= (Port const& other) Port::Port ( uint16 port_, - IPAddress const& addr_, + IP::Endpoint const& addr_, Security security_, SSLContext* context_) : port (port_) diff --git a/src/ripple/http/impl/Types.h b/src/ripple/http/impl/Types.h index 29a2dad704..9fa70499c6 100644 --- a/src/ripple/http/impl/Types.h +++ b/src/ripple/http/impl/Types.h @@ -53,14 +53,14 @@ inline endpoint_t to_asio (Port const& port) return endpoint_t (address().from_string (s), port.port); } - //IPAddress::V6 v6 (ep.v6()); + //IP::Endpoint::V6 v6 (ep.v6()); return endpoint_t (); } -inline IPAddress from_asio (endpoint_t const& endpoint) +inline IP::Endpoint from_asio (endpoint_t const& endpoint) { std::stringstream ss (to_string (endpoint)); - IPAddress ep; + IP::Endpoint ep; ss >> ep; return ep; } diff --git a/src/ripple/peerfinder/api/Manager.h b/src/ripple/peerfinder/api/Manager.h index 5278826190..e5d0f550d1 100644 --- a/src/ripple/peerfinder/api/Manager.h +++ b/src/ripple/peerfinder/api/Manager.h @@ -63,15 +63,15 @@ public: file, along with the set of corresponding IP addresses. */ virtual void addFixedPeer (std::string const& name, - std::vector const& addresses) = 0; + std::vector const& addresses) = 0; - /** Add a set of strings as fallback IPAddress sources. + /** Add a set of strings as fallback IP::Endpoint sources. @param name A label used for diagnostics. */ virtual void addFallbackStrings (std::string const& name, std::vector const& strings) = 0; - /** Add a URL as a fallback location to obtain IPAddress sources. + /** Add a URL as a fallback location to obtain IP::Endpoint sources. @param name A label used for diagnostics. */ /* VFALCO NOTE Unimplemented diff --git a/src/ripple/peerfinder/api/Types.h b/src/ripple/peerfinder/api/Types.h index 12c74bb46b..255f0189e8 100644 --- a/src/ripple/peerfinder/api/Types.h +++ b/src/ripple/peerfinder/api/Types.h @@ -26,7 +26,7 @@ namespace ripple { namespace PeerFinder { /** Represents a set of addresses. */ -typedef std::vector IPAddresses; +typedef std::vector IPAddresses; /** A set of Endpoint used for connecting. */ typedef std::vector Endpoints; diff --git a/src/ripple/peerfinder/impl/Bootcache.h b/src/ripple/peerfinder/impl/Bootcache.h index c154e7b287..a2bf4ad95a 100644 --- a/src/ripple/peerfinder/impl/Bootcache.h +++ b/src/ripple/peerfinder/impl/Bootcache.h @@ -57,7 +57,7 @@ public: { } - Endpoint (IPAddress const& address, + Endpoint (IP::Endpoint const& address, std::chrono::seconds uptime, int valence) : m_address (address) , m_uptime (uptime) @@ -65,7 +65,7 @@ public: { } - IPAddress const& address () const + IP::Endpoint const& address () const { return m_address; } @@ -81,7 +81,7 @@ public: } private: - IPAddress m_address; + IP::Endpoint m_address; std::chrono::seconds m_uptime; int m_valence; }; @@ -172,7 +172,7 @@ public: //-------------------------------------------------------------------------- - typedef boost::unordered_map Entries; + typedef boost::unordered_map Entries; typedef std::vector SortedEntries; @@ -283,7 +283,7 @@ public: } /** Called when an address is learned from a message. */ - bool insert (IPAddress const& address) + bool insert (IP::Endpoint const& address) { std::pair result ( m_entries.emplace (boost::unordered::piecewise_construct, @@ -299,7 +299,7 @@ public: } /** Called when an outbound connection attempt fails to handshake. */ - void onConnectionFailure (IPAddress const& address) + void onConnectionFailure (IP::Endpoint const& address) { Entries::iterator iter (m_entries.find (address)); // If the entry doesn't already exist don't bother remembering @@ -327,7 +327,7 @@ public: } /** Called when an outbound connection handshake completes. */ - void onConnectionHandshake (IPAddress const& address, + void onConnectionHandshake (IP::Endpoint const& address, HandshakeAction action) { std::pair result ( @@ -368,7 +368,7 @@ public: // and update their uptime in periodicActivity() now that // we have the m_clock member? // - void onConnectionActive (IPAddress const& address) + void onConnectionActive (IP::Endpoint const& address) { std::pair result ( m_entries.emplace (boost::unordered::piecewise_construct, @@ -393,7 +393,7 @@ public: return std::string (); } /** Called when an active outbound connection closes. */ - void onConnectionClosed (IPAddress const& address) + void onConnectionClosed (IP::Endpoint const& address) { Entries::iterator iter (m_entries.find (address)); // Must exist! diff --git a/src/ripple/peerfinder/impl/Checker.cpp b/src/ripple/peerfinder/impl/Checker.cpp index 686f533d14..44b4949ff4 100644 --- a/src/ripple/peerfinder/impl/Checker.cpp +++ b/src/ripple/peerfinder/impl/Checker.cpp @@ -55,14 +55,14 @@ private: CheckerImp& m_owner; boost::asio::io_service& m_io_service; - IPAddress m_address; + IP::Endpoint m_address; AbstractHandler m_handler; socket_type m_socket; boost::system::error_code m_error; bool m_canAccept; Request (CheckerImp& owner, boost::asio::io_service& io_service, - IPAddress const& address, AbstractHandler handler) + IP::Endpoint const& address, AbstractHandler handler) : m_owner (owner) , m_io_service (io_service) , m_address (address) @@ -150,7 +150,7 @@ public: iter->cancel(); } - void async_test (IPAddress const& endpoint, + void async_test (IP::Endpoint const& endpoint, AbstractHandler handler) { new Request (*this, m_io_service, endpoint, handler); diff --git a/src/ripple/peerfinder/impl/Checker.h b/src/ripple/peerfinder/impl/Checker.h index f4028a13ce..8b09192252 100644 --- a/src/ripple/peerfinder/impl/Checker.h +++ b/src/ripple/peerfinder/impl/Checker.h @@ -54,7 +54,7 @@ public: { } /** The original address. */ - IPAddress address; + IP::Endpoint address; /** The error code from the operation. */ boost::system::error_code error; @@ -71,7 +71,7 @@ public: void (Result const& result); */ template - void async_test (IPAddress const& endpoint, + void async_test (IP::Endpoint const& endpoint, BEAST_MOVE_ARG(Handler) handler) { async_test (endpoint, @@ -79,7 +79,7 @@ public: BEAST_MOVE_CAST(Handler)(handler))); } - virtual void async_test (IPAddress const& endpoint, + virtual void async_test (IP::Endpoint const& endpoint, AbstractHandler handler) = 0; }; diff --git a/src/ripple/peerfinder/impl/CheckerAdapter.h b/src/ripple/peerfinder/impl/CheckerAdapter.h index 392684c5cf..456343dadf 100644 --- a/src/ripple/peerfinder/impl/CheckerAdapter.h +++ b/src/ripple/peerfinder/impl/CheckerAdapter.h @@ -88,7 +88,7 @@ public: m_checker->cancel(); } - void async_test (IPAddress const& endpoint, + void async_test (IP::Endpoint const& endpoint, AbstractHandler handler) { m_checker->async_test (endpoint, Handler ( diff --git a/src/ripple/peerfinder/impl/Livecache.cpp b/src/ripple/peerfinder/impl/Livecache.cpp index f8ab6dd608..ff95d7cb6d 100644 --- a/src/ripple/peerfinder/impl/Livecache.cpp +++ b/src/ripple/peerfinder/impl/Livecache.cpp @@ -30,7 +30,7 @@ public: { Endpoint ep; ep.hops = 0; - ep.address = IPAddress ( + ep.address = IP::Endpoint ( IP::AddressV4 (index), port); c.insert (ep); } diff --git a/src/ripple/peerfinder/impl/Logic.h b/src/ripple/peerfinder/impl/Logic.h index 468067f3e8..fc0d35b7ac 100644 --- a/src/ripple/peerfinder/impl/Logic.h +++ b/src/ripple/peerfinder/impl/Logic.h @@ -166,7 +166,7 @@ public: } void addFixedPeer (std::string const& name, - std::vector const& addresses) + std::vector const& addresses) { SharedState::Access state (m_state); @@ -626,7 +626,7 @@ public: struct LessWithoutPortSet { bool operator() ( - Endpoint const& lhs, IPAddress const& rhs) const + Endpoint const& lhs, IP::Endpoint const& rhs) const { return lhs.address.address() < rhs.address(); } @@ -636,12 +636,12 @@ public: return lhs.address.address() < rhs.address.address(); } bool operator() ( - IPAddress const& lhs, Endpoint const& rhs) const + IP::Endpoint const& lhs, Endpoint const& rhs) const { return lhs.address() < rhs.address.address(); } bool operator() ( - IPAddress const& lhs, IPAddress const& rhs) const + IP::Endpoint const& lhs, IP::Endpoint const& rhs) const { return lhs.address() < rhs.address(); } @@ -772,7 +772,7 @@ public: struct LessWithoutPortSet { bool operator() (Bootcache::Endpoint const& lhs, - IPAddress const& rhs) const + IP::Endpoint const& rhs) const { return lhs.address().at_port (0) < rhs.at_port (0); } @@ -782,13 +782,13 @@ public: return lhs.address().at_port (0) < rhs.address().at_port (0); } - bool operator() (IPAddress const& lhs, + bool operator() (IP::Endpoint const& lhs, Bootcache::Endpoint const& rhs) const { return lhs.at_port (0) < rhs.address().at_port (0); } - bool operator() (IPAddress const& lhs, - IPAddress const& rhs) const + bool operator() (IP::Endpoint const& lhs, + IP::Endpoint const& rhs) const { return lhs.at_port (0) < rhs.at_port (0); } @@ -828,7 +828,7 @@ public: struct LessWithoutPortSet { bool operator() ( - Endpoint const& lhs, IPAddress const& rhs) const + Endpoint const& lhs, IP::Endpoint const& rhs) const { return lhs.address.address() < rhs.address(); } @@ -838,12 +838,12 @@ public: return lhs.address.address() < rhs.address.address(); } bool operator() ( - IPAddress const& lhs, Endpoint const& rhs) const + IP::Endpoint const& lhs, Endpoint const& rhs) const { return lhs.address() < rhs.address.address(); } bool operator() ( - IPAddress const& lhs, IPAddress const& rhs) const + IP::Endpoint const& lhs, IP::Endpoint const& rhs) const { return lhs.address() < rhs.address(); } @@ -1032,7 +1032,7 @@ public: // Add one address. // Returns `true` if the address is new. // - bool addBootcacheAddress (IPAddress const& address, + bool addBootcacheAddress (IP::Endpoint const& address, SharedState::Access& state) { return state->bootcache.insert (address); @@ -1108,13 +1108,13 @@ public: consistency_check (state->config.wantIncoming); Endpoint ep; ep.hops = 0; - ep.address = IPAddress ( + ep.address = IP::Endpoint ( IP::AddressV4 ()).at_port (state->config.listeningPort); return ep; } - // Returns true if the IPAddress contains no invalid data. - bool is_valid_address (IPAddress const& address) + // Returns true if the IP::Endpoint contains no invalid data. + bool is_valid_address (IP::Endpoint const& address) { if (is_unspecified (address)) return false; @@ -1197,8 +1197,8 @@ public: } // Called when the Checker completes a connectivity test - void checkComplete (IPAddress const& address, - IPAddress const & checkedAddress, Checker::Result const& result) + void checkComplete (IP::Endpoint const& address, + IP::Endpoint const & checkedAddress, Checker::Result const& result) { if (result.error == boost::asio::error::operation_aborted) return; @@ -1267,7 +1267,7 @@ public: // of our outbound sockets. // // VFALCO TODO Do the lookup using an additional index by local address - bool haveLocalOutboundAddress (IPAddress const& local_address, + bool haveLocalOutboundAddress (IP::Endpoint const& local_address, SharedState::Access& state) { for (Slots::const_iterator iter (state->slots.begin()); @@ -1286,7 +1286,7 @@ public: #if 0 void onPeerAddressChanged ( - IPAddress const& currentAddress, IPAddress const& newAddress) + IP::Endpoint const& currentAddress, IP::Endpoint const& newAddress) { // VFALCO TODO Demote this to trace after PROXY is tested. m_journal.debug << diff --git a/src/ripple/peerfinder/impl/Manager.cpp b/src/ripple/peerfinder/impl/Manager.cpp index 6fb97702c1..dae6c4c24f 100644 --- a/src/ripple/peerfinder/impl/Manager.cpp +++ b/src/ripple/peerfinder/impl/Manager.cpp @@ -82,7 +82,7 @@ public: } void addFixedPeer (std::string const& name, - std::vector const& addresses) + std::vector const& addresses) { m_queue.dispatch ( m_context.wrap ( @@ -163,12 +163,12 @@ public: section.data().begin()); iter != section.data().end(); ++iter) { std::string const& s (*iter); - IPAddress addr (IPAddress::from_string (s)); + IP::Endpoint addr (IP::Endpoint::from_string (s)); if (is_unspecified (addr)) - addr = IPAddress::from_string_altform(s); + addr = IP::Endpoint::from_string_altform(s); if (! is_unspecified (addr)) { - // add IPAddress to bootstrap cache + // add IP::Endpoint to bootstrap cache ++n; } } @@ -184,12 +184,12 @@ public: section.data().begin()); iter != section.data().end(); ++iter) { std::string const& s (*iter); - IPAddress addr (IPAddress::from_string (s)); + IP::Endpoint addr (IP::Endpoint::from_string (s)); if (is_unspecified (addr)) - addr = IPAddress::from_string_altform(s); + addr = IP::Endpoint::from_string_altform(s); if (! is_unspecified (addr)) { - // add IPAddress to fixed peers + // add IP::Endpoint to fixed peers } } } diff --git a/src/ripple/peerfinder/impl/SlotImp.h b/src/ripple/peerfinder/impl/SlotImp.h index 5daa6a4691..7fedeeaf27 100644 --- a/src/ripple/peerfinder/impl/SlotImp.h +++ b/src/ripple/peerfinder/impl/SlotImp.h @@ -184,10 +184,10 @@ public: // clock_type::time_point whenAcceptEndpoints; - // The set of all recent IPAddress that we have seen from this peer. + // The set of all recent IP::Endpoint that we have seen from this peer. // We try to avoid sending a peer the same addresses they gave us. // - //std::set received; + //std::set received; }; //------------------------------------------------------------------------------ diff --git a/src/ripple/peerfinder/impl/SourceStrings.cpp b/src/ripple/peerfinder/impl/SourceStrings.cpp index 1993d4b7f7..8de98b325d 100644 --- a/src/ripple/peerfinder/impl/SourceStrings.cpp +++ b/src/ripple/peerfinder/impl/SourceStrings.cpp @@ -44,8 +44,8 @@ public: results.addresses.reserve (m_strings.size()); for (int i = 0; i < m_strings.size (); ++i) { - IPAddress ep ( - IPAddress::from_string_altform ( + IP::Endpoint ep ( + IP::Endpoint::from_string_altform ( m_strings [i])); if (! is_unspecified (ep)) results.addresses.push_back (ep); diff --git a/src/ripple/peerfinder/impl/Store.h b/src/ripple/peerfinder/impl/Store.h index 4e9fe6aa80..7931adbe38 100644 --- a/src/ripple/peerfinder/impl/Store.h +++ b/src/ripple/peerfinder/impl/Store.h @@ -31,7 +31,7 @@ public: struct SavedBootstrapAddress { - IPAddress address; + IP::Endpoint address; std::chrono::seconds cumulativeUptime; int connectionValence; }; diff --git a/src/ripple/peerfinder/impl/StoreSqdb.h b/src/ripple/peerfinder/impl/StoreSqdb.h index adeea1f3e0..c15e945499 100644 --- a/src/ripple/peerfinder/impl/StoreSqdb.h +++ b/src/ripple/peerfinder/impl/StoreSqdb.h @@ -111,7 +111,7 @@ public: { SavedBootstrapAddress entry; - entry.address = IPAddress::from_string (s); + entry.address = IP::Endpoint::from_string (s); if (! is_unspecified (entry.address)) { diff --git a/src/ripple/peerfinder/sim/Predicates.h b/src/ripple/peerfinder/sim/Predicates.h index 1ec82f84dc..848359fe91 100644 --- a/src/ripple/peerfinder/sim/Predicates.h +++ b/src/ripple/peerfinder/sim/Predicates.h @@ -59,7 +59,7 @@ is_remote_node_pred is_remote_node (Node const* node) class is_remote_endpoint { public: - explicit is_remote_endpoint (IPAddress const& address) + explicit is_remote_endpoint (IP::Endpoint const& address) : m_endpoint (address) { } template @@ -68,7 +68,7 @@ public: return link.remote_endpoint() == m_endpoint; } private: - IPAddress const m_endpoint; + IP::Endpoint const m_endpoint; }; } diff --git a/src/ripple/resource/api/Gossip.h b/src/ripple/resource/api/Gossip.h index 60076c8040..9e4216fea0 100644 --- a/src/ripple/resource/api/Gossip.h +++ b/src/ripple/resource/api/Gossip.h @@ -30,7 +30,7 @@ struct Gossip struct Item { int balance; - IPAddress address; + IP::Endpoint address; }; std::vector items; diff --git a/src/ripple/resource/api/Manager.h b/src/ripple/resource/api/Manager.h index 4522c5b57d..03a064260d 100644 --- a/src/ripple/resource/api/Manager.h +++ b/src/ripple/resource/api/Manager.h @@ -35,10 +35,10 @@ public: virtual ~Manager() = 0; /** Create a new endpoint keyed by inbound IP address. */ - virtual Consumer newInboundEndpoint (IPAddress const& address) = 0; + virtual Consumer newInboundEndpoint (IP::Endpoint const& address) = 0; /** Create a new endpoint keyed by outbound IP address and port. */ - virtual Consumer newOutboundEndpoint (IPAddress const& address) = 0; + virtual Consumer newOutboundEndpoint (IP::Endpoint const& address) = 0; /** Create a new endpoint keyed by name. */ virtual Consumer newAdminEndpoint (std::string const& name) = 0; diff --git a/src/ripple/resource/impl/Key.h b/src/ripple/resource/impl/Key.h index f95c4d4c6c..bc24404b81 100644 --- a/src/ripple/resource/impl/Key.h +++ b/src/ripple/resource/impl/Key.h @@ -27,7 +27,7 @@ namespace Resource { struct Key { Kind kind; - IPAddress address; + IP::Endpoint address; std::string name; struct hasher @@ -51,7 +51,7 @@ struct Key } private: - std::hash m_addr_hash; + std::hash m_addr_hash; boost::hash m_name_hash; }; diff --git a/src/ripple/resource/impl/Logic.h b/src/ripple/resource/impl/Logic.h index 90ae779c49..4a2b1e6c74 100644 --- a/src/ripple/resource/impl/Logic.h +++ b/src/ripple/resource/impl/Logic.h @@ -92,7 +92,7 @@ public: state->table.clear(); } - Consumer newInboundEndpoint (IPAddress const& address) + Consumer newInboundEndpoint (IP::Endpoint const& address) { if (isWhitelisted (address)) return newAdminEndpoint (to_string (address)); @@ -125,7 +125,7 @@ public: return Consumer (*this, *entry); } - Consumer newOutboundEndpoint (IPAddress const& address) + Consumer newOutboundEndpoint (IP::Endpoint const& address) { if (isWhitelisted (address)) return newAdminEndpoint (to_string (address)); @@ -360,7 +360,7 @@ public: //-------------------------------------------------------------------------- - bool isWhitelisted (IPAddress const& address) + bool isWhitelisted (IP::Endpoint const& address) { if (! is_public (address)) return true; diff --git a/src/ripple/resource/impl/Manager.cpp b/src/ripple/resource/impl/Manager.cpp index 1376161cd5..5506d6fae5 100644 --- a/src/ripple/resource/impl/Manager.cpp +++ b/src/ripple/resource/impl/Manager.cpp @@ -42,12 +42,12 @@ public: stopThread (); } - Consumer newInboundEndpoint (IPAddress const& address) + Consumer newInboundEndpoint (IP::Endpoint const& address) { return m_logic.newInboundEndpoint (address); } - Consumer newOutboundEndpoint (IPAddress const& address) + Consumer newOutboundEndpoint (IP::Endpoint const& address) { return m_logic.newOutboundEndpoint (address); } diff --git a/src/ripple/resource/impl/Tests.cpp b/src/ripple/resource/impl/Tests.cpp index 5c5d5ce417..845d0a0b91 100644 --- a/src/ripple/resource/impl/Tests.cpp +++ b/src/ripple/resource/impl/Tests.cpp @@ -60,7 +60,7 @@ public: { Gossip::Item item; item.balance = 100 + random().nextInt (500); - item.address = IPAddress ( + item.address = IP::Endpoint ( IP::AddressV4 (207, 127, 82, v + i)); gossip.items.push_back (item); } @@ -80,8 +80,8 @@ public: Tests::TestLogic logic (j); Charge const fee (dropThreshold + 1); - IPAddress const addr ( - IPAddress::from_string ("207.127.82.2")); + IP::Endpoint const addr ( + IP::Endpoint::from_string ("207.127.82.2")); { Consumer c (logic.newInboundEndpoint (addr)); @@ -170,7 +170,7 @@ public: Gossip g; Gossip::Item item; item.balance = 100; - item.address = IPAddress ( + item.address = IP::Endpoint ( IP::AddressV4 (207, 127, 82, 1)); g.items.push_back (item); @@ -186,7 +186,7 @@ public: TestLogic logic (j); { - IPAddress address (IPAddress::from_string ("207.127.82.1")); + IP::Endpoint address (IP::Endpoint::from_string ("207.127.82.1")); Consumer c (logic.newInboundEndpoint (address)); Charge fee (1000); j.info << @@ -202,7 +202,7 @@ public: } { - IPAddress address (IPAddress::from_string ("207.127.82.2")); + IP::Endpoint address (IP::Endpoint::from_string ("207.127.82.2")); Consumer c (logic.newInboundEndpoint (address)); Charge fee (1000); j.info << diff --git a/src/ripple_app/main/CollectorManager.cpp b/src/ripple_app/main/CollectorManager.cpp index 611ee6cb55..91d946ccd4 100644 --- a/src/ripple_app/main/CollectorManager.cpp +++ b/src/ripple_app/main/CollectorManager.cpp @@ -35,7 +35,7 @@ public: if (server == "statsd") { - IPAddress const address (IPAddress::from_string ( + IP::Endpoint const address (IP::Endpoint::from_string ( params ["address"].toStdString ())); std::string const& prefix (params ["prefix"].toStdString ()); diff --git a/src/ripple_app/main/RPCHTTPServer.cpp b/src/ripple_app/main/RPCHTTPServer.cpp index 109129a6cb..bd001164dc 100644 --- a/src/ripple_app/main/RPCHTTPServer.cpp +++ b/src/ripple_app/main/RPCHTTPServer.cpp @@ -67,7 +67,7 @@ public: if (! getConfig ().getRpcIP().empty () && getConfig ().getRpcPort() != 0) { - IPAddress ep (IPAddress::from_string (getConfig().getRpcIP())); + IP::Endpoint ep (IP::Endpoint::from_string (getConfig().getRpcIP())); if (! is_unspecified (ep)) { HTTP::Port port; @@ -172,7 +172,7 @@ public: } // Stolen directly from RPCServerHandler - std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress) + std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress) { Json::Value jvRequest; { diff --git a/src/ripple_app/rpc/RPCHandler.cpp b/src/ripple_app/rpc/RPCHandler.cpp index e4e308f51e..19e8d78ef1 100644 --- a/src/ripple_app/rpc/RPCHandler.cpp +++ b/src/ripple_app/rpc/RPCHandler.cpp @@ -847,7 +847,7 @@ Json::Value RPCHandler::doConnect (Json::Value params, else iPort = SYSTEM_PEER_PORT; - IPAddress ip (IPAddress::from_string(params["ip"].asString ())); + IP::Endpoint ip (IP::Endpoint::from_string(params["ip"].asString ())); if (! is_unspecified (ip)) getApp().getPeers ().connect (ip.at_port(iPort)); diff --git a/src/ripple_app/rpc/RPCServerHandler.cpp b/src/ripple_app/rpc/RPCServerHandler.cpp index 80baae5cda..436700f6a8 100644 --- a/src/ripple_app/rpc/RPCServerHandler.cpp +++ b/src/ripple_app/rpc/RPCServerHandler.cpp @@ -36,7 +36,7 @@ bool RPCServerHandler::isAuthorized ( return HTTPAuthorized (headers); } -std::string RPCServerHandler::processRequest (std::string const& request, IPAddress const& remoteIPAddress) +std::string RPCServerHandler::processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress) { Json::Value jsonRequest; { diff --git a/src/ripple_app/rpc/RPCServerHandler.h b/src/ripple_app/rpc/RPCServerHandler.h index f7aadadbee..e7770036ea 100644 --- a/src/ripple_app/rpc/RPCServerHandler.h +++ b/src/ripple_app/rpc/RPCServerHandler.h @@ -33,7 +33,7 @@ public: bool isAuthorized (std::map const& headers); - std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress); + std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress); private: NetworkOPs& m_networkOPs; diff --git a/src/ripple_app/websocket/WSConnection.cpp b/src/ripple_app/websocket/WSConnection.cpp index 3facd608b8..c7ff94853e 100644 --- a/src/ripple_app/websocket/WSConnection.cpp +++ b/src/ripple_app/websocket/WSConnection.cpp @@ -23,7 +23,7 @@ SETUP_LOGN (WSConnection, "WSConnection") WSConnection::WSConnection (Resource::Manager& resourceManager, Resource::Consumer usage, InfoSub::Source& source, bool isPublic, - IPAddress const& remoteAddress, boost::asio::io_service& io_service) + IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service) : InfoSub (source, usage) , m_resourceManager (resourceManager) , m_isPublic (isPublic) diff --git a/src/ripple_app/websocket/WSConnection.h b/src/ripple_app/websocket/WSConnection.h index b323d4e433..fd104104db 100644 --- a/src/ripple_app/websocket/WSConnection.h +++ b/src/ripple_app/websocket/WSConnection.h @@ -39,7 +39,7 @@ protected: WSConnection (Resource::Manager& resourceManager, Resource::Consumer usage, InfoSub::Source& source, bool isPublic, - IPAddress const& remoteAddress, boost::asio::io_service& io_service); + IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service); virtual ~WSConnection (); @@ -57,7 +57,7 @@ protected: Resource::Manager& m_resourceManager; Resource::Consumer m_usage; bool const m_isPublic; - IPAddress const m_remoteAddress; + IP::Endpoint const m_remoteAddress; LockType m_receiveQueueMutex; std::deque m_receiveQueue; NetworkOPs& m_netOPs; diff --git a/src/ripple_core/functional/Config.cpp b/src/ripple_core/functional/Config.cpp index 810a2b93da..93f2451bae 100644 --- a/src/ripple_core/functional/Config.cpp +++ b/src/ripple_core/functional/Config.cpp @@ -46,7 +46,7 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las auto const str (*first); ++first; { - IPAddress const addr (IPAddress::from_string (str)); + IP::Endpoint const addr (IP::Endpoint::from_string (str)); if (! is_unspecified (addr)) { out.push_back (addr); @@ -54,7 +54,7 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las } } { - IPAddress const addr (IPAddress::from_string_altform (str)); + IP::Endpoint const addr (IP::Endpoint::from_string_altform (str)); if (! is_unspecified (addr)) { out.push_back (addr); @@ -106,7 +106,7 @@ Config::Config () LEDGER_CREATOR = false; RPC_ALLOW_REMOTE = false; - RPC_ADMIN_ALLOW.push_back (beast::IPAddress::from_string("127.0.0.1")); + RPC_ADMIN_ALLOW.push_back (beast::IP::Endpoint::from_string("127.0.0.1")); PEER_SSL_CIPHER_LIST = DEFAULT_PEER_SSL_CIPHER_LIST; PEER_SCAN_INTERVAL_MIN = DEFAULT_PEER_SCAN_INTERVAL_MIN; @@ -342,8 +342,8 @@ void Config::load () if (smtTmp) { - std::vector parsedAddresses; - //parseAddresses, std::vector::const_iterator> + std::vector parsedAddresses; + //parseAddresses, std::vector::const_iterator> // (parsedAddresses, (*smtTmp).cbegin(), (*smtTmp).cend()); parseAddresses (parsedAddresses, (*smtTmp).cbegin(), (*smtTmp).cend()); RPC_ADMIN_ALLOW.insert (RPC_ADMIN_ALLOW.end(), @@ -693,7 +693,7 @@ void Config::setRpcIpAndOptionalPort (std::string const& newAddress) //------------------------------------------------------------------------------ -Config::Role Config::getAdminRole (Json::Value const& params, beast::IPAddress const& remoteIp) const +Config::Role Config::getAdminRole (Json::Value const& params, beast::IP::Endpoint const& remoteIp) const { Config::Role role (Config::FORBID); @@ -732,7 +732,7 @@ Config::Role Config::getAdminRole (Json::Value const& params, beast::IPAddress c } // Meets IP restriction for admin. - IPAddress const remote_addr (remoteIp.at_port (0)); + IP::Endpoint const remote_addr (remoteIp.at_port (0)); bool bAdminIP = false; for (auto const& allow_addr : RPC_ADMIN_ALLOW) diff --git a/src/ripple_core/functional/Config.h b/src/ripple_core/functional/Config.h index e87e156d97..64bf537d9f 100644 --- a/src/ripple_core/functional/Config.h +++ b/src/ripple_core/functional/Config.h @@ -261,7 +261,7 @@ public: ADMIN, FORBID }; - Role getAdminRole (Json::Value const& params, IPAddress const& remoteIp) const; + Role getAdminRole (Json::Value const& params, IP::Endpoint const& remoteIp) const; /** Listening port number for peer connections. */ int peerListeningPort; @@ -410,7 +410,7 @@ public: std::string WEBSOCKET_SSL_KEY; // RPC parameters - std::vector RPC_ADMIN_ALLOW; + std::vector RPC_ADMIN_ALLOW; std::string RPC_ADMIN_PASSWORD; std::string RPC_ADMIN_USER; std::string RPC_PASSWORD; diff --git a/src/ripple_net/basics/MultiSocket.h b/src/ripple_net/basics/MultiSocket.h index 86a9802512..cd5115f609 100644 --- a/src/ripple_net/basics/MultiSocket.h +++ b/src/ripple_net/basics/MultiSocket.h @@ -103,8 +103,8 @@ public: // Note that this returns the original flags virtual Flag getFlags () = 0; - virtual IPAddress local_endpoint() = 0; - virtual IPAddress remote_endpoint() = 0; + virtual IP::Endpoint local_endpoint() = 0; + virtual IP::Endpoint remote_endpoint() = 0; virtual ProxyInfo getProxyInfo () = 0; /** Returns a pointer to the SSL handle or nullptr if no SSL. */ diff --git a/src/ripple_net/basics/RPCServer.h b/src/ripple_net/basics/RPCServer.h index 373fec6c19..6346fc6505 100644 --- a/src/ripple_net/basics/RPCServer.h +++ b/src/ripple_net/basics/RPCServer.h @@ -46,7 +46,7 @@ public: @param request The RPC request string. @return The server's response. */ - virtual std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress) = 0; + virtual std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress) = 0; }; virtual ~RPCServer () { } diff --git a/src/ripple_net/basics/impl/MultiSocketType.h b/src/ripple_net/basics/impl/MultiSocketType.h index a63e0c1086..fd46a6b88f 100644 --- a/src/ripple_net/basics/impl/MultiSocketType.h +++ b/src/ripple_net/basics/impl/MultiSocketType.h @@ -89,19 +89,19 @@ protected: return m_origFlags; } - IPAddress local_endpoint() + IP::Endpoint local_endpoint() { return IPAddressConversion::from_asio ( m_next_layer.local_endpoint()); } - IPAddress remote_endpoint() + IP::Endpoint remote_endpoint() { if (m_proxyInfoSet) { if (m_proxyInfo.protocol == "TCP4") { - return IPAddress ( + return IP::Endpoint ( IP::AddressV4 ( m_proxyInfo.destAddress.value [0], m_proxyInfo.destAddress.value [1], @@ -112,7 +112,7 @@ protected: // VFALCO TODO IPv6 support bassertfalse; - return IPAddress(); + return IP::Endpoint(); } return IPAddressConversion::from_asio (