JS8Call-Improved master
Loading...
Searching...
No Matches
NetworkServerLookup.h
1#ifndef NETWORK_SERVER_LOOKUP_HPP__
2#define NETWORK_SERVER_LOOKUP_HPP__
3
4#include <QAbstractSocket>
5#include <QHostAddress>
6
7#include <tuple>
8
9class QString;
10
11//
12// Do a blocking DNS lookup using query as a destination host address
13// and port.
14//
15// query can be one of:
16//
17// 1) "" (empty string) - use defaults
18// 2) ":nnnnn" - override default service port with port nnnnn
19// 3) "<valid-host-name>" - override default host address with DNS lookup
20// 4) "nnn.nnn.nnn.nnn" - override default host address with the IPv4 address
21// given by nnn.nnn.nnn.nnn 5) "[<valid-IPv6-address]" - override default host
22// address with the given IPv6 address 6) "<valid-host-name>:nnnnn" - use as per
23// (3) & (2) 7) "nnn.nnn.nnn.nnn:nnnnn" - use as per (4) & (2) 8)
24// "[<valid-IPv6-address]:nnnnn" - use as per (5) & (2)
25//
26// The first host address matching the protocol and the service port
27// number are returned.
28//
29// If no suitable host address is found QHostAddress::Null will be
30// returned in the first member of the result tuple.
31//
32std::tuple<QHostAddress, quint16> network_server_lookup(
33 QString query, quint16 default_service_port,
34 QHostAddress default_host_address = QHostAddress::LocalHost,
35 QAbstractSocket::NetworkLayerProtocol protocol =
36 QAbstractSocket::AnyIPProtocol);
37
38#endif
std::tuple< QHostAddress, quint16 > network_server_lookup(QString query, quint16 default_service_port, QHostAddress default_host_address, QAbstractSocket::NetworkLayerProtocol required_protocol)
Looks up the network server address and port.
Definition NetworkServerLookup.cpp:23