20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
|
#import "OFString.h"
@implementation OFDNSResponse
@synthesize domainName = _domainName, answerRecords = _answerRecords;
@synthesize authorityRecords = _authorityRecords;
@synthesize additionalRecords = _additionalRecords;
+ (instancetype)
responseWithDomainName: (OFString *)domainName
answerRecords: (of_dns_response_records_t)answerRecords
authorityRecords: (of_dns_response_records_t)authorityRecords
additionalRecords: (of_dns_response_records_t)additionalRecords
+ (instancetype)responseWithDomainName: (OFString *)domainName
answerRecords: (OFDNSResponseRecords)answerRecords
authorityRecords: (OFDNSResponseRecords)authorityRecords
additionalRecords: (OFDNSResponseRecords)additionalRecords
{
return [[[self alloc]
initWithDomainName: domainName
answerRecords: answerRecords
authorityRecords: authorityRecords
additionalRecords: additionalRecords] autorelease];
}
- (instancetype)initWithDomainName: (OFString *)domainName
answerRecords: (of_dns_response_records_t)answerRecords
authorityRecords: (of_dns_response_records_t)authorityRecords
additionalRecords: (of_dns_response_records_t)additionalRecords
answerRecords: (OFDNSResponseRecords)answerRecords
authorityRecords: (OFDNSResponseRecords)authorityRecords
additionalRecords: (OFDNSResponseRecords)additionalRecords
{
self = [super init];
@try {
_domainName = [domainName copy];
_answerRecords = [answerRecords copy];
_authorityRecords = [authorityRecords copy];
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
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;
unsigned long hash;
OF_HASH_INIT(hash);
OF_HASH_ADD_HASH(hash, _domainName.hash);
OF_HASH_ADD_HASH(hash, [_answerRecords hash]);
OF_HASH_ADD_HASH(hash, [_authorityRecords hash]);
OF_HASH_ADD_HASH(hash, [_additionalRecords hash]);
OF_HASH_FINALIZE(hash);
OFHashInit(&hash);
OFHashAddHash(&hash, _domainName.hash);
OFHashAddHash(&hash, [_answerRecords hash]);
OFHashAddHash(&hash, [_authorityRecords hash]);
OFHashAddHash(&hash, [_additionalRecords hash]);
OFHashFinalize(&hash);
return hash;
}
- (OFString *)description
{
OFString *answerRecords = [_answerRecords.description
|