19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFString.h"
@implementation OFDNSQuery
@synthesize domainName = _domainName, DNSClass = _DNSClass;
@synthesize recordType = _recordType;
+ (instancetype)queryWithDomainName: (OFString *)domainName
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_record_type_t)recordType
{
return [[[self alloc] initWithDomainName: domainName
DNSClass: DNSClass
recordType: recordType] autorelease];
}
- (instancetype)initWithDomainName: (OFString *)domainName
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_record_type_t)recordType
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
if (![domainName hasSuffix: @"."])
|
|
|
|
|
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#import "OFString.h"
@implementation OFDNSQuery
@synthesize domainName = _domainName, DNSClass = _DNSClass;
@synthesize recordType = _recordType;
+ (instancetype)queryWithDomainName: (OFString *)domainName
DNSClass: (OFDNSClass)DNSClass
recordType: (OFDNSRecordType)recordType
{
return [[[self alloc] initWithDomainName: domainName
DNSClass: DNSClass
recordType: recordType] autorelease];
}
- (instancetype)initWithDomainName: (OFString *)domainName
DNSClass: (OFDNSClass)DNSClass
recordType: (OFDNSRecordType)recordType
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
if (![domainName hasSuffix: @"."])
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
return false;
return true;
}
- (unsigned long)hash
{
uint32_t hash;
OF_HASH_INIT(hash);
OF_HASH_ADD_HASH(hash, _domainName.hash);
OF_HASH_ADD(hash, _DNSClass);
OF_HASH_ADD(hash, _recordType);
OF_HASH_FINALIZE(hash);
return hash;
}
- (id)copy
{
return [self retain];
}
- (OFString *)description
{
return [OFString stringWithFormat: @"<%@ %@ %@ %@>",
self.className, _domainName, of_dns_class_to_string(_DNSClass),
of_dns_record_type_to_string(_recordType)];
}
@end
|
|
|
|
|
|
|
|
|
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
return false;
return true;
}
- (unsigned long)hash
{
unsigned long hash;
OFHashInit(&hash);
OFHashAddHash(&hash, _domainName.hash);
OFHashAdd(&hash, _DNSClass);
OFHashAdd(&hash, _recordType);
OFHashFinalize(&hash);
return hash;
}
- (id)copy
{
return [self retain];
}
- (OFString *)description
{
return [OFString stringWithFormat: @"<%@ %@ %@ %@>",
self.className, _domainName, OFDNSClassName(_DNSClass),
OFDNSRecordTypeName(_recordType)];
}
@end
|