Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -269,10 +269,26 @@ return [[[OFADNSResourceRecord alloc] initWithName: name recordClass: recordClass recordType: recordType + data: data + TTL: TTL] autorelease]; + case OF_DNS_RESOURCE_RECORD_TYPE_NS: + j = i; + + data = parseName(buffer, length, &j, + ALLOWED_POINTER_LEVELS); + + if (j != i + dataLength) + @throw [OFInvalidServerReplyException + exception]; + + return [[[OFNSDNSResourceRecord alloc] + initWithName: name + recordClass: recordClass + recordType: recordType data: data TTL: TTL] autorelease]; case OF_DNS_RESOURCE_RECORD_TYPE_CNAME: j = i; @@ -283,10 +299,26 @@ @throw [OFInvalidServerReplyException exception]; return [[[OFCNAMEDNSResourceRecord alloc] initWithName: name + recordClass: recordClass + recordType: recordType + data: data + TTL: TTL] autorelease]; + case OF_DNS_RESOURCE_RECORD_TYPE_PTR: + j = i; + + data = parseName(buffer, length, &j, + ALLOWED_POINTER_LEVELS); + + if (j != i + dataLength) + @throw [OFInvalidServerReplyException + exception]; + + return [[[OFPTRDNSResourceRecord alloc] + initWithName: name recordClass: recordClass recordType: recordType data: data TTL: TTL] autorelease]; case OF_DNS_RESOURCE_RECORD_TYPE_MX: @@ -308,10 +340,20 @@ return [[[OFMXDNSResourceRecord alloc] initWithName: name recordClass: recordClass recordType: recordType preference: preference + data: data + TTL: TTL] autorelease]; + case OF_DNS_RESOURCE_RECORD_TYPE_TXT: + data = [OFData dataWithItems: &buffer[i] + count: dataLength]; + + return [[[OFTXTDNSResourceRecord alloc] + initWithName: name + recordClass: recordClass + recordType: recordType data: data TTL: TTL] autorelease]; case OF_DNS_RESOURCE_RECORD_TYPE_AAAA: if (dataLength != 16) @throw [OFInvalidServerReplyException Index: src/OFDNSResourceRecord.h ================================================================== --- src/OFDNSResourceRecord.h +++ src/OFDNSResourceRecord.h @@ -200,10 +200,49 @@ preference: (uint16_t)preference data: (id)data TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; @end +/*! + * @class OFNSDNSResourceRecord \ + * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h + * + * @brief A class representing a CNAME DNS resource record. + */ +@interface OFNSDNSResourceRecord: OFDNSResourceRecord +/*! + * A string with the authoritative host of the resource record. + */ +@property (readonly, nonatomic) OFString *data; +@end + +/*! + * @class OFPTRDNSResourceRecord \ + * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h + * + * @brief A class representing a CNAME DNS resource record. + */ +@interface OFPTRDNSResourceRecord: OFDNSResourceRecord +/*! + * A string with the domain name for the resource record. + */ +@property (readonly, nonatomic) OFString *data; +@end + +/*! + * @class OFTXTDNSResourceRecord \ + * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h + * + * @brief A class representing a CNAME DNS resource record. + */ +@interface OFTXTDNSResourceRecord: OFDNSResourceRecord +/*! + * Data with the text of the resource record. + */ +@property (readonly, nonatomic) OFString *data; +@end + #ifdef __cplusplus extern "C" { #endif extern OFString *_Nonnull of_dns_resource_record_class_to_string( of_dns_resource_record_class_t recordClass); Index: src/OFDNSResourceRecord.m ================================================================== --- src/OFDNSResourceRecord.m +++ src/OFDNSResourceRecord.m @@ -253,5 +253,17 @@ of_dns_resource_record_class_to_string(_recordClass), of_dns_resource_record_type_to_string(_recordType), _preference, _data, _TTL]; } @end + +@implementation OFNSDNSResourceRecord +@dynamic data; +@end + +@implementation OFPTRDNSResourceRecord +@dynamic data; +@end + +@implementation OFTXTDNSResourceRecord +@dynamic data; +@end