summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/OFDNSResolver.h24
-rw-r--r--src/OFDNSResolver.m16
-rw-r--r--src/OFHostAddressResolver.h6
-rw-r--r--src/OFHostAddressResolver.m6
-rw-r--r--src/OFTCPSocket.m2
-rw-r--r--utils/ofdns/OFDNS.m10
6 files changed, 35 insertions, 29 deletions
diff --git a/src/OFDNSResolver.h b/src/OFDNSResolver.h
index 0d2f49c8..6aa0d574 100644
--- a/src/OFDNSResolver.h
+++ b/src/OFDNSResolver.h
@@ -68,12 +68,11 @@ typedef enum of_dns_resolver_error_t {
} of_dns_resolver_error_t;
/*!
- * @protocol OFDNSResolverDelegate OFDNSResolver.h ObjFW/OFDNSResolver.h
+ * @protocol OFDNSResolverQueryDelegate OFDNSResolver.h ObjFW/OFDNSResolver.h
*
- * @brief A delegate for OFDNSResolver.
+ * @brief A delegate for performed DNS queries.
*/
-@protocol OFDNSResolverDelegate <OFObject>
-@optional
+@protocol OFDNSResolverQueryDelegate <OFObject>
/*!
* @brief This method is called when a DNS resolver performed a query.
*
@@ -87,8 +86,15 @@ typedef enum of_dns_resolver_error_t {
didPerformQuery: (OFDNSQuery *)query
response: (nullable OFDNSResponse *)response
exception: (nullable id)exception;
+@end
/*!
+ * @protocol OFDNSResolverQueryDelegate OFDNSResolver.h ObjFW/OFDNSResolver.h
+ *
+ * @brief A delegate for resolved hosts.
+ */
+@protocol OFDNSResolverHostDelegate <OFObject>
+/*!
* @brief This method is called when a DNS resolver resolved a host to
* addresses.
*
@@ -199,7 +205,7 @@ OF_SUBCLASSING_RESTRICTED
* @param delegate The delegate to use for callbacks
*/
- (void)asyncPerformQuery: (OFDNSQuery *)query
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate;
/*!
* @brief Asynchronously performs the specified query.
@@ -210,7 +216,7 @@ OF_SUBCLASSING_RESTRICTED
*/
- (void)asyncPerformQuery: (OFDNSQuery *)query
runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
@@ -219,7 +225,7 @@ OF_SUBCLASSING_RESTRICTED
* @param delegate The delegate to use for callbacks
*/
- (void)asyncResolveAddressesForHost: (OFString *)host
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverHostDelegate>)delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
@@ -230,7 +236,7 @@ OF_SUBCLASSING_RESTRICTED
*/
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverHostDelegate>)delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
@@ -243,7 +249,7 @@ OF_SUBCLASSING_RESTRICTED
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverHostDelegate>)delegate;
/*!
* @brief Synchronously resolves the specified host to socket addresses.
diff --git a/src/OFDNSResolver.m b/src/OFDNSResolver.m
index 673f621d..803e6e05 100644
--- a/src/OFDNSResolver.m
+++ b/src/OFDNSResolver.m
@@ -77,7 +77,7 @@
OFDNSResolverSettings *_settings;
size_t _nameServersIndex;
unsigned int _attempt;
- id <OFDNSResolverDelegate> _delegate;
+ id <OFDNSResolverQueryDelegate> _delegate;
OFData *_queryData;
of_socket_address_t _usedNameServer;
OFTimer *_cancelTimer;
@@ -86,7 +86,7 @@
- (instancetype)initWithQuery: (OFDNSQuery *)query
ID: (OFNumber *)ID
settings: (OFDNSResolverSettings *)settings
- delegate: (id <OFDNSResolverDelegate>)delegate;
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate;
@end
static OFString *
@@ -458,7 +458,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
- (instancetype)initWithQuery: (OFDNSQuery *)query
ID: (OFNumber *)ID
settings: (OFDNSResolverSettings *)settings
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate
{
self = [super init];
@@ -758,7 +758,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
}
- (void)asyncPerformQuery: (OFDNSQuery *)query
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate
{
[self asyncPerformQuery: query
runLoopMode: of_run_loop_mode_default
@@ -767,7 +767,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
- (void)asyncPerformQuery: (OFDNSQuery *)query
runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverQueryDelegate>)delegate
{
void *pool = objc_autoreleasePoolPush();
OFNumber *ID;
@@ -997,7 +997,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
}
- (void)asyncResolveAddressesForHost: (OFString *)host
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverHostDelegate>)delegate
{
[self asyncResolveAddressesForHost: host
addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY
@@ -1007,7 +1007,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverHostDelegate>)delegate
{
[self asyncResolveAddressesForHost: host
addressFamily: addressFamily
@@ -1018,7 +1018,7 @@ parseSection(const unsigned char *buffer, size_t length, size_t *i,
- (void)asyncResolveAddressesForHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverHostDelegate>)delegate
{
void *pool = objc_autoreleasePoolPush();
OFHostAddressResolver *resolver = [[[OFHostAddressResolver alloc]
diff --git a/src/OFHostAddressResolver.h b/src/OFHostAddressResolver.h
index db4167b7..6bf0965b 100644
--- a/src/OFHostAddressResolver.h
+++ b/src/OFHostAddressResolver.h
@@ -29,14 +29,14 @@ OF_ASSUME_NONNULL_BEGIN
@class OFMutableData;
@class OFString;
-@interface OFHostAddressResolver: OFObject <OFDNSResolverDelegate>
+@interface OFHostAddressResolver: OFObject <OFDNSResolverQueryDelegate>
{
OFString *_host;
of_socket_address_family_t _addressFamily;
OFDNSResolver *_resolver;
OFDNSResolverSettings *_settings;
of_run_loop_mode_t _Nullable _runLoopMode;
- id <OFDNSResolverDelegate> _Nullable _delegate;
+ id <OFDNSResolverHostDelegate> _Nullable _delegate;
unsigned int _numExpectedResponses;
OFMutableData *_addresses;
}
@@ -46,7 +46,7 @@ OF_ASSUME_NONNULL_BEGIN
resolver: (OFDNSResolver *)resolver
settings: (OFDNSResolverSettings *)settings
runLoopMode: (nullable of_run_loop_mode_t)runLoopMode
- delegate: (nullable id <OFDNSResolverDelegate>)delegate;
+ delegate: (nullable id <OFDNSResolverHostDelegate>)delegate;
- (void)asyncResolve;
- (OFData *)resolve;
@end
diff --git a/src/OFHostAddressResolver.m b/src/OFHostAddressResolver.m
index dd5dc846..34fa605d 100644
--- a/src/OFHostAddressResolver.m
+++ b/src/OFHostAddressResolver.m
@@ -31,7 +31,7 @@
#import "OFInvalidFormatException.h"
#import "OFResolveHostFailedException.h"
-@interface OFHostAddressResolverDelegate: OFObject <OFDNSResolverDelegate>
+@interface OFHostAddressResolverDelegate: OFObject <OFDNSResolverHostDelegate>
{
@public
bool _done;
@@ -71,7 +71,7 @@ addressForRecord(OF_KINDOF(OFDNSResourceRecord *) record,
static void
callDelegateInMode(of_run_loop_mode_t runLoopMode,
- id <OFDNSResolverDelegate> delegate, OFDNSResolver *resolver,
+ id <OFDNSResolverHostDelegate> delegate, OFDNSResolver *resolver,
OFString *host, OFData *addresses, id exception)
{
SEL selector = @selector(resolver:didResolveHost:addresses:exception:);
@@ -97,7 +97,7 @@ callDelegateInMode(of_run_loop_mode_t runLoopMode,
resolver: (OFDNSResolver *)resolver
settings: (OFDNSResolverSettings *)settings
runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate
+ delegate: (id <OFDNSResolverHostDelegate>)delegate
{
self = [super init];
diff --git a/src/OFTCPSocket.m b/src/OFTCPSocket.m
index beff4c05..4d0f0e99 100644
--- a/src/OFTCPSocket.m
+++ b/src/OFTCPSocket.m
@@ -67,7 +67,7 @@ static OFString *defaultSOCKS5Host = nil;
static uint16_t defaultSOCKS5Port = 1080;
@interface OFTCPSocketAsyncConnectDelegate: OFObject <OFTCPSocketDelegate,
- OFTCPSocketDelegate_Private, OFDNSResolverDelegate>
+ OFTCPSocketDelegate_Private, OFDNSResolverHostDelegate>
{
OFTCPSocket *_socket;
OFString *_host;
diff --git a/utils/ofdns/OFDNS.m b/utils/ofdns/OFDNS.m
index 566f6fdc..63216fb7 100644
--- a/utils/ofdns/OFDNS.m
+++ b/utils/ofdns/OFDNS.m
@@ -23,16 +23,16 @@
#import "OFSandbox.h"
#import "OFStdIOStream.h"
-@interface OFDNS: OFObject <OFApplicationDelegate, OFDNSResolverDelegate>
+@interface OFDNS: OFObject <OFApplicationDelegate, OFDNSResolverQueryDelegate>
@end
OF_APPLICATION_DELEGATE(OFDNS)
@implementation OFDNS
-- (void)resolver: (OFDNSResolver *)resolver
- didPerformQuery: (OFDNSQuery *)query
- response: (OFDNSResponse *)response
- exception: (id)exception
+- (void)resolver: (OFDNSResolver *)resolver
+ didPerformQuery: (OFDNSQuery *)query
+ response: (OFDNSResponse *)response
+ exception: (id)exception
{
if (exception != nil) {
[of_stderr writeFormat: @"Failed to resolve: %@\n", exception];