summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@heap.zone>2019-10-06 18:27:12 +0200
committerJonathan Schleifer <js@heap.zone>2019-10-06 18:27:12 +0200
commit25f24be4a1cd3284394077ec09a676aa574006f9 (patch)
tree709de8599b13bab8ccd7b366f8d247b13bed72c3
parent51c2efdb80088a2b063a42c7d31d799e6a410e5a (diff)
Rename OFDNSRequest -> OFDNSQuery
This is now in alignment with the terminology of the RFC.
-rw-r--r--src/Makefile2
-rw-r--r--src/OFDNSQuery.h (renamed from src/OFDNSRequest.h)42
-rw-r--r--src/OFDNSQuery.m (renamed from src/OFDNSRequest.m)24
-rw-r--r--src/OFDNSResolver.h22
-rw-r--r--src/OFDNSResolver.m318
-rw-r--r--src/ObjFW.h3
-rw-r--r--src/exceptions/Makefile2
-rw-r--r--src/exceptions/OFDNSQueryFailedException.h (renamed from src/exceptions/OFDNSRequestFailedException.h)26
-rw-r--r--src/exceptions/OFDNSQueryFailedException.m (renamed from src/exceptions/OFDNSRequestFailedException.m)24
-rw-r--r--utils/ofdns/OFDNS.m12
-rw-r--r--utils/ofhttp/OFHTTP.m8
-rw-r--r--utils/ofhttp/lang/de.json4
12 files changed, 243 insertions, 244 deletions
diff --git a/src/Makefile b/src/Makefile
index 591f2bb0..7fb9e456 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -135,7 +135,7 @@ SRCS_FILES = OFFile.m \
OFSettings.m \
OFString+PathAdditions.m
SRCS_PLUGINS = OFPlugin.m
-SRCS_SOCKETS = OFDNSRequest.m \
+SRCS_SOCKETS = OFDNSQuery.m \
OFDNSResolver.m \
OFDNSResourceRecord.m \
OFDNSResponse.m \
diff --git a/src/OFDNSRequest.h b/src/OFDNSQuery.h
index 70679e66..5c6101d0 100644
--- a/src/OFDNSRequest.h
+++ b/src/OFDNSQuery.h
@@ -21,11 +21,11 @@
OF_ASSUME_NONNULL_BEGIN
/*!
- * @class OFDNSRequest OFDNSRequest.h ObjFW/OFDNSRequest.h
+ * @class OFDNSQuery OFDNSQuery.h ObjFW/OFDNSQuery.h
*
- * @brief A class representing a DNS request.
+ * @brief A class representing a DNS query.
*/
-@interface OFDNSRequest: OFObject <OFCopying>
+@interface OFDNSQuery: OFObject <OFCopying>
{
OFString *_host;
of_dns_resource_record_class_t _recordClass;
@@ -39,51 +39,51 @@ OF_ASSUME_NONNULL_BEGIN
@property (readonly, nonatomic) OFString *host;
/*!
- * @brief The requested record class.
+ * @brief The record class of the query.
*/
@property (readonly, nonatomic) of_dns_resource_record_class_t recordClass;
/*!
- * @brief The requested record type.
+ * @brief The record type of the query.
*/
@property (readonly, nonatomic) of_dns_resource_record_type_t recordType;
/*!
- * @brief Creates a new, autoreleased OFDNSRequest with IN class and type ALL.
+ * @brief Creates a new, autoreleased OFDNSQuery with IN class and type ALL.
*
* @param host The host to resolve
- * @return A new, autoreleased OFDNSRequest.
+ * @return A new, autoreleased OFDNSQuery
*/
-+ (instancetype)requestWithHost: (OFString *)host;
++ (instancetype)queryWithHost: (OFString *)host;
/*!
- * @brief Creates a new, autoreleased OFDNSRequest.
+ * @brief Creates a new, autoreleased OFDNSQuery.
*
* @param host The host to resolve
- * @param recordClass The requested record class
- * @param recordType The requested record type
- * @return A new, autoreleased OFDNSRequest.
+ * @param recordClass The record class of the query
+ * @param recordType The record type of the query
+ * @return A new, autoreleased OFDNSQuery
*/
-+ (instancetype)requestWithHost: (OFString *)host
- recordClass: (of_dns_resource_record_class_t)recordClass
- recordType: (of_dns_resource_record_type_t)recordType;
++ (instancetype)queryWithHost: (OFString *)host
+ recordClass: (of_dns_resource_record_class_t)recordClass
+ recordType: (of_dns_resource_record_type_t)recordType;
/*!
- * @brief Initializes an already allocated OFDNSRequest with IN class and type
+ * @brief Initializes an already allocated OFDNSQuery with IN class and type
* ALL.
*
* @param host The host to resolve
- * @return An initialized OFDNSRequest
+ * @return An initialized OFDNSQuery
*/
- (instancetype)initWithHost: (OFString *)host;
/*!
- * @brief Initializes an already allocated OFDNSRequest.
+ * @brief Initializes an already allocated OFDNSQuery.
*
* @param host The host to resolve
- * @param recordClass The requested record class
- * @param recordType The requested record type
- * @return An initialized OFDNSRequest
+ * @param recordClass The record class of the query
+ * @param recordType The record type of the query
+ * @return An initialized OFDNSQuery
*/
- (instancetype)initWithHost: (OFString *)host
recordClass: (of_dns_resource_record_class_t)recordClass
diff --git a/src/OFDNSRequest.m b/src/OFDNSQuery.m
index c037f86e..740d433c 100644
--- a/src/OFDNSRequest.m
+++ b/src/OFDNSQuery.m
@@ -17,20 +17,20 @@
#include "config.h"
-#import "OFDNSRequest.h"
+#import "OFDNSQuery.h"
#import "OFString.h"
-@implementation OFDNSRequest
+@implementation OFDNSQuery
@synthesize host = _host, recordClass = _recordClass, recordType = _recordType;
-+ (instancetype)requestWithHost: (OFString *)host
++ (instancetype)queryWithHost: (OFString *)host
{
return [[[self alloc] initWithHost: host] autorelease];
}
-+ (instancetype)requestWithHost: (OFString *)host
- recordClass: (of_dns_resource_record_class_t)recordClass
- recordType: (of_dns_resource_record_type_t)recordType
++ (instancetype)queryWithHost: (OFString *)host
+ recordClass: (of_dns_resource_record_class_t)recordClass
+ recordType: (of_dns_resource_record_type_t)recordType
{
return [[[self alloc] initWithHost: host
recordClass: recordClass
@@ -76,18 +76,18 @@
- (bool)isEqual: (id)object
{
- OFDNSRequest *request;
+ OFDNSQuery *query;
- if (![object isKindOfClass: [OFDNSRequest class]])
+ if (![object isKindOfClass: [OFDNSQuery class]])
return false;
- request = object;
+ query = object;
- if (request->_host != _host && ![request->_host isEqual: _host])
+ if (query->_host != _host && ![query->_host isEqual: _host])
return false;
- if (request->_recordClass != _recordClass)
+ if (query->_recordClass != _recordClass)
return false;
- if (request->_recordType != _recordType)
+ if (query->_recordType != _recordType)
return false;
return true;
diff --git a/src/OFDNSResolver.h b/src/OFDNSResolver.h
index 6ae94352..7869bc2c 100644
--- a/src/OFDNSResolver.h
+++ b/src/OFDNSResolver.h
@@ -16,7 +16,7 @@
*/
#import "OFObject.h"
-#import "OFDNSRequest.h"
+#import "OFDNSQuery.h"
#import "OFDNSResourceRecord.h"
#import "OFDNSResponse.h"
#import "OFRunLoop.h"
@@ -193,24 +193,24 @@ OF_SUBCLASSING_RESTRICTED
- (instancetype)init;
/*!
- * @brief Asynchronously performs the specified request.
+ * @brief Asynchronously performs the specified query.
*
- * @param request The request to perform
+ * @param query The query to perform
* @param delegate The delegate to use for callbacks
*/
-- (void)asyncPerformRequest: (OFDNSRequest *)request
- delegate: (id <OFDNSResolverDelegate>)delegate;
+- (void)asyncPerformQuery: (OFDNSQuery *)query
+ delegate: (id <OFDNSResolverDelegate>)delegate;
/*!
- * @brief Asynchronously performs the specified request.
+ * @brief Asynchronously performs the specified query.
*
- * @param request The request to perform
+ * @param query The query to perform
* @param runLoopMode The run loop mode in which to resolve
* @param delegate The delegate to use for callbacks
*/
-- (void)asyncPerformRequest: (OFDNSRequest *)request
- runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate;
+- (void)asyncPerformQuery: (OFDNSQuery *)query
+ runLoopMode: (of_run_loop_mode_t)runLoopMode
+ delegate: (id <OFDNSResolverDelegate>)delegate;
/*!
* @brief Asynchronously resolves the specified host to socket addresses.
@@ -262,7 +262,7 @@ OF_SUBCLASSING_RESTRICTED
addressFamily;
/*!
- * @brief Closes all sockets and cancels all ongoing requests.
+ * @brief Closes all sockets and cancels all ongoing queries.
*/
- (void)close;
@end
diff --git a/src/OFDNSResolver.m b/src/OFDNSResolver.m
index 8acfe2de..ec6a2472 100644
--- a/src/OFDNSResolver.m
+++ b/src/OFDNSResolver.m
@@ -21,7 +21,7 @@
#import "OFDNSResolver.h"
#import "OFArray.h"
-#import "OFDNSRequest.h"
+#import "OFDNSQuery.h"
#import "OFDNSResolverSettings.h"
#import "OFDNSResponse.h"
#import "OFData.h"
@@ -34,7 +34,7 @@
#import "OFUDPSocket.h"
#import "OFUDPSocket+Private.h"
-#import "OFDNSRequestFailedException.h"
+#import "OFDNSQueryFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
@@ -70,7 +70,7 @@ static const of_run_loop_mode_t resolveRunLoopMode =
@interface OFDNSResolverQuery: OFObject
{
@public
- OFDNSRequest *_request;
+ OFDNSQuery *_query;
OFString *_domainName;
OFNumber *_ID;
OFDNSResolverSettings *_settings;
@@ -84,15 +84,15 @@ static const of_run_loop_mode_t resolveRunLoopMode =
OFTimer *_cancelTimer;
}
-- (instancetype)initWithRequest: (OFDNSRequest *)request
- domainName: (OFString *)domainName
- ID: (OFNumber *)ID
- settings: (OFDNSResolverSettings *)settings
- nameServersIndex: (size_t)nameServersIndex
- searchDomainsIndex: (size_t)searchDomainsIndex
- target: (id)target
- selector: (SEL)selector
- context: (id)context;
+- (instancetype)initWithQuery: (OFDNSQuery *)query
+ domainName: (OFString *)domainName
+ ID: (OFNumber *)ID
+ settings: (OFDNSResolverSettings *)settings
+ nameServersIndex: (size_t)nameServersIndex
+ searchDomainsIndex: (size_t)searchDomainsIndex
+ target: (id)target
+ selector: (SEL)selector
+ context: (id)context;
@end
@interface OFDNSResolverAsyncResolveSocketAddressesContext: OFObject
@@ -142,14 +142,14 @@ static const of_run_loop_mode_t resolveRunLoopMode =
@end
@interface OFDNSResolver () <OFUDPSocketDelegate>
-- (void)of_asyncPerformRequest: (OFDNSRequest *)request
- settings: (OFDNSResolverSettings *)settings
- nameServersIndex: (size_t)nameServersIndex
- searchDomainsIndex: (size_t)searchDomainsIndex
- runLoopMode: (of_run_loop_mode_t)runLoopMode
- target: (id)target
- selector: (SEL)selector
- context: (id)context;
+- (void)of_asyncPerformQuery: (OFDNSQuery *)query
+ settings: (OFDNSResolverSettings *)settings
+ nameServersIndex: (size_t)nameServersIndex
+ searchDomainsIndex: (size_t)searchDomainsIndex
+ runLoopMode: (of_run_loop_mode_t)runLoopMode
+ target: (id)target
+ selector: (SEL)selector
+ context: (id)context;
- (void)of_sendQuery: (OFDNSResolverQuery *)query
runLoopMode: (of_run_loop_mode_t)runLoopMode;
- (void)of_queryWithIDTimedOut: (OFDNSResolverQuery *)query;
@@ -550,15 +550,15 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
}
@implementation OFDNSResolverQuery
-- (instancetype)initWithRequest: (OFDNSRequest *)request
- domainName: (OFString *)domainName
- ID: (OFNumber *)ID
- settings: (OFDNSResolverSettings *)settings
- nameServersIndex: (size_t)nameServersIndex
- searchDomainsIndex: (size_t)searchDomainsIndex
- target: (id)target
- selector: (SEL)selector
- context: (id)context
+- (instancetype)initWithQuery: (OFDNSQuery *)query
+ domainName: (OFString *)domainName
+ ID: (OFNumber *)ID
+ settings: (OFDNSResolverSettings *)settings
+ nameServersIndex: (size_t)nameServersIndex
+ searchDomainsIndex: (size_t)searchDomainsIndex
+ target: (id)target
+ selector: (SEL)selector
+ context: (id)context
{
self = [super init];
@@ -567,7 +567,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
OFMutableData *queryData;
uint16_t tmp;
- _request = [request copy];
+ _query = [query copy];
_domainName = [domainName copy];
_ID = [ID retain];
_settings = [settings copy];
@@ -616,12 +616,12 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
}
/* QTYPE */
- tmp = OF_BSWAP16_IF_LE(_request.recordType);
+ tmp = OF_BSWAP16_IF_LE(_query.recordType);
[queryData addItems: &tmp
count: 2];
/* QCLASS */
- tmp = OF_BSWAP16_IF_LE(_request.recordClass);
+ tmp = OF_BSWAP16_IF_LE(_query.recordClass);
[queryData addItems: &tmp
count: 2];
@@ -640,7 +640,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
- (void)dealloc
{
- [_request release];
+ [_query release];
[_domainName release];
[_ID release];
[_settings release];
@@ -743,7 +743,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
[OFRunLoop currentRunLoop].currentMode;
OFNumber *recordTypeNumber =
[OFNumber numberWithInt: recordType];
- OFDNSRequest *request;
+ OFDNSQuery *query;
_expectedResponses++;
@@ -751,20 +751,20 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
[OFPair pairWithFirstObject: CNAME
secondObject: recordTypeNumber]];
- request = [OFDNSRequest
- requestWithHost: alias
- recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
- recordType: recordType];
- [_resolver of_asyncPerformRequest: request
- settings: nil
- nameServersIndex: 0
- searchDomainsIndex: 0
- runLoopMode: runLoopMode
- target: self
- selector: @selector(resolver:
- didResolveCNAME:response:
- context:exception:)
- context: recordTypeNumber];
+ query = [OFDNSQuery
+ queryWithHost: alias
+ recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
+ recordType: recordType];
+ [_resolver of_asyncPerformQuery: query
+ settings: nil
+ nameServersIndex: 0
+ searchDomainsIndex: 0
+ runLoopMode: runLoopMode
+ target: self
+ selector: @selector(resolver:
+ didResolveCNAME:response:
+ context:exception:)
+ context: recordTypeNumber];
}
}
@@ -864,14 +864,14 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
[addresses makeImmutable];
if (addresses.count == 0) {
- OFDNSRequest *request = [OFDNSRequest
- requestWithHost: _host
- recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
- recordType: 0];
-
- exception = [OFDNSRequestFailedException
- exceptionWithRequest: request
- error: OF_DNS_RESOLVER_ERROR_UNKNOWN];
+ OFDNSQuery *query = [OFDNSQuery
+ queryWithHost: _host
+ recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
+ recordType: 0];
+
+ exception = [OFDNSQueryFailedException
+ exceptionWithQuery: query
+ error: OF_DNS_RESOLVER_ERROR_UNKNOWN];
}
if ([_delegate respondsToSelector: @selector(
@@ -904,7 +904,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
if (_domainName != nil) {
if (![domainName isEqual: _domainName])
- /* Did the config change between requests? */
+ /* Did the config change in between? */
return;
} else
_domainName = [domainName copy];
@@ -1091,19 +1091,19 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
_settings->_configReloadInterval = configReloadInterval;
}
-- (void)of_asyncPerformRequest: (OFDNSRequest *)request
- settings: (OFDNSResolverSettings *)settings
- nameServersIndex: (size_t)nameServersIndex
- searchDomainsIndex: (size_t)searchDomainsIndex
- runLoopMode: (of_run_loop_mode_t)runLoopMode
- target: (id)target
- selector: (SEL)selector
- context: (id)context
+- (void)of_asyncPerformQuery: (OFDNSQuery *)query
+ settings: (OFDNSResolverSettings *)settings
+ nameServersIndex: (size_t)nameServersIndex
+ searchDomainsIndex: (size_t)searchDomainsIndex
+ runLoopMode: (of_run_loop_mode_t)runLoopMode
+ target: (id)target
+ selector: (SEL)selector
+ context: (id)context
{
void *pool = objc_autoreleasePoolPush();
OFNumber *ID;
OFString *host, *domainName;
- OFDNSResolverQuery *query;
+ OFDNSResolverQuery *resolverQuery;
if (settings == nil) {
[_settings reload];
@@ -1115,7 +1115,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
ID = [OFNumber numberWithUInt16: (uint16_t)of_random()];
} while ([_queries objectForKey: ID] != nil);
- host = request.host;
+ host = query.host;
if (isFQDN(host, settings)) {
domainName = host;
@@ -1132,20 +1132,20 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
if (domainName.UTF8StringLength > 253)
@throw [OFOutOfRangeException exception];
- query = [[[OFDNSResolverQuery alloc]
- initWithRequest: request
- domainName: domainName
- ID: ID
- settings: settings
- nameServersIndex: nameServersIndex
- searchDomainsIndex: searchDomainsIndex
- target: target
- selector: selector
- context: context] autorelease];
- [_queries setObject: query
+ resolverQuery = [[[OFDNSResolverQuery alloc]
+ initWithQuery: query
+ domainName: domainName
+ ID: ID
+ settings: settings
+ nameServersIndex: nameServersIndex
+ searchDomainsIndex: searchDomainsIndex
+ target: target
+ selector: selector
+ context: context] autorelease];
+ [_queries setObject: resolverQuery
forKey: ID];
- [self of_sendQuery: query
+ [self of_sendQuery: resolverQuery
runLoopMode: runLoopMode];
objc_autoreleasePoolPop(pool);
@@ -1165,35 +1165,33 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
exception: exception];
}
-- (void)asyncPerformRequest: (OFDNSRequest *)request
- delegate: (id <OFDNSResolverDelegate>)delegate
+- (void)asyncPerformQuery: (OFDNSQuery *)query
+ delegate: (id <OFDNSResolverDelegate>)delegate
{
- [self of_asyncPerformRequest: request
- settings: nil
- nameServersIndex: 0
- searchDomainsIndex: 0
- runLoopMode: of_run_loop_mode_default
- target: self
- selector: @selector(of_resolver:
- didResolveDomainName:response:context:
- exception:)
- context: delegate];
+ [self of_asyncPerformQuery: query
+ settings: nil
+ nameServersIndex: 0
+ searchDomainsIndex: 0
+ runLoopMode: of_run_loop_mode_default
+ target: self
+ selector: @selector(of_resolver:didResolveDomainName:
+ response:context:exception:)
+ context: delegate];
}
-- (void)asyncPerformRequest: (OFDNSRequest *)request
- runLoopMode: (of_run_loop_mode_t)runLoopMode
- delegate: (id <OFDNSResolverDelegate>)delegate
+- (void)asyncPerformQuery: (OFDNSQuery *)query
+ runLoopMode: (of_run_loop_mode_t)runLoopMode
+ delegate: (id <OFDNSResolverDelegate>)delegate
{
- [self of_asyncPerformRequest: request
- settings: nil
- nameServersIndex: 0
- searchDomainsIndex: 0
- runLoopMode: runLoopMode
- target: self
- selector: @selector(of_resolver:
- didResolveDomainName:response:context:
- exception:)
- context: delegate];
+ [self of_asyncPerformQuery: query
+ settings: nil
+ nameServersIndex: 0
+ searchDomainsIndex: 0
+ runLoopMode: runLoopMode
+ target: self
+ selector: @selector(of_resolver:didResolveDomainName:
+ response:context:exception:)
+ context: delegate];
}
- (void)of_sendQuery: (OFDNSResolverQuery *)query
@@ -1266,7 +1264,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
- (void)of_queryWithIDTimedOut: (OFDNSResolverQuery *)query
{
- OFDNSRequestFailedException *exception;
+ OFDNSQueryFailedException *exception;
if (query == nil)
return;
@@ -1291,7 +1289,7 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
[_queries removeObjectForKey: query->_ID];
/*
- * Cancel any pending requests, to avoid a send being still pending and
+ * Cancel any pending queries, to avoid a send being still pending and
* trying to access the query once it no longer exists.
*/
[_IPv4Socket cancelAsyncRequests];
@@ -1303,9 +1301,9 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
length: BUFFER_LENGTH];
#endif
- exception = [OFDNSRequestFailedException
- exceptionWithRequest: query->_request
- error: OF_DNS_RESOLVER_ERROR_TIMEOUT];
+ exception = [OFDNSQueryFailedException
+ exceptionWithQuery: query->_query
+ error: OF_DNS_RESOLVER_ERROR_TIMEOUT];
callback(query->_target, query->_selector, self, query->_domainName,
nil, query->_context, exception);
@@ -1395,14 +1393,14 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
query->_searchDomainsIndex++;
- [self of_asyncPerformRequest: query->_request
- settings: query->_settings
- nameServersIndex: nameServersIndex
- searchDomainsIndex: searchDomainsIndex
- runLoopMode: runLoopMode
- target: query->_target
- selector: query->_selector
- context: query->_context];
+ [self of_asyncPerformQuery: query->_query
+ settings: query->_settings
+ nameServersIndex: nameServersIndex
+ searchDomainsIndex: searchDomainsIndex
+ runLoopMode: runLoopMode
+ target: query->_target
+ selector: query->_selector
+ context: query->_context];
return true;
}
@@ -1421,9 +1419,9 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
}
if (buffer[3] & 0x0F)
- @throw [OFDNSRequestFailedException
- exceptionWithRequest: query->_request
- error: error];
+ @throw [OFDNSQueryFailedException
+ exceptionWithQuery: query->_query
+ error: error];
numQuestions = (buffer[4] << 8) | buffer[5];
numAnswers = (buffer[6] << 8) | buffer[7];
@@ -1579,14 +1577,14 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
OF_DNS_RESOURCE_RECORD_CLASS_IN;
of_dns_resolver_error_t error =
OF_DNS_RESOLVER_ERROR_NO_RESULT;
- OFDNSRequest *request = [OFDNSRequest
- requestWithHost: host
- recordClass: recordClass
- recordType: recordType];
-
- exception = [OFDNSRequestFailedException
- exceptionWithRequest: request
- error: error];
+ OFDNSQuery *query = [OFDNSQuery
+ queryWithHost: host
+ recordClass: recordClass
+ recordType: recordType];
+
+ exception = [OFDNSQueryFailedException
+ exceptionWithQuery: query
+ error: error];
}
}
@@ -1638,45 +1636,45 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
#ifdef OF_HAVE_IPV6
if (addressFamily == OF_SOCKET_ADDRESS_FAMILY_IPV6 ||
addressFamily == OF_SOCKET_ADDRESS_FAMILY_ANY) {
- OFDNSRequest *request = [OFDNSRequest
- requestWithHost: host
- recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
- recordType: OF_DNS_RESOURCE_RECORD_TYPE_AAAA];
+ OFDNSQuery *query = [OFDNSQuery
+ queryWithHost: host
+ recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
+ recordType: OF_DNS_RESOURCE_RECORD_TYPE_AAAA];
OFNumber *recordTypeNumber =
[OFNumber numberWithInt: OF_DNS_RESOURCE_RECORD_TYPE_AAAA];
- [self of_asyncPerformRequest: request
- settings: nil
- nameServersIndex: 0
- searchDomainsIndex: 0
- runLoopMode: runLoopMode
- target: context
- selector: @selector(resolver:
- didResolveDomainName:response:
- context:exception:)
- context: recordTypeNumber];
+ [self of_asyncPerformQuery: query
+ settings: nil
+ nameServersIndex: 0
+ searchDomainsIndex: 0
+ runLoopMode: runLoopMode
+ target: context
+ selector: @selector(resolver:
+ didResolveDomainName:response:
+ context:exception:)
+ context: recordTypeNumber];
}
#endif
if (addressFamily == OF_SOCKET_ADDRESS_FAMILY_IPV4 ||
addressFamily == OF_SOCKET_ADDRESS_FAMILY_ANY) {
- OFDNSRequest *request = [OFDNSRequest
- requestWithHost: host
- recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
- recordType: OF_DNS_RESOURCE_RECORD_TYPE_A];
+ OFDNSQuery *query = [OFDNSQuery
+ queryWithHost: host
+ recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
+ recordType: OF_DNS_RESOURCE_RECORD_TYPE_A];
OFNumber *recordTypeNumber =
[OFNumber numberWithInt: OF_DNS_RESOURCE_RECORD_TYPE_A];
- [self of_asyncPerformRequest: request
- settings: nil
- nameServersIndex: 0
- searchDomainsIndex: 0
- runLoopMode: runLoopMode
- target: context
- selector: @selector(resolver:
- didResolveDomainName:response:
- context:exception:)
- context: recordTypeNumber];
+ [self of_asyncPerformQuery: query
+ settings: nil
+ nameServersIndex: 0
+ searchDomainsIndex: 0
+ runLoopMode: runLoopMode
+ target: context
+ selector: @selector(resolver:
+ didResolveDomainName:response:
+ context:exception:)
+ context: recordTypeNumber];
}
objc_autoreleasePoolPop(pool);
@@ -1735,11 +1733,11 @@ callback(id target, SEL selector, OFDNSResolver *resolver, OFString *domainName,
enumerator = [_queries objectEnumerator];
while ((query = [enumerator nextObject]) != nil) {
- OFDNSRequestFailedException *exception;
+ OFDNSQueryFailedException *exception;
- exception = [OFDNSRequestFailedException
- exceptionWithRequest: query->_request
- error: OF_DNS_RESOLVER_ERROR_CANCELED];
+ exception = [OFDNSQueryFailedException
+ exceptionWithQuery: query->_query
+ error: OF_DNS_RESOLVER_ERROR_CANCELED];
callback(query->_target, query->_selector, self,
query->_domainName, nil, query->_context, exception);
diff --git a/src/ObjFW.h b/src/ObjFW.h
index 993837d3..39619811 100644
--- a/src/ObjFW.h
+++ b/src/ObjFW.h
@@ -75,6 +75,7 @@
# import "OFUDPSocket.h"
# import "OFTLSSocket.h"
# import "OFKernelEventObserver.h"
+# import "OFDNSQuery.h"
# import "OFDNSResourceRecord.h"
# import "OFDNSResponse.h"
# import "OFDNSResolver.h"
@@ -147,7 +148,7 @@
# import "OFAcceptFailedException.h"
# import "OFAlreadyConnectedException.h"
# import "OFBindFailedException.h"
-# import "OFDNSRequestFailedException.h"
+# import "OFDNSQueryFailedException.h"
#endif
#import "OFChangeCurrentDirectoryPathFailedException.h"
#import "OFChecksumMismatchException.h"
diff --git a/src/exceptions/Makefile b/src/exceptions/Makefile
index 096ece38..b71bc3b2 100644
--- a/src/exceptions/Makefile
+++ b/src/exceptions/Makefile
@@ -58,7 +58,7 @@ SRCS_SOCKETS = OFAcceptFailedException.m \
OFAlreadyConnectedException.m \
OFBindFailedException.m \
OFConnectionFailedException.m \
- OFDNSRequestFailedException.m \
+ OFDNSQueryFailedException.m \
OFHTTPRequestFailedException.m \
OFListenFailedException.m \
OFObserveFailedException.m
diff --git a/src/exceptions/OFDNSRequestFailedException.h b/src/exceptions/OFDNSQueryFailedException.h
index b52a3de7..6897d395 100644
--- a/src/exceptions/OFDNSRequestFailedException.h
+++ b/src/exceptions/OFDNSQueryFailedException.h
@@ -16,28 +16,28 @@
*/
#import "OFException.h"
-#import "OFDNSRequest.h"
+#import "OFDNSQuery.h"
#import "OFDNSResolver.h"
#import "OFDNSResourceRecord.h"
OF_ASSUME_NONNULL_BEGIN
/*!
- * @class OFDNSRequestFailedException \
- * OFDNSRequestFailedException.h ObjFW/OFDNSRequestFailedException.h
+ * @class OFDNSQueryFailedException \
+ * OFDNSQueryFailedException.h ObjFW/OFDNSQueryFailedException.h
*
* @brief An exception indicating the resolving a host failed.
*/
-@interface OFDNSRequestFailedException: OFException
+@interface OFDNSQueryFailedException: OFException
{
- OFDNSRequest *_request;
+ OFDNSQuery *_query;
of_dns_resolver_error_t _error;
}
/*!
- * @brief The request which could not be performed.
+ * @brief The query which could not be performed.
*/
-@property (readonly, nonatomic) OFDNSRequest *request;
+@property (readonly, nonatomic) OFDNSQuery *query;
/*!
* @brief The error from the resolver.
@@ -47,22 +47,22 @@ OF_ASSUME_NONNULL_BEGIN
/*!
* @brief Creates a new, autoreleased resolve host failed exception.
*
- * @param request The request which could not be performed
+ * @param query The query which could not be performed
* @param error The error from the resolver
* @return A new, autoreleased address translation failed exception
*/
-+ (instancetype)exceptionWithRequest: (OFDNSRequest *)request
- error: (of_dns_resolver_error_t)error;
++ (instancetype)exceptionWithQuery: (OFDNSQuery *)query
+ error: (of_dns_resolver_error_t)error;
/*!
* @brief Initializes an already allocated address translation failed exception.
*
- * @param request The request which could not be performed
+ * @param query The query which could not be performed
* @param error The error from the resolver
* @return An initialized address translation failed exception
*/
-- (instancetype)initWithRequest: (OFDNSRequest *)request
- error: (of_dns_resolver_error_t)error;
+- (instancetype)initWithQuery: (OFDNSQuery *)query
+ error: (of_dns_resolver_error_t)error;
@end
OF_ASSUME_NONNULL_END
diff --git a/src/exceptions/OFDNSRequestFailedException.m b/src/exceptions/OFDNSQueryFailedException.m
index 34cc34a6..327e5c9a 100644
--- a/src/exceptions/OFDNSRequestFailedException.m
+++ b/src/exceptions/OFDNSQueryFailedException.m
@@ -17,26 +17,26 @@
#include "config.h"
-#import "OFDNSRequestFailedException.h"
+#import "OFDNSQueryFailedException.h"
#import "OFString.h"
-@implementation OFDNSRequestFailedException
-@synthesize request = _request, error = _error;
+@implementation OFDNSQueryFailedException
+@synthesize query = _query, error = _error;
-+ (instancetype)exceptionWithRequest: (OFDNSRequest *)request
- error: (of_dns_resolver_error_t)error
++ (instancetype)exceptionWithQuery: (OFDNSQuery *)query
+ error: (of_dns_resolver_error_t)error
{
- return [[[self alloc] initWithRequest: request
- error: error] autorelease];
+ return [[[self alloc] initWithQuery: query
+ error: error] autorelease];
}
-- (instancetype)initWithRequest: (OFDNSRequest *)request
- error: (of_dns_resolver_error_t)error
+- (instancetype)initWithQuery: (OFDNSQuery *)query
+ error: (of_dns_resolver_error_t)error
{
self = [super init];
@try {
- _request = [request copy];
+ _query = [query copy];
_error = error;
} @catch (id e) {
[self release];
@@ -48,7 +48,7 @@
- (void)dealloc
{
- [_request release];
+ [_query release];
[super dealloc];
}
@@ -91,6 +91,6 @@
}
return [OFString stringWithFormat:
- @"Request %@ could not be performed: %@", _request, error];
+ @"Query %@ could not be performed: %@", _query, error];
}
@end
diff --git a/utils/ofdns/OFDNS.m b/utils/ofdns/OFDNS.m
index a3b22d8d..53e90bc2 100644
--- a/utils/ofdns/OFDNS.m
+++ b/utils/ofdns/OFDNS.m
@@ -53,7 +53,7 @@ OF_APPLICATION_DELEGATE(OFDNS)
OF_DNS_RESOURCE_RECORD_CLASS_ANY;
of_dns_resource_record_type_t recordType =
OF_DNS_RESOURCE_RECORD_TYPE_ALL;
- OFDNSRequest *request;
+ OFDNSQuery *query;
OFDNSResolver *resolver;
#ifdef OF_HAVE_SANDBOX
@@ -91,10 +91,10 @@ OF_APPLICATION_DELEGATE(OFDNS)
[arguments objectsInRange: of_range(3, 1)];
}
- request = [OFDNSRequest requestWithHost: [arguments objectAtIndex: 0]
- recordClass: recordClass
- recordType: recordType];
- [resolver asyncPerformRequest: request
- delegate: self];
+ query = [OFDNSQuery queryWithHost: [arguments objectAtIndex: 0]
+ recordClass: recordClass
+ recordType: recordType];
+ [resolver asyncPerformQuery: query
+ delegate: self];
}
@end
diff --git a/utils/ofhttp/OFHTTP.m b/utils/ofhttp/OFHTTP.m
index 67d73e35..1086722c 100644
--- a/utils/ofhttp/OFHTTP.m
+++ b/utils/ofhttp/OFHTTP.m
@@ -36,7 +36,7 @@
#import "OFURL.h"
#import "OFConnectionFailedException.h"
-#import "OFDNSRequestFailedException.h"
+#import "OFDNSQueryFailedException.h"
#import "OFHTTPRequestFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFInvalidServerReplyException.h"
@@ -612,14 +612,14 @@ fileNameFromContentDisposition(OFString *contentDisposition)
didFailWithException: (id)e
request: (OFHTTPRequest *)request
{
- if ([e isKindOfClass: [OFDNSRequestFailedException class]]) {
+ if ([e isKindOfClass: [OFDNSQueryFailedException class]]) {
if (!_quiet)
[of_stdout writeString: @"\n"];
[of_stderr writeLine:
- OF_LOCALIZED(@"download_dns_request_failed",
+ OF_LOCALIZED(@"download_dns_query_failed",
@"%[prog]: Failed to download <%[url]>!\n"
- @" DNS request failed: %[exception]",
+ @" DNS query failed: %[exception]",
@"prog", [OFApplication programName],
@"url", request.URL.string,
@"exception", e)];
diff --git a/utils/ofhttp/lang/de.json b/utils/ofhttp/lang/de.json
index 3c9a706a..d0726976 100644
--- a/utils/ofhttp/lang/de.json
+++ b/utils/ofhttp/lang/de.json
@@ -38,9 +38,9 @@
"%[prog]: -o / --output kann nicht mit mehr als einer URL benutzt ",
"werden!"
],
- "download_dns_request_failed": [
+ "download_dns_query_failed": [
"%[prog]: Fehler beim Download von <%[url]>!\n",
- " DNS-Anfrage fehlgeschlagen: %[exception]"
+ " DNS-Abfrage fehlgeschlagen: %[exception]"
],
"download_failed_connection_failed": [
"%[prog]: Fehler beim Download von <%[url]>!\n",