From 78817f22008b7a6efc1e2a8ebb1c5c9afbdf89cc Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 26 May 2015 09:06:42 +0200 Subject: [PATCH] Shrink DNSPacketWriter from 104 to 96 bytes --- pdns/dnswriter.hh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pdns/dnswriter.hh b/pdns/dnswriter.hh index 579a23c76..234f87b6b 100644 --- a/pdns/dnswriter.hh +++ b/pdns/dnswriter.hh @@ -38,7 +38,7 @@ class DNSPacketWriter : public boost::noncopyable public: typedef vector > lmap_t; - enum Place {ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; + enum Place : uint8_t {ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; //! Start a DNS Packet in the vector passed, with question qname, qtype and qclass DNSPacketWriter(vector& content, const string& qname, uint16_t qtype, uint16_t qclass=QClass::IN, uint8_t opcode=0); @@ -114,16 +114,20 @@ public: bool eof() { return true; } // we don't know how long the record should be private: + // We declare 1 uint_16 in the public section, these 3 align on a 8-byte boundry + uint16_t d_stuff; + uint16_t d_sor; + uint16_t d_rollbackmarker; // start of last complete packet, for rollback + vector & d_content; vector d_record; string d_qname; string d_recordqname; - uint16_t d_recordqtype, d_recordqclass; - uint32_t d_recordttl; lmap_t d_labelmap; - uint16_t d_stuff; - uint16_t d_sor; - uint16_t d_rollbackmarker; // start of last complete packet, for rollback + + uint32_t d_recordttl; + uint16_t d_recordqtype, d_recordqclass; + uint16_t d_truncatemarker; // end of header, for truncate Place d_recordplace; bool d_canonic, d_lowerCase; -- 2.40.0