From 7c2faec9a19c85b457d09adc34ae1712a2a46440 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 22 May 2015 16:34:23 +0200 Subject: [PATCH] Shrink DNSResourceRecord from 64 to 56 bytes --- pdns/dns.hh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pdns/dns.hh b/pdns/dns.hh index ad7d5ecb3..adebec1e8 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -72,30 +72,34 @@ public: class DNSResourceRecord { public: - DNSResourceRecord() : qclass(1), signttl(0), last_modified(0), d_place(ANSWER), auth(1), disabled(0), scopeMask(0) {}; + DNSResourceRecord() : last_modified(0), signttl(0), qclass(1), d_place(ANSWER), scopeMask(0), auth(1), disabled(0) {}; DNSResourceRecord(const struct DNSRecord&); ~DNSResourceRecord(){}; + enum Place : uint8_t {QUESTION=0, ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; //!< Type describing the positioning of a DNSResourceRecord within, say, a DNSPacket void setContent(const string& content); string getZoneRepresentation() const; // data - - QType qtype; //!< qtype of this record, ie A, CNAME, MX etc - uint16_t qclass; //!< class of this record string qname; //!< the name of this record, for example: www.powerdns.com string wildcardname; string content; //!< what this record points to. Example: 10.1.2.3 + + // Aligned on 8-byte boundries on systems where time_t is 8 bytes and int + // is 4 bytes, aka modern linux on x86_64 + time_t last_modified; //!< For autocalculating SOA serial numbers - the backend needs to fill this in + uint32_t ttl; //!< Time To Live of this record uint32_t signttl; //!< If non-zero, use this TTL as original TTL in the RRSIG + int domain_id; //!< If a backend implements this, the domain_id of the zone this record is in - time_t last_modified; //!< For autocalculating SOA serial numbers - the backend needs to fill this in - enum Place {QUESTION=0, ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; //!< Type describing the positioning of a DNSResourceRecord within, say, a DNSPacket - Place d_place; //!< This specifies where a record goes within the packet + QType qtype; //!< qtype of this record, ie A, CNAME, MX etc + uint16_t qclass; //!< class of this record + Place d_place; //!< This specifies where a record goes within the packet + uint8_t scopeMask; bool auth; bool disabled; - uint8_t scopeMask; template void serialize(Archive & ar, const unsigned int version) -- 2.40.0