TJAlienDNSResolver.h 803 Bytes
Newer Older
Nikola Hardi's avatar
Nikola Hardi committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef ROOT_TJAlienDNSResolver
#define ROOT_TJAlienDNSResolver
#include "TObject.h"

#include <string>
#include <vector>
#include <algorithm>
#include <random>
#include <cstring>

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>

using std::string;
using std::vector;

19
class TJAlienDNSResolver : public TObject {
Nikola Hardi's avatar
Nikola Hardi committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 public:
    TJAlienDNSResolver(string host, int port);
    string get_next_host();
    int lenght();
    void reset();

 private:
    string host;
    string port;

    bool use_ipv6;
    int current_position;

    vector<string> addr_ipv4;
    vector<string> addr_ipv6;
    string addr2string(const struct addrinfo *ai);
    vector<string> get_addr(const char *host, const char *port, int ipv = 6);

    ClassDef(TJAlienDNSResolver, 1)
};

#endif