ObjFW
OFHostAddressResolver.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFDNSResolver.h"
22 #import "OFRunLoop.h"
23 #import "OFSocket.h"
24 
25 OF_ASSUME_NONNULL_BEGIN
26 
27 @class OFDNSResolverSettings;
28 @class OFDNSResourceRecord;
29 @class OFMutableArray OF_GENERIC(ObjectType);
30 @class OFMutableData;
31 @class OFString;
32 
33 @interface OFHostAddressResolver: OFObject <OFDNSResolverQueryDelegate>
34 {
35  OFString *_host;
36  OFSocketAddressFamily _addressFamily;
37  OFDNSResolver *_resolver;
38  OFDNSResolverSettings *_settings;
39  OFRunLoopMode _Nullable _runLoopMode;
40  id <OFDNSResolverHostDelegate> _Nullable _delegate;
41  bool _isFQDN;
42  size_t _searchDomainIndex;
43  unsigned int _numExpectedResponses;
44  OFMutableData *_addresses;
45 }
46 
47 - (instancetype)initWithHost: (OFString *)host
48  addressFamily: (OFSocketAddressFamily)addressFamily
49  resolver: (OFDNSResolver *)resolver
50  settings: (OFDNSResolverSettings *)settings
51  runLoopMode: (nullable OFRunLoopMode)runLoopMode
52  delegate: (nullable id <OFDNSResolverHostDelegate>)delegate;
53 - (void)asyncResolve;
54 - (OFData *)resolve;
55 @end
56 
57 OF_ASSUME_NONNULL_END
A class representing a DNS resource record.
Definition: OFDNSResourceRecord.h:80
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:41
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:47
A class for handling strings.
Definition: OFString.h:142
A class for resolving DNS names.
Definition: OFDNSResolver.h:131
A delegate for performed DNS queries.
OFSocketAddressFamily
A socket address family.
Definition: OFSocket.h:110
A class for storing arbitrary data in an array.
Definition: OFData.h:45
A class for storing and manipulating arbitrary data in an array.
Definition: OFMutableData.h:29