Differences From Artifact [d423cb9874]:
- File
src/OFDNSQuery.m
— part of check-in
[d69f7bc1ff]
at
2019-10-06 16:27:12
on branch trunk
— Rename OFDNSRequest -> OFDNSQuery
This is now in alignment with the terminology of the RFC. (user: js, size: 2659) [annotate] [blame] [check-ins using]
To Artifact [d09f4dcede]:
- File
src/OFDNSQuery.m
— part of check-in
[ee592cf603]
at
2019-10-07 00:07:55
on branch trunk
— OFDNSResolver: Major refactor
This temporarily doesn't use the search domains anymore and makes CNAMEs
slightly more inefficient. The next commits will fix both. (user: js, size: 2559) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #import "OFDNSQuery.h" #import "OFString.h" @implementation OFDNSQuery | | | < | < < < | | | | | | | < < < < < | < < | > | > > | > > > > | | > | | | | < | 17 18 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 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 | #include "config.h" #import "OFDNSQuery.h" #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_resource_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_resource_record_type_t)recordType { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); if (![domainName hasSuffix: @"."]) domainName = [domainName stringByAppendingString: @"."]; _domainName = [domainName copy]; _DNSClass = DNSClass; _recordType = recordType; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (void)dealloc { [_domainName release]; [super dealloc]; } - (bool)isEqual: (id)object { OFDNSQuery *query; if (![object isKindOfClass: [OFDNSQuery class]]) return false; query = object; if (query->_domainName != _domainName && ![query->_domainName isEqual: _domainName]) return false; if (query->_DNSClass != _DNSClass) return false; if (query->_recordType != _recordType) return false; return true; } - (uint32_t)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_resource_record_type_to_string(_recordType)]; } @end |