blob: 0310f48f8fd0db92b6cf2a273aa15f55e3c62383 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#pragma once
#include <util/datetime/base.h>
#include <util/generic/yexception.h>
struct hostent;
namespace NAsyncDns {
struct TOptions {
inline TOptions()
: MaxRequests(Max())
, Retries(5)
, TimeOut(TDuration::MilliSeconds(50))
{
}
inline TOptions& SetMaxRequests(size_t val) noexcept {
MaxRequests = val;
return *this;
}
inline TOptions& SetRetries(size_t val) noexcept {
Retries = val;
return *this;
}
inline TOptions& SetTimeOut(const TDuration& val) noexcept {
TimeOut = val;
return *this;
}
size_t MaxRequests;
size_t Retries;
TDuration TimeOut;
};
struct IHostResult {
struct TResult {
int Status;
int Timeouts;
const hostent* Result;
};
virtual ~IHostResult() = default;
virtual void OnComplete(const TResult& result) = 0;
};
struct TNameRequest {
inline TNameRequest(const char* addr, int family, IHostResult* cb)
: Addr(addr)
, Family(family)
, CB(cb)
{
}
inline TNameRequest Copy(IHostResult* cb) const noexcept {
return TNameRequest(Addr, Family, cb);
}
inline TNameRequest Copy(int family) const noexcept {
return TNameRequest(Addr, family, CB);
}
const char* Addr;
int Family;
IHostResult* CB;
};
struct TDnsError: public yexception {
};
}
|