@@ -113,512 +113,10 @@ DNSClass: (OFDNSClass)DNSClass recordType: (OFDNSRecordType)recordType TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; @end -/** - * @class OFADNSResourceRecord OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an A DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFADNSResourceRecord: OFDNSResourceRecord -{ - OFSocketAddress _address; -} - -/** - * @brief The IPv4 address of the resource record. - */ -@property (readonly, nonatomic) const OFSocketAddress *address; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFADNSResourceRecord with the - * specified name, class, address and time to live. - * - * @param name The name for the resource record - * @param address The address for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFADNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - address: (const OFSocketAddress *)address - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFAAAADNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class represenging a DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFAAAADNSResourceRecord: OFDNSResourceRecord -{ - OFSocketAddress _address; -} - -/** - * @brief The IPv6 address of the resource record. - */ -@property (readonly, nonatomic) const OFSocketAddress *address; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFAAAADNSResourceRecord with the - * specified name, class, address and time to live. - * - * @param name The name for the resource record - * @param address The address for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFAAAADNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - address: (const OFSocketAddress *)address - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFCNAMEDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing a CNAME DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFCNAMEDNSResourceRecord: OFDNSResourceRecord -{ - OFString *_alias; -} - -/** - * @brief The alias of the resource record. - */ -@property (readonly, nonatomic) OFString *alias; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFCNAMEDNSResourceRecord with the - * specified name, class, alias and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param alias The alias for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFCNAMEDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - alias: (OFString *)alias - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFHINFODNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an HINFO DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFHINFODNSResourceRecord: OFDNSResourceRecord -{ - OFString *_CPU, *_OS; -} - -/** - * @brief The CPU of the host info of the resource record. - */ -@property (readonly, nonatomic) OFString *CPU; - -/** - * @brief The OS of the host info of the resource record. - */ -@property (readonly, nonatomic) OFString *OS; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFHINFODNSResourceRecord with the - * specified name, class, domain name and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param CPU The CPU of the host info for the resource record - * @param OS The OS of the host info for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFHINFODNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - CPU: (OFString *)CPU - OS: (OFString *)OS - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFMXDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an MX DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFMXDNSResourceRecord: OFDNSResourceRecord -{ - uint16_t _preference; - OFString *_mailExchange; -} - -/** - * @brief The preference of the resource record. - */ -@property (readonly, nonatomic) uint16_t preference; - -/** - * @brief The mail exchange of the resource record. - */ -@property (readonly, nonatomic) OFString *mailExchange; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFMXDNSResourceRecord with the - * specified name, class, preference, mail exchange and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param preference The preference for the resource record - * @param mailExchange The mail exchange for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFMXDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - preference: (uint16_t)preference - mailExchange: (OFString *)mailExchange - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFNSDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an NS DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFNSDNSResourceRecord: OFDNSResourceRecord -{ - OFString *_authoritativeHost; -} - -/** - * @brief The authoritative host of the resource record. - */ -@property (readonly, nonatomic) OFString *authoritativeHost; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFNSDNSResourceRecord with the - * specified name, class, authoritative host and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param authoritativeHost The authoritative host for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFNSDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - authoritativeHost: (OFString *)authoritativeHost - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFPTRDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing a PTR DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFPTRDNSResourceRecord: OFDNSResourceRecord -{ - OFString *_domainName; -} - -/** - * @brief The domain name of the resource record. - */ -@property (readonly, nonatomic) OFString *domainName; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFPTRDNSResourceRecord with the - * specified name, class, domain name and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param domainName The domain name for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFPTRDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - domainName: (OFString *)domainName - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFRPNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an RP DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFRPDNSResourceRecord: OFDNSResourceRecord -{ - OFString *_mailbox, *_TXTDomainName; -} - -/** - * @brief The mailbox of the responsible person of the resource record. - */ -@property (readonly, nonatomic) OFString *mailbox; - -/** - * @brief A domain name that contains a TXT resource record for the responsible - * person of the resource record. - */ -@property (readonly, nonatomic) OFString *TXTDomainName; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFRPDNSResourceRecord with the - * specified name, class, alias and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param mailbox The mailbox of the responsible person of the resource record - * @param TXTDomainName A domain name that contains a TXT resource record for - * the responsible person of the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFRPDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - mailbox: (OFString *)mailbox - TXTDomainName: (OFString *)TXTDomainName - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFSOADNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an SOA DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFSOADNSResourceRecord: OFDNSResourceRecord -{ - OFString *_primaryNameServer, *_responsiblePerson; - uint32_t _serialNumber, _refreshInterval, _retryInterval; - uint32_t _expirationInterval, _minTTL; -} - -/** - * @brief The the primary name server for the zone. - */ -@property (readonly, nonatomic) OFString *primaryNameServer; - -/** - * @brief The mailbox of the person responsible for the zone. - */ -@property (readonly, nonatomic) OFString *responsiblePerson; - -/** - * @brief The serial number of the original copy of the zone. - */ -@property (readonly, nonatomic) uint32_t serialNumber; - -/** - * @brief The refresh interval of the zone. - */ -@property (readonly, nonatomic) uint32_t refreshInterval; - -/** - * @brief The retry interval of the zone. - */ -@property (readonly, nonatomic) uint32_t retryInterval; - -/** - * @brief The expiration interval of the zone. - */ -@property (readonly, nonatomic) uint32_t expirationInterval; - -/** - * @brief The minimum TTL of the zone. - */ -@property (readonly, nonatomic) uint32_t minTTL; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFSOADNSResourceRecord with the - * specified name, class, text data and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param primaryNameServer The the primary name server for the zone - * @param responsiblePerson The mailbox of the person responsible for the zone - * @param serialNumber The serial number of the original copy of the zone - * @param refreshInterval The refresh interval of the zone - * @param retryInterval The retry interval of the zone - * @param expirationInterval The expiration interval of the zone - * @param minTTL The minimum TTL of the zone - * @param TTL The time to live for the resource record - * @return An initialized OFSOADNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - primaryNameServer: (OFString *)primaryNameServer - responsiblePerson: (OFString *)responsiblePerson - serialNumber: (uint32_t)serialNumber - refreshInterval: (uint32_t)refreshInterval - retryInterval: (uint32_t)retryInterval - expirationInterval: (uint32_t)expirationInterval - minTTL: (uint32_t)minTTL - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFSRVDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing an SRV DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFSRVDNSResourceRecord: OFDNSResourceRecord -{ - uint16_t _priority, _weight; - OFString *_target; - uint16_t _port; -} - -/** - * @brief The priority of the resource record. - */ -@property (readonly, nonatomic) uint16_t priority; - -/** - * @brief The weight of the resource record. - */ -@property (readonly, nonatomic) uint16_t weight; - -/** - * @brief The target of the resource record. - */ -@property (readonly, nonatomic) OFString *target; - -/** - * @brief The port on the target of the resource record. - */ -@property (readonly, nonatomic) uint16_t port; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFSRVDNSResourceRecord with the - * specified name, class, preference, mail exchange and time to live. - * - * @param name The name for the resource record - * @param priority The priority for the resource record - * @param weight The weight for the resource record - * @param target The target for the resource record - * @param port The port on the target for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFSRVDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - priority: (uint16_t)priority - weight: (uint16_t)weight - target: (OFString *)target - port: (uint16_t)port - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - -/** - * @class OFTXTDNSResourceRecord \ - * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h - * - * @brief A class representing a TXT DNS resource record. - */ -OF_SUBCLASSING_RESTRICTED -@interface OFTXTDNSResourceRecord: OFDNSResourceRecord -{ - OFArray OF_GENERIC(OFData *) *_textStrings; -} - -/** - * @brief The text of the resource record. - */ -@property (readonly, nonatomic) OFArray OF_GENERIC(OFData *) *textStrings; - -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - recordType: (OFDNSRecordType)recordType - TTL: (uint32_t)TTL OF_UNAVAILABLE; - -/** - * @brief Initializes an already allocated OFTXTDNSResourceRecord with the - * specified name, class, text data and time to live. - * - * @param name The name for the resource record - * @param DNSClass The class code for the resource record - * @param textStrings An array of text strings for the resource record - * @param TTL The time to live for the resource record - * @return An initialized OFTXTDNSResourceRecord - */ -- (instancetype)initWithName: (OFString *)name - DNSClass: (OFDNSClass)DNSClass - textStrings: (OFArray OF_GENERIC(OFData *) *)textStrings - TTL: (uint32_t)TTL OF_DESIGNATED_INITIALIZER; -@end - #ifdef __cplusplus extern "C" { #endif /** * @brief Returns the name for the specified OFDNSClass. @@ -656,5 +154,17 @@ #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END + +#import "OFAAAADNSResourceRecord.h" +#import "OFADNSResourceRecord.h" +#import "OFCNAMEDNSResourceRecord.h" +#import "OFHINFODNSResourceRecord.h" +#import "OFMXDNSResourceRecord.h" +#import "OFNSDNSResourceRecord.h" +#import "OFPTRDNSResourceRecord.h" +#import "OFRPDNSResourceRecord.h" +#import "OFSOADNSResourceRecord.h" +#import "OFSRVDNSResourceRecord.h" +#import "OFTXTDNSResourceRecord.h"