ObjFW
OFHostAddressResolver.h
1 /*
2  * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFDNSResolver.h"
18 #import "OFRunLoop.h"
19 #import "OFSocket.h"
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
23 @class OFDNSResolverSettings;
24 @class OFDNSResourceRecord;
25 @class OFMutableArray OF_GENERIC(ObjectType);
26 @class OFMutableData;
27 @class OFString;
28 
29 @interface OFHostAddressResolver: OFObject <OFDNSResolverQueryDelegate>
30 {
31  OFString *_host;
32  OFSocketAddressFamily _addressFamily;
33  OFDNSResolver *_resolver;
34  OFDNSResolverSettings *_settings;
35  OFRunLoopMode _Nullable _runLoopMode;
36  id <OFDNSResolverHostDelegate> _Nullable _delegate;
37  bool _isFQDN;
38  size_t _searchDomainIndex;
39  unsigned int _numExpectedResponses;
40  OFMutableData *_addresses;
41 }
42 
43 - (instancetype)initWithHost: (OFString *)host
44  addressFamily: (OFSocketAddressFamily)addressFamily
45  resolver: (OFDNSResolver *)resolver
46  settings: (OFDNSResolverSettings *)settings
47  runLoopMode: (nullable OFRunLoopMode)runLoopMode
48  delegate: (nullable id <OFDNSResolverHostDelegate>)delegate;
49 - (void)asyncResolve;
50 - (OFData *)resolve;
51 @end
52 
53 OF_ASSUME_NONNULL_END
OFSocketAddressFamily
A socket address family.
Definition: OFSocket.h:103
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:38
A class for resolving DNS names.
Definition: OFDNSResolver.h:126
A class representing a DNS resource record.
Definition: OFDNSResourceRecord.h:74
A class for storing arbitrary data in an array.
Definition: OFData.h:42
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:44
A class for storing and manipulating arbitrary data in an array.
Definition: OFMutableData.h:26
The root class for all other classes inside ObjFW.
Definition: OFObject.h:688
A class for handling strings.
Definition: OFString.h:135
A delegate for performed DNS queries.
Definition: OFDNSResolver.h:76