roar
Loading...
Searching...
No Matches
Functions
Roar::Dns Namespace Reference

Functions

template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void resolveAll (boost::asio::any_io_executor context, std::string const &host, std::string const &port, FunctionT &&onResolveDone, boost::asio::ip::resolver_base::flags flags={})
 Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works.
 
template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void resolveAll (boost::asio::any_io_executor context, std::string const &host, std::string const &port, FunctionT &&onResolveDone, boost::system::error_code &ec, boost::asio::ip::resolver_base::flags flags={})
 Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works. Does not throw, but rather sets ec.
 
template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void resolveAll (boost::asio::any_io_executor context, std::string const &host, unsigned short port, FunctionT &&onResolveDone, boost::system::error_code &ec, boost::asio::ip::resolver_base::flags flags={})
 See other overload, this one just takes an unsigned short.
 
template<typename Protocol = boost::asio::ip::tcp>
void resolveAll (boost::asio::any_io_executor context, std::string const &host, std::string const &port, std::function< void(typename Protocol::resolver::iterator, typename Protocol::resolver::iterator)> onResolveDone, boost::asio::ip::resolver_base::flags flags={})
 Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works.
 
template<typename ExecutorType , typename PickerFunctionT , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type resolveSelect (ExecutorType &&executor, std::string const &host, std::string const &port, PickerFunctionT &&picker, boost::asio::ip::resolver_base::flags flags={})
 Resolves a host and port and calls the passed function with all results and then returns what picker returns.
 
template<typename ExecutorType , typename PickerFunctionT , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type resolveSelect (ExecutorType &&executor, std::string const &host, unsigned short port, PickerFunctionT &&picker, boost::asio::ip::resolver_base::flags flags={})
 Resolves a host and port and calls the passed function with all results and then returns what picker returns. See the other overload. This one only differs by the port, which is an unsigned short.
 
template<typename ExecutorType , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type resolveSingle (ExecutorType &&executor, std::string const &host, std::string const &port, bool preferIpv4=false, boost::asio::ip::resolver_base::flags flags={})
 Like resolve but picks one of the addresses. Will sort after ipv4/ipv6.
 
template<typename ExecutorType , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type resolveSingle (ExecutorType &&executor, std::string const &host, unsigned short port, bool preferIpv4=false, boost::asio::ip::resolver_base::flags flags={})
 This overload only differs from the other one by taking an unsigned short as the port.
 

Function Documentation

◆ resolveAll() [1/4]

template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void Roar::Dns::resolveAll ( boost::asio::any_io_executor  context,
std::string const &  host,
std::string const &  port,
FunctionT &&  onResolveDone,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works.

Template Parameters
Protocolip/udp
FunctionTType of function to call with each endpoint.
Parameters
contextIo executor.
hostThe host to resolve
portThe port to resolve
onResolveDoneFunction that is called with all results.
flagsFlags to pass to the resolver.

◆ resolveAll() [2/4]

template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void Roar::Dns::resolveAll ( boost::asio::any_io_executor  context,
std::string const &  host,
std::string const &  port,
FunctionT &&  onResolveDone,
boost::system::error_code &  ec,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works. Does not throw, but rather sets ec.

Template Parameters
Protocolip/udp
FunctionTType of function to call with each endpoint.
Parameters
contextIo executor.
hostThe host to resolve
portThe port to resolve
onResolveDoneFunction that is called with all results.
ecWill be set to an error if resolve fails.
flagsFlags to pass to the resolver.

◆ resolveAll() [3/4]

template<typename Protocol = boost::asio::ip::tcp>
void Roar::Dns::resolveAll ( boost::asio::any_io_executor  context,
std::string const &  host,
std::string const &  port,
std::function< void(typename Protocol::resolver::iterator, typename Protocol::resolver::iterator)>  onResolveDone,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Resolves to a set of possible endpoints. Useful for clients that can try all and connect to one that works.

Template Parameters
Protocolip/udp
FunctionTType of function to call with each endpoint.
Parameters
contextIo executor.
hostThe host to resolve
portThe port to resolve
onResolveDoneFunction that is called with all results.
flagsFlags to pass to the resolver.

◆ resolveAll() [4/4]

template<typename Protocol = boost::asio::ip::tcp, typename FunctionT >
void Roar::Dns::resolveAll ( boost::asio::any_io_executor  context,
std::string const &  host,
unsigned short  port,
FunctionT &&  onResolveDone,
boost::system::error_code &  ec,
boost::asio::ip::resolver_base::flags  flags = {} 
)

See other overload, this one just takes an unsigned short.

Parameters
flagsFlags to pass to the resolver.

◆ resolveSelect() [1/2]

template<typename ExecutorType , typename PickerFunctionT , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type Roar::Dns::resolveSelect ( ExecutorType &&  executor,
std::string const &  host,
std::string const &  port,
PickerFunctionT &&  picker,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Resolves a host and port and calls the passed function with all results and then returns what picker returns.

Template Parameters
ExecutorTypeDeduced. The type of the io executor (likely any_io_executor)
PickerFunctionTA function that takes a vector<typename ResolverType::endpoint_type> and returns typename ResolverType::endpoint_type
Protocolip or udp?
Parameters
executorAny executor type that boost::asio::ip::PROTOCOL::resolver can take.
hostThe host to resolve
portThe port to resolve
pickerA picker function.
Returns
Protocol::resolver::endpoint_type A picked endpoint by the picker function.
Parameters
flagsFlags to pass to the resolver.

◆ resolveSelect() [2/2]

template<typename ExecutorType , typename PickerFunctionT , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type Roar::Dns::resolveSelect ( ExecutorType &&  executor,
std::string const &  host,
unsigned short  port,
PickerFunctionT &&  picker,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Resolves a host and port and calls the passed function with all results and then returns what picker returns. See the other overload. This one only differs by the port, which is an unsigned short.

Parameters
flagsFlags to pass to the resolver.

◆ resolveSingle() [1/2]

template<typename ExecutorType , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type Roar::Dns::resolveSingle ( ExecutorType &&  executor,
std::string const &  host,
std::string const &  port,
bool  preferIpv4 = false,
boost::asio::ip::resolver_base::flags  flags = {} 
)

Like resolve but picks one of the addresses. Will sort after ipv4/ipv6.

Template Parameters
ExecutorTypeDeduced. The type of the io executor (likely any_io_executor)
Protocolip or udp?
Parameters
executorAny executor type that boost::asio::ip::PROTOCOL::resolver can take.
hostThe host to resolve
portThe port to resolve
preferIpv4Prefer to pick an ipv4 address? (Default is false)
flagsFlags to pass to the resolver.
Returns
Protocol::resolver::endpoint_type Returns one of the results.

◆ resolveSingle() [2/2]

template<typename ExecutorType , typename Protocol = boost::asio::ip::tcp>
Protocol::resolver::endpoint_type Roar::Dns::resolveSingle ( ExecutorType &&  executor,
std::string const &  host,
unsigned short  port,
bool  preferIpv4 = false,
boost::asio::ip::resolver_base::flags  flags = {} 
)

This overload only differs from the other one by taking an unsigned short as the port.

Parameters
flagsFlags to pass to the resolver.