︙ | | |
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
-
+
|
OF_ASSUME_NONNULL_BEGIN
#define OF_DNS_RESOLVER_BUFFER_LENGTH 512
@class OFArray OF_GENERIC(ObjectType);
@class OFDNSResolver;
@class OFDNSResolverQuery;
@class OFDNSResolverContext;
@class OFDNSResolverSettings;
@class OFDate;
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
@class OFNumber;
@class OFUDPSocket;
|
︙ | | |
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
-
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
|
* @protocol OFDNSResolverDelegate OFDNSResolver.h ObjFW/OFDNSResolver.h
*
* @brief A delegate for OFDNSResolver.
*/
@protocol OFDNSResolverDelegate <OFObject>
@optional
/*!
* @brief This method is called when a DNS resolver resolved a domain name.
* @brief This method is called when a DNS resolver performed a query.
*
* @param resolver The acting resolver
* @param domainName The fully qualified domain name used to resolve the host
* @param query The query performed by the resolver
* @param response The response from the DNS server, or nil on error
* @param exception An exception that happened during resolving, or nil on
* success
*/
- (void)resolver: (OFDNSResolver *)resolver
didResolveDomainName: (OFString *)domainName
response: (nullable OFDNSResponse *)response
exception: (nullable id)exception;
- (void)resolver: (OFDNSResolver *)resolver
didPerformQuery: (OFDNSQuery *)query
response: (nullable OFDNSResponse *)response
exception: (nullable id)exception;
/*!
* @brief This method is called when a DNS resolver resolved a domain name to
* socket addresses.
* @brief This method is called when a DNS resolver resolved a host to
* addresses.
*
* @param resolver The acting resolver
* @param domainName The fully qualified domain name used to resolve the host
* @param socketAddresses OFData containing several of_socket_address_t
* @param host The host the resolver resolved
* @param addresses OFData containing several of_socket_address_t
* @param exception The exception that occurred during resolving, or nil on
* success
*/
- (void)resolver: (OFDNSResolver *)resolver
didResolveDomainName: (OFString *)domainName
socketAddresses: (nullable OFData *)socketAddresses
exception: (nullable id)exception;
- (void)resolver: (OFDNSResolver *)resolver
didResolveHost: (OFString *)host
addresses: (nullable OFData *)addresses
exception: (nullable id)exception;
@end
/*!
* @class OFDNSResolver OFDNSResolver.h ObjFW/OFDNSResolver.h
*
* @brief A class for resolving DNS names.
*
|
︙ | | |
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
-
+
|
{
OFDNSResolverSettings *_settings;
OFUDPSocket *_IPv4Socket;
#ifdef OF_HAVE_IPV6
OFUDPSocket *_IPv6Socket;
#endif
char _buffer[OF_DNS_RESOLVER_BUFFER_LENGTH];
OFMutableDictionary OF_GENERIC(OFNumber *, OFDNSResolverQuery *)
OFMutableDictionary OF_GENERIC(OFNumber *, OFDNSResolverContext *)
*_queries;
}
/*!
* @brief A dictionary of static hosts.
*
* This dictionary is checked before actually looking up a host.
|
︙ | | |
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
-
-
+
+
-
-
-
+
+
-
-
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
+
-
|
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
*
* @param host The host to resolve
* @param delegate The delegate to use for callbacks
*/
- (void)asyncResolveSocketAddressesForHost: (OFString *)host
delegate: (id <OFDNSResolverDelegate>)
- (void)asyncResolveAddressesForHost: (OFString *)host
delegate: (id <OFDNSResolverDelegate>)delegate;
delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
*
* @param host The host to resolve
* @param addressFamily The desired socket address family
* @param delegate The delegate to use for callbacks
*/
- (void)asyncResolveSocketAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
addressFamily
delegate: (id <OFDNSResolverDelegate>)
delegate: (id <OFDNSResolverDelegate>)delegate;
delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
*
* @param host The host to resolve
* @param addressFamily The desired socket address family
* @param runLoopMode The run loop mode in which to resolve
* @param delegate The delegate to use for callbacks
*/
- (void)asyncResolveSocketAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
addressFamily
runLoopMode: (of_run_loop_mode_t)runLoopMode
delegate: (id <OFDNSResolverDelegate>)
runLoopMode: (of_run_loop_mode_t)runLoopMode
delegate: (id <OFDNSResolverDelegate>)delegate;
delegate;
/*!
* @brief Synchronously resolves the specified host to socket addresses.
*
* @param host The host to resolve
* @param addressFamily The desired socket address family
* @return OFData containing several of_socket_address_t
*/
- (OFData *)resolveSocketAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)
- (OFData *)resolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily;
addressFamily;
/*!
* @brief Closes all sockets and cancels all ongoing queries.
*/
- (void)close;
@end
OF_ASSUME_NONNULL_END
|