mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#ifndef RIPPLE_BASICS_RESOLVER_H_INCLUDED
|
|
#define RIPPLE_BASICS_RESOLVER_H_INCLUDED
|
|
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
#include <xrpl/beast/net/IPEndpoint.h>
|
|
|
|
namespace ripple {
|
|
|
|
class Resolver
|
|
{
|
|
public:
|
|
using HandlerType =
|
|
std::function<void(std::string, std::vector<beast::IP::Endpoint>)>;
|
|
|
|
virtual ~Resolver() = 0;
|
|
|
|
/** Issue an asynchronous stop request. */
|
|
virtual void
|
|
stop_async() = 0;
|
|
|
|
/** Issue a synchronous stop request. */
|
|
virtual void
|
|
stop() = 0;
|
|
|
|
/** Issue a synchronous start request. */
|
|
virtual void
|
|
start() = 0;
|
|
|
|
/** resolve all hostnames on the list
|
|
@param names the names to be resolved
|
|
@param handler the handler to call
|
|
*/
|
|
/** @{ */
|
|
template <class Handler>
|
|
void
|
|
resolve(std::vector<std::string> const& names, Handler handler)
|
|
{
|
|
resolve(names, HandlerType(handler));
|
|
}
|
|
|
|
virtual void
|
|
resolve(
|
|
std::vector<std::string> const& names,
|
|
HandlerType const& handler) = 0;
|
|
/** @} */
|
|
};
|
|
|
|
} // namespace ripple
|
|
|
|
#endif
|