1 #ifndef NETWORK_SERVER_LOOKUP_HPP__
2 #define NETWORK_SERVER_LOOKUP_HPP__
3 
4 #include <tuple>
5 
6 #include <QHostAddress>
7 #include <QAbstractSocket>
8 
9 class 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 given by nnn.nnn.nnn.nnn
21 // 5) "[<valid-IPv6-address]" - override default host address with the given IPv6 address
22 // 6) "<valid-host-name>:nnnnn" - use as per (3) & (2)
23 // 7) "nnn.nnn.nnn.nnn:nnnnn" - use as per (4) & (2)
24 // 8) "[<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 //
32 std::tuple<QHostAddress, quint16>
33 network_server_lookup (QString query
34 		       , quint16 default_service_port
35 		       , QHostAddress default_host_address = QHostAddress::LocalHost
36 		       , QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol);
37 
38 #endif
39