]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add a dnspcap2protobuf tool
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 24 Mar 2016 15:09:56 +0000 (16:09 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 25 Mar 2016 19:10:45 +0000 (20:10 +0100)
configure.ac
m4/pdns_enable_protobuf.m4 [moved from pdns/dnsdistdist/m4/dnsdist_enable_protobuf.m4 with 94% similarity]
pdns/Makefile.am
pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/m4/pdns_enable_protobuf.m4 [new symlink]
pdns/dnsmessage.pb.cc [deleted file]
pdns/dnsmessage.pb.h [deleted file]
pdns/dnspcap2protobuf.cc [new file with mode: 0644]

index 2a1f955163fecba3a282b7e31574cff8ea820d41..ba24ec7ab7a0b06182e5784cb00def955ba27e33 100644 (file)
@@ -293,6 +293,8 @@ PDNS_ENABLE_COVERAGE
 PDNS_ENABLE_SANITIZERS
 PDNS_ENABLE_MALLOC_TRACE
 
+PDNS_ENABLE_PROTOBUF
+
 AC_SUBST(LIBS)
 
 AC_SUBST([AM_CPPFLAGS],
similarity index 94%
rename from pdns/dnsdistdist/m4/dnsdist_enable_protobuf.m4
rename to m4/pdns_enable_protobuf.m4
index a1a1332dad9b48ce666d9d3f13699c89b480373a..4c58899e8efa6755da7a18e420506330616f59f2 100644 (file)
@@ -1,4 +1,4 @@
-AC_DEFUN([DNSDIST_ENABLE_PROTOBUF], [
+AC_DEFUN([PDNS_ENABLE_PROTOBUF], [
   AC_MSG_CHECKING([whether to enable protobuf support])
   AC_ARG_ENABLE([protobuf],
     AS_HELP_STRING([--enable-protobuf],[enable protobuf support @<:@default=no@:>@]),
index 15ccfbd279c7bdb7132deb5aa23c370bea6f3e17..e06e28bf51d637bdc87088b1c72227aca4672c1d 100644 (file)
@@ -120,6 +120,10 @@ EXTRA_PROGRAMS = \
        tsig-tests \
        zone2ldap
 
+if HAVE_PROTOBUF
+EXTRA_PROGRAMS += dnspcap2protobuf
+endif
+
 pdns_server_SOURCES = \
        arguments.cc arguments.hh \
        auth-carbon.cc \
@@ -1005,6 +1009,42 @@ dnsdemog_LDFLAGS = \
 dnsdemog_LDADD = \
        $(OPENSSL_LIBS)
 
+dnsmessage.pb.cc: dnsmessage.proto
+       protoc --cpp_out=./ $<
+
+if HAVE_PROTOBUF
+dnspcap2protobuf_SOURCES = \
+       base32.cc \
+       base64.cc base64.hh \
+       dnslabeltext.cc \
+       dnsmessage.pb.cc dnsmessage.pb.h \
+       dnsname.cc dnsname.hh \
+       dnsparser.cc dnsparser.hh \
+       dnspcap.cc dnspcap.hh \
+       dnspcap2protobuf.cc \
+       dnsrecords.cc \
+       dnswriter.cc dnswriter.hh \
+       logger.cc \
+       misc.cc \
+       nsecrecords.cc \
+       qtype.cc \
+       rcpgenerator.cc rcpgenerator.hh \
+       sillyrecords.cc \
+       statbag.cc \
+       unix_utility.cc \
+       utility.hh
+
+dnspcap2protobuf_LDFLAGS = \
+       $(AM_LDFLAGS) \
+       $(OPENSSL_LDFLAGS) \
+       $(BOOST_PROGRAM_OPTIONS_LDFLAGS)
+
+dnspcap2protobuf_LDADD = \
+       $(OPENSSL_LIBS) \
+       $(PROTOBUF_LIBS) \
+       $(BOOST_PROGRAM_OPTIONS_LIBS)
+endif
+
 testrunner_SOURCES = \
        arguments.cc \
        base32.cc \
index ccb13eb4a3819b0ec1db9aa09aabe5bead1bb4d2..5bd39de776c5802a14ebf22595184d9cb09279ff 100644 (file)
@@ -17,7 +17,7 @@ BOOST_FOREACH
 PDNS_ENABLE_UNIT_TESTS
 PDNS_CHECK_RE2
 DNSDIST_ENABLE_DNSCRYPT
-DNSDIST_ENABLE_PROTOBUF
+PDNS_ENABLE_PROTOBUF
 
 AC_SUBST([YAHTTP_CFLAGS], ['-I$(top_srcdir)/ext/yahttp'])
 AC_SUBST([YAHTTP_LIBS], ['$(top_builddir)/ext/yahttp/yahttp/libyahttp.la'])
diff --git a/pdns/dnsdistdist/m4/pdns_enable_protobuf.m4 b/pdns/dnsdistdist/m4/pdns_enable_protobuf.m4
new file mode 120000 (symlink)
index 0000000..31d73d8
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/pdns_enable_protobuf.m4
\ No newline at end of file
diff --git a/pdns/dnsmessage.pb.cc b/pdns/dnsmessage.pb.cc
deleted file mode 100644 (file)
index 65f7c92..0000000
+++ /dev/null
@@ -1,2066 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: pdns/dnsmessage.proto
-
-#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
-#include "dnsmessage.pb.h"
-
-#include <algorithm>
-
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/generated_message_reflection.h>
-#include <google/protobuf/reflection_ops.h>
-#include <google/protobuf/wire_format.h>
-// @@protoc_insertion_point(includes)
-
-namespace {
-
-const ::google::protobuf::Descriptor* PBDNSMessage_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
-  PBDNSMessage_reflection_ = NULL;
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSQuestion_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
-  PBDNSMessage_DNSQuestion_reflection_ = NULL;
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSResponse_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
-  PBDNSMessage_DNSResponse_reflection_ = NULL;
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSResponse_DNSRR_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
-  PBDNSMessage_DNSResponse_DNSRR_reflection_ = NULL;
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_Type_descriptor_ = NULL;
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketFamily_descriptor_ = NULL;
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketProtocol_descriptor_ = NULL;
-
-}  // namespace
-
-
-void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto() {
-  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  const ::google::protobuf::FileDescriptor* file =
-    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
-      "pdns/dnsmessage.proto");
-  GOOGLE_CHECK(file != NULL);
-  PBDNSMessage_descriptor_ = file->message_type(0);
-  static const int PBDNSMessage_offsets_[13] = {
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, type_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, messageid_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, serveridentity_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, socketfamily_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, socketprotocol_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, from_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, to_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, inbytes_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, timesec_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, timeusec_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, id_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, question_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, response_),
-  };
-  PBDNSMessage_reflection_ =
-    new ::google::protobuf::internal::GeneratedMessageReflection(
-      PBDNSMessage_descriptor_,
-      PBDNSMessage::default_instance_,
-      PBDNSMessage_offsets_,
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, _has_bits_[0]),
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage, _unknown_fields_),
-      -1,
-      ::google::protobuf::DescriptorPool::generated_pool(),
-      ::google::protobuf::MessageFactory::generated_factory(),
-      sizeof(PBDNSMessage));
-  PBDNSMessage_DNSQuestion_descriptor_ = PBDNSMessage_descriptor_->nested_type(0);
-  static const int PBDNSMessage_DNSQuestion_offsets_[3] = {
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSQuestion, qname_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSQuestion, qtype_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSQuestion, qclass_),
-  };
-  PBDNSMessage_DNSQuestion_reflection_ =
-    new ::google::protobuf::internal::GeneratedMessageReflection(
-      PBDNSMessage_DNSQuestion_descriptor_,
-      PBDNSMessage_DNSQuestion::default_instance_,
-      PBDNSMessage_DNSQuestion_offsets_,
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSQuestion, _has_bits_[0]),
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSQuestion, _unknown_fields_),
-      -1,
-      ::google::protobuf::DescriptorPool::generated_pool(),
-      ::google::protobuf::MessageFactory::generated_factory(),
-      sizeof(PBDNSMessage_DNSQuestion));
-  PBDNSMessage_DNSResponse_descriptor_ = PBDNSMessage_descriptor_->nested_type(1);
-  static const int PBDNSMessage_DNSResponse_offsets_[2] = {
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse, rcode_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse, rrs_),
-  };
-  PBDNSMessage_DNSResponse_reflection_ =
-    new ::google::protobuf::internal::GeneratedMessageReflection(
-      PBDNSMessage_DNSResponse_descriptor_,
-      PBDNSMessage_DNSResponse::default_instance_,
-      PBDNSMessage_DNSResponse_offsets_,
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse, _has_bits_[0]),
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse, _unknown_fields_),
-      -1,
-      ::google::protobuf::DescriptorPool::generated_pool(),
-      ::google::protobuf::MessageFactory::generated_factory(),
-      sizeof(PBDNSMessage_DNSResponse));
-  PBDNSMessage_DNSResponse_DNSRR_descriptor_ = PBDNSMessage_DNSResponse_descriptor_->nested_type(0);
-  static const int PBDNSMessage_DNSResponse_DNSRR_offsets_[5] = {
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, name_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, type_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, class__),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, ttl_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, rdata_),
-  };
-  PBDNSMessage_DNSResponse_DNSRR_reflection_ =
-    new ::google::protobuf::internal::GeneratedMessageReflection(
-      PBDNSMessage_DNSResponse_DNSRR_descriptor_,
-      PBDNSMessage_DNSResponse_DNSRR::default_instance_,
-      PBDNSMessage_DNSResponse_DNSRR_offsets_,
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, _has_bits_[0]),
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PBDNSMessage_DNSResponse_DNSRR, _unknown_fields_),
-      -1,
-      ::google::protobuf::DescriptorPool::generated_pool(),
-      ::google::protobuf::MessageFactory::generated_factory(),
-      sizeof(PBDNSMessage_DNSResponse_DNSRR));
-  PBDNSMessage_Type_descriptor_ = PBDNSMessage_descriptor_->enum_type(0);
-  PBDNSMessage_SocketFamily_descriptor_ = PBDNSMessage_descriptor_->enum_type(1);
-  PBDNSMessage_SocketProtocol_descriptor_ = PBDNSMessage_descriptor_->enum_type(2);
-}
-
-namespace {
-
-GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
-inline void protobuf_AssignDescriptorsOnce() {
-  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
-                 &protobuf_AssignDesc_pdns_2fdnsmessage_2eproto);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
-    PBDNSMessage_descriptor_, &PBDNSMessage::default_instance());
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
-    PBDNSMessage_DNSQuestion_descriptor_, &PBDNSMessage_DNSQuestion::default_instance());
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
-    PBDNSMessage_DNSResponse_descriptor_, &PBDNSMessage_DNSResponse::default_instance());
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
-    PBDNSMessage_DNSResponse_DNSRR_descriptor_, &PBDNSMessage_DNSResponse_DNSRR::default_instance());
-}
-
-}  // namespace
-
-void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto() {
-  delete PBDNSMessage::default_instance_;
-  delete PBDNSMessage_reflection_;
-  delete PBDNSMessage_DNSQuestion::default_instance_;
-  delete PBDNSMessage_DNSQuestion_reflection_;
-  delete PBDNSMessage_DNSResponse::default_instance_;
-  delete PBDNSMessage_DNSResponse_reflection_;
-  delete PBDNSMessage_DNSResponse_DNSRR::default_instance_;
-  delete PBDNSMessage_DNSResponse_DNSRR_reflection_;
-}
-
-void protobuf_AddDesc_pdns_2fdnsmessage_2eproto() {
-  static bool already_here = false;
-  if (already_here) return;
-  already_here = true;
-  GOOGLE_PROTOBUF_VERIFY_VERSION;
-
-  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-    "\n\025pdns/dnsmessage.proto\"\311\005\n\014PBDNSMessage"
-    "\022 \n\004type\030\001 \002(\0162\022.PBDNSMessage.Type\022\021\n\tme"
-    "ssageId\030\002 \001(\014\022\026\n\016serverIdentity\030\003 \001(\014\0220\n"
-    "\014socketFamily\030\004 \001(\0162\032.PBDNSMessage.Socke"
-    "tFamily\0224\n\016socketProtocol\030\005 \001(\0162\034.PBDNSM"
-    "essage.SocketProtocol\022\014\n\004from\030\006 \001(\014\022\n\n\002t"
-    "o\030\007 \001(\014\022\017\n\007inBytes\030\010 \001(\004\022\017\n\007timeSec\030\t \001("
-    "\r\022\020\n\010timeUsec\030\n \001(\r\022\n\n\002id\030\013 \001(\r\022+\n\010quest"
-    "ion\030\014 \001(\0132\031.PBDNSMessage.DNSQuestion\022+\n\010"
-    "response\030\r \001(\0132\031.PBDNSMessage.DNSRespons"
-    "e\032;\n\013DNSQuestion\022\r\n\005qName\030\001 \001(\t\022\r\n\005qType"
-    "\030\002 \001(\r\022\016\n\006qClass\030\003 \001(\r\032\232\001\n\013DNSResponse\022\r"
-    "\n\005rcode\030\001 \001(\r\022,\n\003rrs\030\002 \003(\0132\037.PBDNSMessag"
-    "e.DNSResponse.DNSRR\032N\n\005DNSRR\022\014\n\004name\030\001 \001"
-    "(\t\022\014\n\004type\030\002 \001(\r\022\r\n\005class\030\003 \001(\r\022\013\n\003ttl\030\004"
-    " \001(\r\022\r\n\005rdata\030\005 \001(\014\"-\n\004Type\022\020\n\014DNSQueryT"
-    "ype\020\001\022\023\n\017DNSResponseType\020\002\"#\n\014SocketFami"
-    "ly\022\010\n\004INET\020\001\022\t\n\005INET6\020\002\"\"\n\016SocketProtoco"
-    "l\022\007\n\003UDP\020\001\022\007\n\003TCP\020\002", 739);
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
-    "pdns/dnsmessage.proto", &protobuf_RegisterTypes);
-  PBDNSMessage::default_instance_ = new PBDNSMessage();
-  PBDNSMessage_DNSQuestion::default_instance_ = new PBDNSMessage_DNSQuestion();
-  PBDNSMessage_DNSResponse::default_instance_ = new PBDNSMessage_DNSResponse();
-  PBDNSMessage_DNSResponse_DNSRR::default_instance_ = new PBDNSMessage_DNSResponse_DNSRR();
-  PBDNSMessage::default_instance_->InitAsDefaultInstance();
-  PBDNSMessage_DNSQuestion::default_instance_->InitAsDefaultInstance();
-  PBDNSMessage_DNSResponse::default_instance_->InitAsDefaultInstance();
-  PBDNSMessage_DNSResponse_DNSRR::default_instance_->InitAsDefaultInstance();
-  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto);
-}
-
-// Force AddDescriptors() to be called at static initialization time.
-struct StaticDescriptorInitializer_pdns_2fdnsmessage_2eproto {
-  StaticDescriptorInitializer_pdns_2fdnsmessage_2eproto() {
-    protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  }
-} static_descriptor_initializer_pdns_2fdnsmessage_2eproto_;
-
-// ===================================================================
-
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_Type_descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_Type_descriptor_;
-}
-bool PBDNSMessage_Type_IsValid(int value) {
-  switch(value) {
-    case 1:
-    case 2:
-      return true;
-    default:
-      return false;
-  }
-}
-
-#ifndef _MSC_VER
-const PBDNSMessage_Type PBDNSMessage::DNSQueryType;
-const PBDNSMessage_Type PBDNSMessage::DNSResponseType;
-const PBDNSMessage_Type PBDNSMessage::Type_MIN;
-const PBDNSMessage_Type PBDNSMessage::Type_MAX;
-const int PBDNSMessage::Type_ARRAYSIZE;
-#endif  // _MSC_VER
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketFamily_descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_SocketFamily_descriptor_;
-}
-bool PBDNSMessage_SocketFamily_IsValid(int value) {
-  switch(value) {
-    case 1:
-    case 2:
-      return true;
-    default:
-      return false;
-  }
-}
-
-#ifndef _MSC_VER
-const PBDNSMessage_SocketFamily PBDNSMessage::INET;
-const PBDNSMessage_SocketFamily PBDNSMessage::INET6;
-const PBDNSMessage_SocketFamily PBDNSMessage::SocketFamily_MIN;
-const PBDNSMessage_SocketFamily PBDNSMessage::SocketFamily_MAX;
-const int PBDNSMessage::SocketFamily_ARRAYSIZE;
-#endif  // _MSC_VER
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketProtocol_descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_SocketProtocol_descriptor_;
-}
-bool PBDNSMessage_SocketProtocol_IsValid(int value) {
-  switch(value) {
-    case 1:
-    case 2:
-      return true;
-    default:
-      return false;
-  }
-}
-
-#ifndef _MSC_VER
-const PBDNSMessage_SocketProtocol PBDNSMessage::UDP;
-const PBDNSMessage_SocketProtocol PBDNSMessage::TCP;
-const PBDNSMessage_SocketProtocol PBDNSMessage::SocketProtocol_MIN;
-const PBDNSMessage_SocketProtocol PBDNSMessage::SocketProtocol_MAX;
-const int PBDNSMessage::SocketProtocol_ARRAYSIZE;
-#endif  // _MSC_VER
-#ifndef _MSC_VER
-const int PBDNSMessage_DNSQuestion::kQNameFieldNumber;
-const int PBDNSMessage_DNSQuestion::kQTypeFieldNumber;
-const int PBDNSMessage_DNSQuestion::kQClassFieldNumber;
-#endif  // !_MSC_VER
-
-PBDNSMessage_DNSQuestion::PBDNSMessage_DNSQuestion()
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  // @@protoc_insertion_point(constructor:PBDNSMessage.DNSQuestion)
-}
-
-void PBDNSMessage_DNSQuestion::InitAsDefaultInstance() {
-}
-
-PBDNSMessage_DNSQuestion::PBDNSMessage_DNSQuestion(const PBDNSMessage_DNSQuestion& from)
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  MergeFrom(from);
-  // @@protoc_insertion_point(copy_constructor:PBDNSMessage.DNSQuestion)
-}
-
-void PBDNSMessage_DNSQuestion::SharedCtor() {
-  ::google::protobuf::internal::GetEmptyString();
-  _cached_size_ = 0;
-  qname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  qtype_ = 0u;
-  qclass_ = 0u;
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-PBDNSMessage_DNSQuestion::~PBDNSMessage_DNSQuestion() {
-  // @@protoc_insertion_point(destructor:PBDNSMessage.DNSQuestion)
-  SharedDtor();
-}
-
-void PBDNSMessage_DNSQuestion::SharedDtor() {
-  if (qname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete qname_;
-  }
-  if (this != default_instance_) {
-  }
-}
-
-void PBDNSMessage_DNSQuestion::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSQuestion::descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_DNSQuestion_descriptor_;
-}
-
-const PBDNSMessage_DNSQuestion& PBDNSMessage_DNSQuestion::default_instance() {
-  if (default_instance_ == NULL) protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  return *default_instance_;
-}
-
-PBDNSMessage_DNSQuestion* PBDNSMessage_DNSQuestion::default_instance_ = NULL;
-
-PBDNSMessage_DNSQuestion* PBDNSMessage_DNSQuestion::New() const {
-  return new PBDNSMessage_DNSQuestion;
-}
-
-void PBDNSMessage_DNSQuestion::Clear() {
-#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>(      \
-  &reinterpret_cast<PBDNSMessage_DNSQuestion*>(16)->f) - \
-   reinterpret_cast<char*>(16))
-
-#define ZR_(first, last) do {                              \
-    size_t f = OFFSET_OF_FIELD_(first);                    \
-    size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last);  \
-    ::memset(&first, 0, n);                                \
-  } while (0)
-
-  if (_has_bits_[0 / 32] & 7) {
-    ZR_(qtype_, qclass_);
-    if (has_qname()) {
-      if (qname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        qname_->clear();
-      }
-    }
-  }
-
-#undef OFFSET_OF_FIELD_
-#undef ZR_
-
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-  mutable_unknown_fields()->Clear();
-}
-
-bool PBDNSMessage_DNSQuestion::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
-  // @@protoc_insertion_point(parse_start:PBDNSMessage.DNSQuestion)
-  for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
-    tag = p.first;
-    if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
-      // optional string qName = 1;
-      case 1: {
-        if (tag == 10) {
-          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
-                input, this->mutable_qname()));
-          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->qname().data(), this->qname().length(),
-            ::google::protobuf::internal::WireFormat::PARSE,
-            "qname");
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(16)) goto parse_qType;
-        break;
-      }
-
-      // optional uint32 qType = 2;
-      case 2: {
-        if (tag == 16) {
-         parse_qType:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &qtype_)));
-          set_has_qtype();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(24)) goto parse_qClass;
-        break;
-      }
-
-      // optional uint32 qClass = 3;
-      case 3: {
-        if (tag == 24) {
-         parse_qClass:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &qclass_)));
-          set_has_qclass();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectAtEnd()) goto success;
-        break;
-      }
-
-      default: {
-      handle_unusual:
-        if (tag == 0 ||
-            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
-          goto success;
-        }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
-              input, tag, mutable_unknown_fields()));
-        break;
-      }
-    }
-  }
-success:
-  // @@protoc_insertion_point(parse_success:PBDNSMessage.DNSQuestion)
-  return true;
-failure:
-  // @@protoc_insertion_point(parse_failure:PBDNSMessage.DNSQuestion)
-  return false;
-#undef DO_
-}
-
-void PBDNSMessage_DNSQuestion::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
-  // @@protoc_insertion_point(serialize_start:PBDNSMessage.DNSQuestion)
-  // optional string qName = 1;
-  if (has_qname()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->qname().data(), this->qname().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE,
-      "qname");
-    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
-      1, this->qname(), output);
-  }
-
-  // optional uint32 qType = 2;
-  if (has_qtype()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->qtype(), output);
-  }
-
-  // optional uint32 qClass = 3;
-  if (has_qclass()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->qclass(), output);
-  }
-
-  if (!unknown_fields().empty()) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        unknown_fields(), output);
-  }
-  // @@protoc_insertion_point(serialize_end:PBDNSMessage.DNSQuestion)
-}
-
-::google::protobuf::uint8* PBDNSMessage_DNSQuestion::SerializeWithCachedSizesToArray(
-    ::google::protobuf::uint8* target) const {
-  // @@protoc_insertion_point(serialize_to_array_start:PBDNSMessage.DNSQuestion)
-  // optional string qName = 1;
-  if (has_qname()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->qname().data(), this->qname().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE,
-      "qname");
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
-        1, this->qname(), target);
-  }
-
-  // optional uint32 qType = 2;
-  if (has_qtype()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->qtype(), target);
-  }
-
-  // optional uint32 qClass = 3;
-  if (has_qclass()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->qclass(), target);
-  }
-
-  if (!unknown_fields().empty()) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        unknown_fields(), target);
-  }
-  // @@protoc_insertion_point(serialize_to_array_end:PBDNSMessage.DNSQuestion)
-  return target;
-}
-
-int PBDNSMessage_DNSQuestion::ByteSize() const {
-  int total_size = 0;
-
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    // optional string qName = 1;
-    if (has_qname()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::StringSize(
-          this->qname());
-    }
-
-    // optional uint32 qType = 2;
-    if (has_qtype()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->qtype());
-    }
-
-    // optional uint32 qClass = 3;
-    if (has_qclass()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->qclass());
-    }
-
-  }
-  if (!unknown_fields().empty()) {
-    total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        unknown_fields());
-  }
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = total_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-  return total_size;
-}
-
-void PBDNSMessage_DNSQuestion::MergeFrom(const ::google::protobuf::Message& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  const PBDNSMessage_DNSQuestion* source =
-    ::google::protobuf::internal::dynamic_cast_if_available<const PBDNSMessage_DNSQuestion*>(
-      &from);
-  if (source == NULL) {
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
-  } else {
-    MergeFrom(*source);
-  }
-}
-
-void PBDNSMessage_DNSQuestion::MergeFrom(const PBDNSMessage_DNSQuestion& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    if (from.has_qname()) {
-      set_qname(from.qname());
-    }
-    if (from.has_qtype()) {
-      set_qtype(from.qtype());
-    }
-    if (from.has_qclass()) {
-      set_qclass(from.qclass());
-    }
-  }
-  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void PBDNSMessage_DNSQuestion::CopyFrom(const ::google::protobuf::Message& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-void PBDNSMessage_DNSQuestion::CopyFrom(const PBDNSMessage_DNSQuestion& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-bool PBDNSMessage_DNSQuestion::IsInitialized() const {
-
-  return true;
-}
-
-void PBDNSMessage_DNSQuestion::Swap(PBDNSMessage_DNSQuestion* other) {
-  if (other != this) {
-    std::swap(qname_, other->qname_);
-    std::swap(qtype_, other->qtype_);
-    std::swap(qclass_, other->qclass_);
-    std::swap(_has_bits_[0], other->_has_bits_[0]);
-    _unknown_fields_.Swap(&other->_unknown_fields_);
-    std::swap(_cached_size_, other->_cached_size_);
-  }
-}
-
-::google::protobuf::Metadata PBDNSMessage_DNSQuestion::GetMetadata() const {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::Metadata metadata;
-  metadata.descriptor = PBDNSMessage_DNSQuestion_descriptor_;
-  metadata.reflection = PBDNSMessage_DNSQuestion_reflection_;
-  return metadata;
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int PBDNSMessage_DNSResponse_DNSRR::kNameFieldNumber;
-const int PBDNSMessage_DNSResponse_DNSRR::kTypeFieldNumber;
-const int PBDNSMessage_DNSResponse_DNSRR::kClassFieldNumber;
-const int PBDNSMessage_DNSResponse_DNSRR::kTtlFieldNumber;
-const int PBDNSMessage_DNSResponse_DNSRR::kRdataFieldNumber;
-#endif  // !_MSC_VER
-
-PBDNSMessage_DNSResponse_DNSRR::PBDNSMessage_DNSResponse_DNSRR()
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  // @@protoc_insertion_point(constructor:PBDNSMessage.DNSResponse.DNSRR)
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::InitAsDefaultInstance() {
-}
-
-PBDNSMessage_DNSResponse_DNSRR::PBDNSMessage_DNSResponse_DNSRR(const PBDNSMessage_DNSResponse_DNSRR& from)
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  MergeFrom(from);
-  // @@protoc_insertion_point(copy_constructor:PBDNSMessage.DNSResponse.DNSRR)
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::SharedCtor() {
-  ::google::protobuf::internal::GetEmptyString();
-  _cached_size_ = 0;
-  name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  type_ = 0u;
-  class__ = 0u;
-  ttl_ = 0u;
-  rdata_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-PBDNSMessage_DNSResponse_DNSRR::~PBDNSMessage_DNSResponse_DNSRR() {
-  // @@protoc_insertion_point(destructor:PBDNSMessage.DNSResponse.DNSRR)
-  SharedDtor();
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::SharedDtor() {
-  if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete name_;
-  }
-  if (rdata_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete rdata_;
-  }
-  if (this != default_instance_) {
-  }
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSResponse_DNSRR::descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_DNSResponse_DNSRR_descriptor_;
-}
-
-const PBDNSMessage_DNSResponse_DNSRR& PBDNSMessage_DNSResponse_DNSRR::default_instance() {
-  if (default_instance_ == NULL) protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  return *default_instance_;
-}
-
-PBDNSMessage_DNSResponse_DNSRR* PBDNSMessage_DNSResponse_DNSRR::default_instance_ = NULL;
-
-PBDNSMessage_DNSResponse_DNSRR* PBDNSMessage_DNSResponse_DNSRR::New() const {
-  return new PBDNSMessage_DNSResponse_DNSRR;
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::Clear() {
-#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>(      \
-  &reinterpret_cast<PBDNSMessage_DNSResponse_DNSRR*>(16)->f) - \
-   reinterpret_cast<char*>(16))
-
-#define ZR_(first, last) do {                              \
-    size_t f = OFFSET_OF_FIELD_(first);                    \
-    size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last);  \
-    ::memset(&first, 0, n);                                \
-  } while (0)
-
-  if (_has_bits_[0 / 32] & 31) {
-    ZR_(type_, class__);
-    if (has_name()) {
-      if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        name_->clear();
-      }
-    }
-    ttl_ = 0u;
-    if (has_rdata()) {
-      if (rdata_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        rdata_->clear();
-      }
-    }
-  }
-
-#undef OFFSET_OF_FIELD_
-#undef ZR_
-
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-  mutable_unknown_fields()->Clear();
-}
-
-bool PBDNSMessage_DNSResponse_DNSRR::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
-  // @@protoc_insertion_point(parse_start:PBDNSMessage.DNSResponse.DNSRR)
-  for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
-    tag = p.first;
-    if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
-      // optional string name = 1;
-      case 1: {
-        if (tag == 10) {
-          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
-                input, this->mutable_name()));
-          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-            this->name().data(), this->name().length(),
-            ::google::protobuf::internal::WireFormat::PARSE,
-            "name");
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(16)) goto parse_type;
-        break;
-      }
-
-      // optional uint32 type = 2;
-      case 2: {
-        if (tag == 16) {
-         parse_type:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &type_)));
-          set_has_type();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(24)) goto parse_class;
-        break;
-      }
-
-      // optional uint32 class = 3;
-      case 3: {
-        if (tag == 24) {
-         parse_class:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &class__)));
-          set_has_class_();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(32)) goto parse_ttl;
-        break;
-      }
-
-      // optional uint32 ttl = 4;
-      case 4: {
-        if (tag == 32) {
-         parse_ttl:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &ttl_)));
-          set_has_ttl();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(42)) goto parse_rdata;
-        break;
-      }
-
-      // optional bytes rdata = 5;
-      case 5: {
-        if (tag == 42) {
-         parse_rdata:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
-                input, this->mutable_rdata()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectAtEnd()) goto success;
-        break;
-      }
-
-      default: {
-      handle_unusual:
-        if (tag == 0 ||
-            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
-          goto success;
-        }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
-              input, tag, mutable_unknown_fields()));
-        break;
-      }
-    }
-  }
-success:
-  // @@protoc_insertion_point(parse_success:PBDNSMessage.DNSResponse.DNSRR)
-  return true;
-failure:
-  // @@protoc_insertion_point(parse_failure:PBDNSMessage.DNSResponse.DNSRR)
-  return false;
-#undef DO_
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
-  // @@protoc_insertion_point(serialize_start:PBDNSMessage.DNSResponse.DNSRR)
-  // optional string name = 1;
-  if (has_name()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE,
-      "name");
-    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
-      1, this->name(), output);
-  }
-
-  // optional uint32 type = 2;
-  if (has_type()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->type(), output);
-  }
-
-  // optional uint32 class = 3;
-  if (has_class_()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->class_(), output);
-  }
-
-  // optional uint32 ttl = 4;
-  if (has_ttl()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->ttl(), output);
-  }
-
-  // optional bytes rdata = 5;
-  if (has_rdata()) {
-    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
-      5, this->rdata(), output);
-  }
-
-  if (!unknown_fields().empty()) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        unknown_fields(), output);
-  }
-  // @@protoc_insertion_point(serialize_end:PBDNSMessage.DNSResponse.DNSRR)
-}
-
-::google::protobuf::uint8* PBDNSMessage_DNSResponse_DNSRR::SerializeWithCachedSizesToArray(
-    ::google::protobuf::uint8* target) const {
-  // @@protoc_insertion_point(serialize_to_array_start:PBDNSMessage.DNSResponse.DNSRR)
-  // optional string name = 1;
-  if (has_name()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
-      this->name().data(), this->name().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE,
-      "name");
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
-        1, this->name(), target);
-  }
-
-  // optional uint32 type = 2;
-  if (has_type()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->type(), target);
-  }
-
-  // optional uint32 class = 3;
-  if (has_class_()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->class_(), target);
-  }
-
-  // optional uint32 ttl = 4;
-  if (has_ttl()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->ttl(), target);
-  }
-
-  // optional bytes rdata = 5;
-  if (has_rdata()) {
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
-        5, this->rdata(), target);
-  }
-
-  if (!unknown_fields().empty()) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        unknown_fields(), target);
-  }
-  // @@protoc_insertion_point(serialize_to_array_end:PBDNSMessage.DNSResponse.DNSRR)
-  return target;
-}
-
-int PBDNSMessage_DNSResponse_DNSRR::ByteSize() const {
-  int total_size = 0;
-
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    // optional string name = 1;
-    if (has_name()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::StringSize(
-          this->name());
-    }
-
-    // optional uint32 type = 2;
-    if (has_type()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->type());
-    }
-
-    // optional uint32 class = 3;
-    if (has_class_()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->class_());
-    }
-
-    // optional uint32 ttl = 4;
-    if (has_ttl()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->ttl());
-    }
-
-    // optional bytes rdata = 5;
-    if (has_rdata()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::BytesSize(
-          this->rdata());
-    }
-
-  }
-  if (!unknown_fields().empty()) {
-    total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        unknown_fields());
-  }
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = total_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-  return total_size;
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::MergeFrom(const ::google::protobuf::Message& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  const PBDNSMessage_DNSResponse_DNSRR* source =
-    ::google::protobuf::internal::dynamic_cast_if_available<const PBDNSMessage_DNSResponse_DNSRR*>(
-      &from);
-  if (source == NULL) {
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
-  } else {
-    MergeFrom(*source);
-  }
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::MergeFrom(const PBDNSMessage_DNSResponse_DNSRR& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    if (from.has_name()) {
-      set_name(from.name());
-    }
-    if (from.has_type()) {
-      set_type(from.type());
-    }
-    if (from.has_class_()) {
-      set_class_(from.class_());
-    }
-    if (from.has_ttl()) {
-      set_ttl(from.ttl());
-    }
-    if (from.has_rdata()) {
-      set_rdata(from.rdata());
-    }
-  }
-  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::CopyFrom(const ::google::protobuf::Message& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::CopyFrom(const PBDNSMessage_DNSResponse_DNSRR& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-bool PBDNSMessage_DNSResponse_DNSRR::IsInitialized() const {
-
-  return true;
-}
-
-void PBDNSMessage_DNSResponse_DNSRR::Swap(PBDNSMessage_DNSResponse_DNSRR* other) {
-  if (other != this) {
-    std::swap(name_, other->name_);
-    std::swap(type_, other->type_);
-    std::swap(class__, other->class__);
-    std::swap(ttl_, other->ttl_);
-    std::swap(rdata_, other->rdata_);
-    std::swap(_has_bits_[0], other->_has_bits_[0]);
-    _unknown_fields_.Swap(&other->_unknown_fields_);
-    std::swap(_cached_size_, other->_cached_size_);
-  }
-}
-
-::google::protobuf::Metadata PBDNSMessage_DNSResponse_DNSRR::GetMetadata() const {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::Metadata metadata;
-  metadata.descriptor = PBDNSMessage_DNSResponse_DNSRR_descriptor_;
-  metadata.reflection = PBDNSMessage_DNSResponse_DNSRR_reflection_;
-  return metadata;
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int PBDNSMessage_DNSResponse::kRcodeFieldNumber;
-const int PBDNSMessage_DNSResponse::kRrsFieldNumber;
-#endif  // !_MSC_VER
-
-PBDNSMessage_DNSResponse::PBDNSMessage_DNSResponse()
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  // @@protoc_insertion_point(constructor:PBDNSMessage.DNSResponse)
-}
-
-void PBDNSMessage_DNSResponse::InitAsDefaultInstance() {
-}
-
-PBDNSMessage_DNSResponse::PBDNSMessage_DNSResponse(const PBDNSMessage_DNSResponse& from)
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  MergeFrom(from);
-  // @@protoc_insertion_point(copy_constructor:PBDNSMessage.DNSResponse)
-}
-
-void PBDNSMessage_DNSResponse::SharedCtor() {
-  _cached_size_ = 0;
-  rcode_ = 0u;
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-PBDNSMessage_DNSResponse::~PBDNSMessage_DNSResponse() {
-  // @@protoc_insertion_point(destructor:PBDNSMessage.DNSResponse)
-  SharedDtor();
-}
-
-void PBDNSMessage_DNSResponse::SharedDtor() {
-  if (this != default_instance_) {
-  }
-}
-
-void PBDNSMessage_DNSResponse::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* PBDNSMessage_DNSResponse::descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_DNSResponse_descriptor_;
-}
-
-const PBDNSMessage_DNSResponse& PBDNSMessage_DNSResponse::default_instance() {
-  if (default_instance_ == NULL) protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  return *default_instance_;
-}
-
-PBDNSMessage_DNSResponse* PBDNSMessage_DNSResponse::default_instance_ = NULL;
-
-PBDNSMessage_DNSResponse* PBDNSMessage_DNSResponse::New() const {
-  return new PBDNSMessage_DNSResponse;
-}
-
-void PBDNSMessage_DNSResponse::Clear() {
-  rcode_ = 0u;
-  rrs_.Clear();
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-  mutable_unknown_fields()->Clear();
-}
-
-bool PBDNSMessage_DNSResponse::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
-  // @@protoc_insertion_point(parse_start:PBDNSMessage.DNSResponse)
-  for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
-    tag = p.first;
-    if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
-      // optional uint32 rcode = 1;
-      case 1: {
-        if (tag == 8) {
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &rcode_)));
-          set_has_rcode();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(18)) goto parse_rrs;
-        break;
-      }
-
-      // repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-      case 2: {
-        if (tag == 18) {
-         parse_rrs:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
-                input, add_rrs()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(18)) goto parse_rrs;
-        if (input->ExpectAtEnd()) goto success;
-        break;
-      }
-
-      default: {
-      handle_unusual:
-        if (tag == 0 ||
-            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
-          goto success;
-        }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
-              input, tag, mutable_unknown_fields()));
-        break;
-      }
-    }
-  }
-success:
-  // @@protoc_insertion_point(parse_success:PBDNSMessage.DNSResponse)
-  return true;
-failure:
-  // @@protoc_insertion_point(parse_failure:PBDNSMessage.DNSResponse)
-  return false;
-#undef DO_
-}
-
-void PBDNSMessage_DNSResponse::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
-  // @@protoc_insertion_point(serialize_start:PBDNSMessage.DNSResponse)
-  // optional uint32 rcode = 1;
-  if (has_rcode()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->rcode(), output);
-  }
-
-  // repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-  for (int i = 0; i < this->rrs_size(); i++) {
-    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      2, this->rrs(i), output);
-  }
-
-  if (!unknown_fields().empty()) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        unknown_fields(), output);
-  }
-  // @@protoc_insertion_point(serialize_end:PBDNSMessage.DNSResponse)
-}
-
-::google::protobuf::uint8* PBDNSMessage_DNSResponse::SerializeWithCachedSizesToArray(
-    ::google::protobuf::uint8* target) const {
-  // @@protoc_insertion_point(serialize_to_array_start:PBDNSMessage.DNSResponse)
-  // optional uint32 rcode = 1;
-  if (has_rcode()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->rcode(), target);
-  }
-
-  // repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-  for (int i = 0; i < this->rrs_size(); i++) {
-    target = ::google::protobuf::internal::WireFormatLite::
-      WriteMessageNoVirtualToArray(
-        2, this->rrs(i), target);
-  }
-
-  if (!unknown_fields().empty()) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        unknown_fields(), target);
-  }
-  // @@protoc_insertion_point(serialize_to_array_end:PBDNSMessage.DNSResponse)
-  return target;
-}
-
-int PBDNSMessage_DNSResponse::ByteSize() const {
-  int total_size = 0;
-
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    // optional uint32 rcode = 1;
-    if (has_rcode()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->rcode());
-    }
-
-  }
-  // repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-  total_size += 1 * this->rrs_size();
-  for (int i = 0; i < this->rrs_size(); i++) {
-    total_size +=
-      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-        this->rrs(i));
-  }
-
-  if (!unknown_fields().empty()) {
-    total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        unknown_fields());
-  }
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = total_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-  return total_size;
-}
-
-void PBDNSMessage_DNSResponse::MergeFrom(const ::google::protobuf::Message& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  const PBDNSMessage_DNSResponse* source =
-    ::google::protobuf::internal::dynamic_cast_if_available<const PBDNSMessage_DNSResponse*>(
-      &from);
-  if (source == NULL) {
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
-  } else {
-    MergeFrom(*source);
-  }
-}
-
-void PBDNSMessage_DNSResponse::MergeFrom(const PBDNSMessage_DNSResponse& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  rrs_.MergeFrom(from.rrs_);
-  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    if (from.has_rcode()) {
-      set_rcode(from.rcode());
-    }
-  }
-  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void PBDNSMessage_DNSResponse::CopyFrom(const ::google::protobuf::Message& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-void PBDNSMessage_DNSResponse::CopyFrom(const PBDNSMessage_DNSResponse& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-bool PBDNSMessage_DNSResponse::IsInitialized() const {
-
-  return true;
-}
-
-void PBDNSMessage_DNSResponse::Swap(PBDNSMessage_DNSResponse* other) {
-  if (other != this) {
-    std::swap(rcode_, other->rcode_);
-    rrs_.Swap(&other->rrs_);
-    std::swap(_has_bits_[0], other->_has_bits_[0]);
-    _unknown_fields_.Swap(&other->_unknown_fields_);
-    std::swap(_cached_size_, other->_cached_size_);
-  }
-}
-
-::google::protobuf::Metadata PBDNSMessage_DNSResponse::GetMetadata() const {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::Metadata metadata;
-  metadata.descriptor = PBDNSMessage_DNSResponse_descriptor_;
-  metadata.reflection = PBDNSMessage_DNSResponse_reflection_;
-  return metadata;
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int PBDNSMessage::kTypeFieldNumber;
-const int PBDNSMessage::kMessageIdFieldNumber;
-const int PBDNSMessage::kServerIdentityFieldNumber;
-const int PBDNSMessage::kSocketFamilyFieldNumber;
-const int PBDNSMessage::kSocketProtocolFieldNumber;
-const int PBDNSMessage::kFromFieldNumber;
-const int PBDNSMessage::kToFieldNumber;
-const int PBDNSMessage::kInBytesFieldNumber;
-const int PBDNSMessage::kTimeSecFieldNumber;
-const int PBDNSMessage::kTimeUsecFieldNumber;
-const int PBDNSMessage::kIdFieldNumber;
-const int PBDNSMessage::kQuestionFieldNumber;
-const int PBDNSMessage::kResponseFieldNumber;
-#endif  // !_MSC_VER
-
-PBDNSMessage::PBDNSMessage()
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  // @@protoc_insertion_point(constructor:PBDNSMessage)
-}
-
-void PBDNSMessage::InitAsDefaultInstance() {
-  question_ = const_cast< ::PBDNSMessage_DNSQuestion*>(&::PBDNSMessage_DNSQuestion::default_instance());
-  response_ = const_cast< ::PBDNSMessage_DNSResponse*>(&::PBDNSMessage_DNSResponse::default_instance());
-}
-
-PBDNSMessage::PBDNSMessage(const PBDNSMessage& from)
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  MergeFrom(from);
-  // @@protoc_insertion_point(copy_constructor:PBDNSMessage)
-}
-
-void PBDNSMessage::SharedCtor() {
-  ::google::protobuf::internal::GetEmptyString();
-  _cached_size_ = 0;
-  type_ = 1;
-  messageid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  serveridentity_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  socketfamily_ = 1;
-  socketprotocol_ = 1;
-  from_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  to_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  inbytes_ = GOOGLE_ULONGLONG(0);
-  timesec_ = 0u;
-  timeusec_ = 0u;
-  id_ = 0u;
-  question_ = NULL;
-  response_ = NULL;
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-PBDNSMessage::~PBDNSMessage() {
-  // @@protoc_insertion_point(destructor:PBDNSMessage)
-  SharedDtor();
-}
-
-void PBDNSMessage::SharedDtor() {
-  if (messageid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete messageid_;
-  }
-  if (serveridentity_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete serveridentity_;
-  }
-  if (from_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete from_;
-  }
-  if (to_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete to_;
-  }
-  if (this != default_instance_) {
-    delete question_;
-    delete response_;
-  }
-}
-
-void PBDNSMessage::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* PBDNSMessage::descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return PBDNSMessage_descriptor_;
-}
-
-const PBDNSMessage& PBDNSMessage::default_instance() {
-  if (default_instance_ == NULL) protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  return *default_instance_;
-}
-
-PBDNSMessage* PBDNSMessage::default_instance_ = NULL;
-
-PBDNSMessage* PBDNSMessage::New() const {
-  return new PBDNSMessage;
-}
-
-void PBDNSMessage::Clear() {
-#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>(      \
-  &reinterpret_cast<PBDNSMessage*>(16)->f) - \
-   reinterpret_cast<char*>(16))
-
-#define ZR_(first, last) do {                              \
-    size_t f = OFFSET_OF_FIELD_(first);                    \
-    size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last);  \
-    ::memset(&first, 0, n);                                \
-  } while (0)
-
-  if (_has_bits_[0 / 32] & 255) {
-    type_ = 1;
-    if (has_messageid()) {
-      if (messageid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        messageid_->clear();
-      }
-    }
-    if (has_serveridentity()) {
-      if (serveridentity_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        serveridentity_->clear();
-      }
-    }
-    socketfamily_ = 1;
-    socketprotocol_ = 1;
-    if (has_from()) {
-      if (from_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        from_->clear();
-      }
-    }
-    if (has_to()) {
-      if (to_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-        to_->clear();
-      }
-    }
-    inbytes_ = GOOGLE_ULONGLONG(0);
-  }
-  if (_has_bits_[8 / 32] & 7936) {
-    ZR_(timeusec_, id_);
-    timesec_ = 0u;
-    if (has_question()) {
-      if (question_ != NULL) question_->::PBDNSMessage_DNSQuestion::Clear();
-    }
-    if (has_response()) {
-      if (response_ != NULL) response_->::PBDNSMessage_DNSResponse::Clear();
-    }
-  }
-
-#undef OFFSET_OF_FIELD_
-#undef ZR_
-
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-  mutable_unknown_fields()->Clear();
-}
-
-bool PBDNSMessage::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
-  ::google::protobuf::uint32 tag;
-  // @@protoc_insertion_point(parse_start:PBDNSMessage)
-  for (;;) {
-    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
-    tag = p.first;
-    if (!p.second) goto handle_unusual;
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
-      // required .PBDNSMessage.Type type = 1;
-      case 1: {
-        if (tag == 8) {
-          int value;
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
-                 input, &value)));
-          if (::PBDNSMessage_Type_IsValid(value)) {
-            set_type(static_cast< ::PBDNSMessage_Type >(value));
-          } else {
-            mutable_unknown_fields()->AddVarint(1, value);
-          }
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(18)) goto parse_messageId;
-        break;
-      }
-
-      // optional bytes messageId = 2;
-      case 2: {
-        if (tag == 18) {
-         parse_messageId:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
-                input, this->mutable_messageid()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(26)) goto parse_serverIdentity;
-        break;
-      }
-
-      // optional bytes serverIdentity = 3;
-      case 3: {
-        if (tag == 26) {
-         parse_serverIdentity:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
-                input, this->mutable_serveridentity()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(32)) goto parse_socketFamily;
-        break;
-      }
-
-      // optional .PBDNSMessage.SocketFamily socketFamily = 4;
-      case 4: {
-        if (tag == 32) {
-         parse_socketFamily:
-          int value;
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
-                 input, &value)));
-          if (::PBDNSMessage_SocketFamily_IsValid(value)) {
-            set_socketfamily(static_cast< ::PBDNSMessage_SocketFamily >(value));
-          } else {
-            mutable_unknown_fields()->AddVarint(4, value);
-          }
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(40)) goto parse_socketProtocol;
-        break;
-      }
-
-      // optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-      case 5: {
-        if (tag == 40) {
-         parse_socketProtocol:
-          int value;
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
-                 input, &value)));
-          if (::PBDNSMessage_SocketProtocol_IsValid(value)) {
-            set_socketprotocol(static_cast< ::PBDNSMessage_SocketProtocol >(value));
-          } else {
-            mutable_unknown_fields()->AddVarint(5, value);
-          }
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(50)) goto parse_from;
-        break;
-      }
-
-      // optional bytes from = 6;
-      case 6: {
-        if (tag == 50) {
-         parse_from:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
-                input, this->mutable_from()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(58)) goto parse_to;
-        break;
-      }
-
-      // optional bytes to = 7;
-      case 7: {
-        if (tag == 58) {
-         parse_to:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
-                input, this->mutable_to()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(64)) goto parse_inBytes;
-        break;
-      }
-
-      // optional uint64 inBytes = 8;
-      case 8: {
-        if (tag == 64) {
-         parse_inBytes:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
-                 input, &inbytes_)));
-          set_has_inbytes();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(72)) goto parse_timeSec;
-        break;
-      }
-
-      // optional uint32 timeSec = 9;
-      case 9: {
-        if (tag == 72) {
-         parse_timeSec:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &timesec_)));
-          set_has_timesec();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(80)) goto parse_timeUsec;
-        break;
-      }
-
-      // optional uint32 timeUsec = 10;
-      case 10: {
-        if (tag == 80) {
-         parse_timeUsec:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &timeusec_)));
-          set_has_timeusec();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(88)) goto parse_id;
-        break;
-      }
-
-      // optional uint32 id = 11;
-      case 11: {
-        if (tag == 88) {
-         parse_id:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
-                 input, &id_)));
-          set_has_id();
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(98)) goto parse_question;
-        break;
-      }
-
-      // optional .PBDNSMessage.DNSQuestion question = 12;
-      case 12: {
-        if (tag == 98) {
-         parse_question:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
-               input, mutable_question()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectTag(106)) goto parse_response;
-        break;
-      }
-
-      // optional .PBDNSMessage.DNSResponse response = 13;
-      case 13: {
-        if (tag == 106) {
-         parse_response:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
-               input, mutable_response()));
-        } else {
-          goto handle_unusual;
-        }
-        if (input->ExpectAtEnd()) goto success;
-        break;
-      }
-
-      default: {
-      handle_unusual:
-        if (tag == 0 ||
-            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
-          goto success;
-        }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
-              input, tag, mutable_unknown_fields()));
-        break;
-      }
-    }
-  }
-success:
-  // @@protoc_insertion_point(parse_success:PBDNSMessage)
-  return true;
-failure:
-  // @@protoc_insertion_point(parse_failure:PBDNSMessage)
-  return false;
-#undef DO_
-}
-
-void PBDNSMessage::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
-  // @@protoc_insertion_point(serialize_start:PBDNSMessage)
-  // required .PBDNSMessage.Type type = 1;
-  if (has_type()) {
-    ::google::protobuf::internal::WireFormatLite::WriteEnum(
-      1, this->type(), output);
-  }
-
-  // optional bytes messageId = 2;
-  if (has_messageid()) {
-    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
-      2, this->messageid(), output);
-  }
-
-  // optional bytes serverIdentity = 3;
-  if (has_serveridentity()) {
-    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
-      3, this->serveridentity(), output);
-  }
-
-  // optional .PBDNSMessage.SocketFamily socketFamily = 4;
-  if (has_socketfamily()) {
-    ::google::protobuf::internal::WireFormatLite::WriteEnum(
-      4, this->socketfamily(), output);
-  }
-
-  // optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-  if (has_socketprotocol()) {
-    ::google::protobuf::internal::WireFormatLite::WriteEnum(
-      5, this->socketprotocol(), output);
-  }
-
-  // optional bytes from = 6;
-  if (has_from()) {
-    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
-      6, this->from(), output);
-  }
-
-  // optional bytes to = 7;
-  if (has_to()) {
-    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
-      7, this->to(), output);
-  }
-
-  // optional uint64 inBytes = 8;
-  if (has_inbytes()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->inbytes(), output);
-  }
-
-  // optional uint32 timeSec = 9;
-  if (has_timesec()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->timesec(), output);
-  }
-
-  // optional uint32 timeUsec = 10;
-  if (has_timeusec()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->timeusec(), output);
-  }
-
-  // optional uint32 id = 11;
-  if (has_id()) {
-    ::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->id(), output);
-  }
-
-  // optional .PBDNSMessage.DNSQuestion question = 12;
-  if (has_question()) {
-    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      12, this->question(), output);
-  }
-
-  // optional .PBDNSMessage.DNSResponse response = 13;
-  if (has_response()) {
-    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      13, this->response(), output);
-  }
-
-  if (!unknown_fields().empty()) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        unknown_fields(), output);
-  }
-  // @@protoc_insertion_point(serialize_end:PBDNSMessage)
-}
-
-::google::protobuf::uint8* PBDNSMessage::SerializeWithCachedSizesToArray(
-    ::google::protobuf::uint8* target) const {
-  // @@protoc_insertion_point(serialize_to_array_start:PBDNSMessage)
-  // required .PBDNSMessage.Type type = 1;
-  if (has_type()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
-      1, this->type(), target);
-  }
-
-  // optional bytes messageId = 2;
-  if (has_messageid()) {
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
-        2, this->messageid(), target);
-  }
-
-  // optional bytes serverIdentity = 3;
-  if (has_serveridentity()) {
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
-        3, this->serveridentity(), target);
-  }
-
-  // optional .PBDNSMessage.SocketFamily socketFamily = 4;
-  if (has_socketfamily()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
-      4, this->socketfamily(), target);
-  }
-
-  // optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-  if (has_socketprotocol()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
-      5, this->socketprotocol(), target);
-  }
-
-  // optional bytes from = 6;
-  if (has_from()) {
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
-        6, this->from(), target);
-  }
-
-  // optional bytes to = 7;
-  if (has_to()) {
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
-        7, this->to(), target);
-  }
-
-  // optional uint64 inBytes = 8;
-  if (has_inbytes()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->inbytes(), target);
-  }
-
-  // optional uint32 timeSec = 9;
-  if (has_timesec()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->timesec(), target);
-  }
-
-  // optional uint32 timeUsec = 10;
-  if (has_timeusec()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(10, this->timeusec(), target);
-  }
-
-  // optional uint32 id = 11;
-  if (has_id()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->id(), target);
-  }
-
-  // optional .PBDNSMessage.DNSQuestion question = 12;
-  if (has_question()) {
-    target = ::google::protobuf::internal::WireFormatLite::
-      WriteMessageNoVirtualToArray(
-        12, this->question(), target);
-  }
-
-  // optional .PBDNSMessage.DNSResponse response = 13;
-  if (has_response()) {
-    target = ::google::protobuf::internal::WireFormatLite::
-      WriteMessageNoVirtualToArray(
-        13, this->response(), target);
-  }
-
-  if (!unknown_fields().empty()) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        unknown_fields(), target);
-  }
-  // @@protoc_insertion_point(serialize_to_array_end:PBDNSMessage)
-  return target;
-}
-
-int PBDNSMessage::ByteSize() const {
-  int total_size = 0;
-
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    // required .PBDNSMessage.Type type = 1;
-    if (has_type()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
-    }
-
-    // optional bytes messageId = 2;
-    if (has_messageid()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::BytesSize(
-          this->messageid());
-    }
-
-    // optional bytes serverIdentity = 3;
-    if (has_serveridentity()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::BytesSize(
-          this->serveridentity());
-    }
-
-    // optional .PBDNSMessage.SocketFamily socketFamily = 4;
-    if (has_socketfamily()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::EnumSize(this->socketfamily());
-    }
-
-    // optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-    if (has_socketprotocol()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::EnumSize(this->socketprotocol());
-    }
-
-    // optional bytes from = 6;
-    if (has_from()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::BytesSize(
-          this->from());
-    }
-
-    // optional bytes to = 7;
-    if (has_to()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::BytesSize(
-          this->to());
-    }
-
-    // optional uint64 inBytes = 8;
-    if (has_inbytes()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt64Size(
-          this->inbytes());
-    }
-
-  }
-  if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
-    // optional uint32 timeSec = 9;
-    if (has_timesec()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->timesec());
-    }
-
-    // optional uint32 timeUsec = 10;
-    if (has_timeusec()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->timeusec());
-    }
-
-    // optional uint32 id = 11;
-    if (has_id()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::UInt32Size(
-          this->id());
-    }
-
-    // optional .PBDNSMessage.DNSQuestion question = 12;
-    if (has_question()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->question());
-    }
-
-    // optional .PBDNSMessage.DNSResponse response = 13;
-    if (has_response()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
-          this->response());
-    }
-
-  }
-  if (!unknown_fields().empty()) {
-    total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        unknown_fields());
-  }
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = total_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-  return total_size;
-}
-
-void PBDNSMessage::MergeFrom(const ::google::protobuf::Message& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  const PBDNSMessage* source =
-    ::google::protobuf::internal::dynamic_cast_if_available<const PBDNSMessage*>(
-      &from);
-  if (source == NULL) {
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
-  } else {
-    MergeFrom(*source);
-  }
-}
-
-void PBDNSMessage::MergeFrom(const PBDNSMessage& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    if (from.has_type()) {
-      set_type(from.type());
-    }
-    if (from.has_messageid()) {
-      set_messageid(from.messageid());
-    }
-    if (from.has_serveridentity()) {
-      set_serveridentity(from.serveridentity());
-    }
-    if (from.has_socketfamily()) {
-      set_socketfamily(from.socketfamily());
-    }
-    if (from.has_socketprotocol()) {
-      set_socketprotocol(from.socketprotocol());
-    }
-    if (from.has_from()) {
-      set_from(from.from());
-    }
-    if (from.has_to()) {
-      set_to(from.to());
-    }
-    if (from.has_inbytes()) {
-      set_inbytes(from.inbytes());
-    }
-  }
-  if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
-    if (from.has_timesec()) {
-      set_timesec(from.timesec());
-    }
-    if (from.has_timeusec()) {
-      set_timeusec(from.timeusec());
-    }
-    if (from.has_id()) {
-      set_id(from.id());
-    }
-    if (from.has_question()) {
-      mutable_question()->::PBDNSMessage_DNSQuestion::MergeFrom(from.question());
-    }
-    if (from.has_response()) {
-      mutable_response()->::PBDNSMessage_DNSResponse::MergeFrom(from.response());
-    }
-  }
-  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void PBDNSMessage::CopyFrom(const ::google::protobuf::Message& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-void PBDNSMessage::CopyFrom(const PBDNSMessage& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-bool PBDNSMessage::IsInitialized() const {
-  if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
-
-  return true;
-}
-
-void PBDNSMessage::Swap(PBDNSMessage* other) {
-  if (other != this) {
-    std::swap(type_, other->type_);
-    std::swap(messageid_, other->messageid_);
-    std::swap(serveridentity_, other->serveridentity_);
-    std::swap(socketfamily_, other->socketfamily_);
-    std::swap(socketprotocol_, other->socketprotocol_);
-    std::swap(from_, other->from_);
-    std::swap(to_, other->to_);
-    std::swap(inbytes_, other->inbytes_);
-    std::swap(timesec_, other->timesec_);
-    std::swap(timeusec_, other->timeusec_);
-    std::swap(id_, other->id_);
-    std::swap(question_, other->question_);
-    std::swap(response_, other->response_);
-    std::swap(_has_bits_[0], other->_has_bits_[0]);
-    _unknown_fields_.Swap(&other->_unknown_fields_);
-    std::swap(_cached_size_, other->_cached_size_);
-  }
-}
-
-::google::protobuf::Metadata PBDNSMessage::GetMetadata() const {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::Metadata metadata;
-  metadata.descriptor = PBDNSMessage_descriptor_;
-  metadata.reflection = PBDNSMessage_reflection_;
-  return metadata;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-// @@protoc_insertion_point(global_scope)
diff --git a/pdns/dnsmessage.pb.h b/pdns/dnsmessage.pb.h
deleted file mode 100644 (file)
index 0098d5d..0000000
+++ /dev/null
@@ -1,1729 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: pdns/dnsmessage.proto
-
-#ifndef PROTOBUF_pdns_2fdnsmessage_2eproto__INCLUDED
-#define PROTOBUF_pdns_2fdnsmessage_2eproto__INCLUDED
-
-#include <string>
-
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 2006000
-#error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please update
-#error your headers.
-#endif
-#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
-#error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers.  Please
-#error regenerate this file with a newer version of protoc.
-#endif
-
-#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/message.h>
-#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/extension_set.h>
-#include <google/protobuf/generated_enum_reflection.h>
-#include <google/protobuf/unknown_field_set.h>
-// @@protoc_insertion_point(includes)
-
-// Internal implementation detail -- do not call these.
-void  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto();
-void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto();
-
-class PBDNSMessage;
-class PBDNSMessage_DNSQuestion;
-class PBDNSMessage_DNSResponse;
-class PBDNSMessage_DNSResponse_DNSRR;
-
-enum PBDNSMessage_Type {
-  PBDNSMessage_Type_DNSQueryType = 1,
-  PBDNSMessage_Type_DNSResponseType = 2
-};
-bool PBDNSMessage_Type_IsValid(int value);
-const PBDNSMessage_Type PBDNSMessage_Type_Type_MIN = PBDNSMessage_Type_DNSQueryType;
-const PBDNSMessage_Type PBDNSMessage_Type_Type_MAX = PBDNSMessage_Type_DNSResponseType;
-const int PBDNSMessage_Type_Type_ARRAYSIZE = PBDNSMessage_Type_Type_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_Type_descriptor();
-inline const ::std::string& PBDNSMessage_Type_Name(PBDNSMessage_Type value) {
-  return ::google::protobuf::internal::NameOfEnum(
-    PBDNSMessage_Type_descriptor(), value);
-}
-inline bool PBDNSMessage_Type_Parse(
-    const ::std::string& name, PBDNSMessage_Type* value) {
-  return ::google::protobuf::internal::ParseNamedEnum<PBDNSMessage_Type>(
-    PBDNSMessage_Type_descriptor(), name, value);
-}
-enum PBDNSMessage_SocketFamily {
-  PBDNSMessage_SocketFamily_INET = 1,
-  PBDNSMessage_SocketFamily_INET6 = 2
-};
-bool PBDNSMessage_SocketFamily_IsValid(int value);
-const PBDNSMessage_SocketFamily PBDNSMessage_SocketFamily_SocketFamily_MIN = PBDNSMessage_SocketFamily_INET;
-const PBDNSMessage_SocketFamily PBDNSMessage_SocketFamily_SocketFamily_MAX = PBDNSMessage_SocketFamily_INET6;
-const int PBDNSMessage_SocketFamily_SocketFamily_ARRAYSIZE = PBDNSMessage_SocketFamily_SocketFamily_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketFamily_descriptor();
-inline const ::std::string& PBDNSMessage_SocketFamily_Name(PBDNSMessage_SocketFamily value) {
-  return ::google::protobuf::internal::NameOfEnum(
-    PBDNSMessage_SocketFamily_descriptor(), value);
-}
-inline bool PBDNSMessage_SocketFamily_Parse(
-    const ::std::string& name, PBDNSMessage_SocketFamily* value) {
-  return ::google::protobuf::internal::ParseNamedEnum<PBDNSMessage_SocketFamily>(
-    PBDNSMessage_SocketFamily_descriptor(), name, value);
-}
-enum PBDNSMessage_SocketProtocol {
-  PBDNSMessage_SocketProtocol_UDP = 1,
-  PBDNSMessage_SocketProtocol_TCP = 2
-};
-bool PBDNSMessage_SocketProtocol_IsValid(int value);
-const PBDNSMessage_SocketProtocol PBDNSMessage_SocketProtocol_SocketProtocol_MIN = PBDNSMessage_SocketProtocol_UDP;
-const PBDNSMessage_SocketProtocol PBDNSMessage_SocketProtocol_SocketProtocol_MAX = PBDNSMessage_SocketProtocol_TCP;
-const int PBDNSMessage_SocketProtocol_SocketProtocol_ARRAYSIZE = PBDNSMessage_SocketProtocol_SocketProtocol_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* PBDNSMessage_SocketProtocol_descriptor();
-inline const ::std::string& PBDNSMessage_SocketProtocol_Name(PBDNSMessage_SocketProtocol value) {
-  return ::google::protobuf::internal::NameOfEnum(
-    PBDNSMessage_SocketProtocol_descriptor(), value);
-}
-inline bool PBDNSMessage_SocketProtocol_Parse(
-    const ::std::string& name, PBDNSMessage_SocketProtocol* value) {
-  return ::google::protobuf::internal::ParseNamedEnum<PBDNSMessage_SocketProtocol>(
-    PBDNSMessage_SocketProtocol_descriptor(), name, value);
-}
-// ===================================================================
-
-class PBDNSMessage_DNSQuestion : public ::google::protobuf::Message {
- public:
-  PBDNSMessage_DNSQuestion();
-  virtual ~PBDNSMessage_DNSQuestion();
-
-  PBDNSMessage_DNSQuestion(const PBDNSMessage_DNSQuestion& from);
-
-  inline PBDNSMessage_DNSQuestion& operator=(const PBDNSMessage_DNSQuestion& from) {
-    CopyFrom(from);
-    return *this;
-  }
-
-  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
-    return _unknown_fields_;
-  }
-
-  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
-    return &_unknown_fields_;
-  }
-
-  static const ::google::protobuf::Descriptor* descriptor();
-  static const PBDNSMessage_DNSQuestion& default_instance();
-
-  void Swap(PBDNSMessage_DNSQuestion* other);
-
-  // implements Message ----------------------------------------------
-
-  PBDNSMessage_DNSQuestion* New() const;
-  void CopyFrom(const ::google::protobuf::Message& from);
-  void MergeFrom(const ::google::protobuf::Message& from);
-  void CopyFrom(const PBDNSMessage_DNSQuestion& from);
-  void MergeFrom(const PBDNSMessage_DNSQuestion& from);
-  void Clear();
-  bool IsInitialized() const;
-
-  int ByteSize() const;
-  bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input);
-  void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const;
-  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
-  int GetCachedSize() const { return _cached_size_; }
-  private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const;
-  public:
-  ::google::protobuf::Metadata GetMetadata() const;
-
-  // nested types ----------------------------------------------------
-
-  // accessors -------------------------------------------------------
-
-  // optional string qName = 1;
-  inline bool has_qname() const;
-  inline void clear_qname();
-  static const int kQNameFieldNumber = 1;
-  inline const ::std::string& qname() const;
-  inline void set_qname(const ::std::string& value);
-  inline void set_qname(const char* value);
-  inline void set_qname(const char* value, size_t size);
-  inline ::std::string* mutable_qname();
-  inline ::std::string* release_qname();
-  inline void set_allocated_qname(::std::string* qname);
-
-  // optional uint32 qType = 2;
-  inline bool has_qtype() const;
-  inline void clear_qtype();
-  static const int kQTypeFieldNumber = 2;
-  inline ::google::protobuf::uint32 qtype() const;
-  inline void set_qtype(::google::protobuf::uint32 value);
-
-  // optional uint32 qClass = 3;
-  inline bool has_qclass() const;
-  inline void clear_qclass();
-  static const int kQClassFieldNumber = 3;
-  inline ::google::protobuf::uint32 qclass() const;
-  inline void set_qclass(::google::protobuf::uint32 value);
-
-  // @@protoc_insertion_point(class_scope:PBDNSMessage.DNSQuestion)
- private:
-  inline void set_has_qname();
-  inline void clear_has_qname();
-  inline void set_has_qtype();
-  inline void clear_has_qtype();
-  inline void set_has_qclass();
-  inline void clear_has_qclass();
-
-  ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
-  ::google::protobuf::uint32 _has_bits_[1];
-  mutable int _cached_size_;
-  ::std::string* qname_;
-  ::google::protobuf::uint32 qtype_;
-  ::google::protobuf::uint32 qclass_;
-  friend void  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto();
-
-  void InitAsDefaultInstance();
-  static PBDNSMessage_DNSQuestion* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class PBDNSMessage_DNSResponse_DNSRR : public ::google::protobuf::Message {
- public:
-  PBDNSMessage_DNSResponse_DNSRR();
-  virtual ~PBDNSMessage_DNSResponse_DNSRR();
-
-  PBDNSMessage_DNSResponse_DNSRR(const PBDNSMessage_DNSResponse_DNSRR& from);
-
-  inline PBDNSMessage_DNSResponse_DNSRR& operator=(const PBDNSMessage_DNSResponse_DNSRR& from) {
-    CopyFrom(from);
-    return *this;
-  }
-
-  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
-    return _unknown_fields_;
-  }
-
-  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
-    return &_unknown_fields_;
-  }
-
-  static const ::google::protobuf::Descriptor* descriptor();
-  static const PBDNSMessage_DNSResponse_DNSRR& default_instance();
-
-  void Swap(PBDNSMessage_DNSResponse_DNSRR* other);
-
-  // implements Message ----------------------------------------------
-
-  PBDNSMessage_DNSResponse_DNSRR* New() const;
-  void CopyFrom(const ::google::protobuf::Message& from);
-  void MergeFrom(const ::google::protobuf::Message& from);
-  void CopyFrom(const PBDNSMessage_DNSResponse_DNSRR& from);
-  void MergeFrom(const PBDNSMessage_DNSResponse_DNSRR& from);
-  void Clear();
-  bool IsInitialized() const;
-
-  int ByteSize() const;
-  bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input);
-  void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const;
-  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
-  int GetCachedSize() const { return _cached_size_; }
-  private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const;
-  public:
-  ::google::protobuf::Metadata GetMetadata() const;
-
-  // nested types ----------------------------------------------------
-
-  // accessors -------------------------------------------------------
-
-  // optional string name = 1;
-  inline bool has_name() const;
-  inline void clear_name();
-  static const int kNameFieldNumber = 1;
-  inline const ::std::string& name() const;
-  inline void set_name(const ::std::string& value);
-  inline void set_name(const char* value);
-  inline void set_name(const char* value, size_t size);
-  inline ::std::string* mutable_name();
-  inline ::std::string* release_name();
-  inline void set_allocated_name(::std::string* name);
-
-  // optional uint32 type = 2;
-  inline bool has_type() const;
-  inline void clear_type();
-  static const int kTypeFieldNumber = 2;
-  inline ::google::protobuf::uint32 type() const;
-  inline void set_type(::google::protobuf::uint32 value);
-
-  // optional uint32 class = 3;
-  inline bool has_class_() const;
-  inline void clear_class_();
-  static const int kClassFieldNumber = 3;
-  inline ::google::protobuf::uint32 class_() const;
-  inline void set_class_(::google::protobuf::uint32 value);
-
-  // optional uint32 ttl = 4;
-  inline bool has_ttl() const;
-  inline void clear_ttl();
-  static const int kTtlFieldNumber = 4;
-  inline ::google::protobuf::uint32 ttl() const;
-  inline void set_ttl(::google::protobuf::uint32 value);
-
-  // optional bytes rdata = 5;
-  inline bool has_rdata() const;
-  inline void clear_rdata();
-  static const int kRdataFieldNumber = 5;
-  inline const ::std::string& rdata() const;
-  inline void set_rdata(const ::std::string& value);
-  inline void set_rdata(const char* value);
-  inline void set_rdata(const void* value, size_t size);
-  inline ::std::string* mutable_rdata();
-  inline ::std::string* release_rdata();
-  inline void set_allocated_rdata(::std::string* rdata);
-
-  // @@protoc_insertion_point(class_scope:PBDNSMessage.DNSResponse.DNSRR)
- private:
-  inline void set_has_name();
-  inline void clear_has_name();
-  inline void set_has_type();
-  inline void clear_has_type();
-  inline void set_has_class_();
-  inline void clear_has_class_();
-  inline void set_has_ttl();
-  inline void clear_has_ttl();
-  inline void set_has_rdata();
-  inline void clear_has_rdata();
-
-  ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
-  ::google::protobuf::uint32 _has_bits_[1];
-  mutable int _cached_size_;
-  ::std::string* name_;
-  ::google::protobuf::uint32 type_;
-  ::google::protobuf::uint32 class__;
-  ::std::string* rdata_;
-  ::google::protobuf::uint32 ttl_;
-  friend void  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto();
-
-  void InitAsDefaultInstance();
-  static PBDNSMessage_DNSResponse_DNSRR* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class PBDNSMessage_DNSResponse : public ::google::protobuf::Message {
- public:
-  PBDNSMessage_DNSResponse();
-  virtual ~PBDNSMessage_DNSResponse();
-
-  PBDNSMessage_DNSResponse(const PBDNSMessage_DNSResponse& from);
-
-  inline PBDNSMessage_DNSResponse& operator=(const PBDNSMessage_DNSResponse& from) {
-    CopyFrom(from);
-    return *this;
-  }
-
-  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
-    return _unknown_fields_;
-  }
-
-  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
-    return &_unknown_fields_;
-  }
-
-  static const ::google::protobuf::Descriptor* descriptor();
-  static const PBDNSMessage_DNSResponse& default_instance();
-
-  void Swap(PBDNSMessage_DNSResponse* other);
-
-  // implements Message ----------------------------------------------
-
-  PBDNSMessage_DNSResponse* New() const;
-  void CopyFrom(const ::google::protobuf::Message& from);
-  void MergeFrom(const ::google::protobuf::Message& from);
-  void CopyFrom(const PBDNSMessage_DNSResponse& from);
-  void MergeFrom(const PBDNSMessage_DNSResponse& from);
-  void Clear();
-  bool IsInitialized() const;
-
-  int ByteSize() const;
-  bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input);
-  void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const;
-  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
-  int GetCachedSize() const { return _cached_size_; }
-  private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const;
-  public:
-  ::google::protobuf::Metadata GetMetadata() const;
-
-  // nested types ----------------------------------------------------
-
-  typedef PBDNSMessage_DNSResponse_DNSRR DNSRR;
-
-  // accessors -------------------------------------------------------
-
-  // optional uint32 rcode = 1;
-  inline bool has_rcode() const;
-  inline void clear_rcode();
-  static const int kRcodeFieldNumber = 1;
-  inline ::google::protobuf::uint32 rcode() const;
-  inline void set_rcode(::google::protobuf::uint32 value);
-
-  // repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-  inline int rrs_size() const;
-  inline void clear_rrs();
-  static const int kRrsFieldNumber = 2;
-  inline const ::PBDNSMessage_DNSResponse_DNSRR& rrs(int index) const;
-  inline ::PBDNSMessage_DNSResponse_DNSRR* mutable_rrs(int index);
-  inline ::PBDNSMessage_DNSResponse_DNSRR* add_rrs();
-  inline const ::google::protobuf::RepeatedPtrField< ::PBDNSMessage_DNSResponse_DNSRR >&
-      rrs() const;
-  inline ::google::protobuf::RepeatedPtrField< ::PBDNSMessage_DNSResponse_DNSRR >*
-      mutable_rrs();
-
-  // @@protoc_insertion_point(class_scope:PBDNSMessage.DNSResponse)
- private:
-  inline void set_has_rcode();
-  inline void clear_has_rcode();
-
-  ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
-  ::google::protobuf::uint32 _has_bits_[1];
-  mutable int _cached_size_;
-  ::google::protobuf::RepeatedPtrField< ::PBDNSMessage_DNSResponse_DNSRR > rrs_;
-  ::google::protobuf::uint32 rcode_;
-  friend void  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto();
-
-  void InitAsDefaultInstance();
-  static PBDNSMessage_DNSResponse* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class PBDNSMessage : public ::google::protobuf::Message {
- public:
-  PBDNSMessage();
-  virtual ~PBDNSMessage();
-
-  PBDNSMessage(const PBDNSMessage& from);
-
-  inline PBDNSMessage& operator=(const PBDNSMessage& from) {
-    CopyFrom(from);
-    return *this;
-  }
-
-  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
-    return _unknown_fields_;
-  }
-
-  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
-    return &_unknown_fields_;
-  }
-
-  static const ::google::protobuf::Descriptor* descriptor();
-  static const PBDNSMessage& default_instance();
-
-  void Swap(PBDNSMessage* other);
-
-  // implements Message ----------------------------------------------
-
-  PBDNSMessage* New() const;
-  void CopyFrom(const ::google::protobuf::Message& from);
-  void MergeFrom(const ::google::protobuf::Message& from);
-  void CopyFrom(const PBDNSMessage& from);
-  void MergeFrom(const PBDNSMessage& from);
-  void Clear();
-  bool IsInitialized() const;
-
-  int ByteSize() const;
-  bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input);
-  void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const;
-  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
-  int GetCachedSize() const { return _cached_size_; }
-  private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const;
-  public:
-  ::google::protobuf::Metadata GetMetadata() const;
-
-  // nested types ----------------------------------------------------
-
-  typedef PBDNSMessage_DNSQuestion DNSQuestion;
-  typedef PBDNSMessage_DNSResponse DNSResponse;
-
-  typedef PBDNSMessage_Type Type;
-  static const Type DNSQueryType = PBDNSMessage_Type_DNSQueryType;
-  static const Type DNSResponseType = PBDNSMessage_Type_DNSResponseType;
-  static inline bool Type_IsValid(int value) {
-    return PBDNSMessage_Type_IsValid(value);
-  }
-  static const Type Type_MIN =
-    PBDNSMessage_Type_Type_MIN;
-  static const Type Type_MAX =
-    PBDNSMessage_Type_Type_MAX;
-  static const int Type_ARRAYSIZE =
-    PBDNSMessage_Type_Type_ARRAYSIZE;
-  static inline const ::google::protobuf::EnumDescriptor*
-  Type_descriptor() {
-    return PBDNSMessage_Type_descriptor();
-  }
-  static inline const ::std::string& Type_Name(Type value) {
-    return PBDNSMessage_Type_Name(value);
-  }
-  static inline bool Type_Parse(const ::std::string& name,
-      Type* value) {
-    return PBDNSMessage_Type_Parse(name, value);
-  }
-
-  typedef PBDNSMessage_SocketFamily SocketFamily;
-  static const SocketFamily INET = PBDNSMessage_SocketFamily_INET;
-  static const SocketFamily INET6 = PBDNSMessage_SocketFamily_INET6;
-  static inline bool SocketFamily_IsValid(int value) {
-    return PBDNSMessage_SocketFamily_IsValid(value);
-  }
-  static const SocketFamily SocketFamily_MIN =
-    PBDNSMessage_SocketFamily_SocketFamily_MIN;
-  static const SocketFamily SocketFamily_MAX =
-    PBDNSMessage_SocketFamily_SocketFamily_MAX;
-  static const int SocketFamily_ARRAYSIZE =
-    PBDNSMessage_SocketFamily_SocketFamily_ARRAYSIZE;
-  static inline const ::google::protobuf::EnumDescriptor*
-  SocketFamily_descriptor() {
-    return PBDNSMessage_SocketFamily_descriptor();
-  }
-  static inline const ::std::string& SocketFamily_Name(SocketFamily value) {
-    return PBDNSMessage_SocketFamily_Name(value);
-  }
-  static inline bool SocketFamily_Parse(const ::std::string& name,
-      SocketFamily* value) {
-    return PBDNSMessage_SocketFamily_Parse(name, value);
-  }
-
-  typedef PBDNSMessage_SocketProtocol SocketProtocol;
-  static const SocketProtocol UDP = PBDNSMessage_SocketProtocol_UDP;
-  static const SocketProtocol TCP = PBDNSMessage_SocketProtocol_TCP;
-  static inline bool SocketProtocol_IsValid(int value) {
-    return PBDNSMessage_SocketProtocol_IsValid(value);
-  }
-  static const SocketProtocol SocketProtocol_MIN =
-    PBDNSMessage_SocketProtocol_SocketProtocol_MIN;
-  static const SocketProtocol SocketProtocol_MAX =
-    PBDNSMessage_SocketProtocol_SocketProtocol_MAX;
-  static const int SocketProtocol_ARRAYSIZE =
-    PBDNSMessage_SocketProtocol_SocketProtocol_ARRAYSIZE;
-  static inline const ::google::protobuf::EnumDescriptor*
-  SocketProtocol_descriptor() {
-    return PBDNSMessage_SocketProtocol_descriptor();
-  }
-  static inline const ::std::string& SocketProtocol_Name(SocketProtocol value) {
-    return PBDNSMessage_SocketProtocol_Name(value);
-  }
-  static inline bool SocketProtocol_Parse(const ::std::string& name,
-      SocketProtocol* value) {
-    return PBDNSMessage_SocketProtocol_Parse(name, value);
-  }
-
-  // accessors -------------------------------------------------------
-
-  // required .PBDNSMessage.Type type = 1;
-  inline bool has_type() const;
-  inline void clear_type();
-  static const int kTypeFieldNumber = 1;
-  inline ::PBDNSMessage_Type type() const;
-  inline void set_type(::PBDNSMessage_Type value);
-
-  // optional bytes messageId = 2;
-  inline bool has_messageid() const;
-  inline void clear_messageid();
-  static const int kMessageIdFieldNumber = 2;
-  inline const ::std::string& messageid() const;
-  inline void set_messageid(const ::std::string& value);
-  inline void set_messageid(const char* value);
-  inline void set_messageid(const void* value, size_t size);
-  inline ::std::string* mutable_messageid();
-  inline ::std::string* release_messageid();
-  inline void set_allocated_messageid(::std::string* messageid);
-
-  // optional bytes serverIdentity = 3;
-  inline bool has_serveridentity() const;
-  inline void clear_serveridentity();
-  static const int kServerIdentityFieldNumber = 3;
-  inline const ::std::string& serveridentity() const;
-  inline void set_serveridentity(const ::std::string& value);
-  inline void set_serveridentity(const char* value);
-  inline void set_serveridentity(const void* value, size_t size);
-  inline ::std::string* mutable_serveridentity();
-  inline ::std::string* release_serveridentity();
-  inline void set_allocated_serveridentity(::std::string* serveridentity);
-
-  // optional .PBDNSMessage.SocketFamily socketFamily = 4;
-  inline bool has_socketfamily() const;
-  inline void clear_socketfamily();
-  static const int kSocketFamilyFieldNumber = 4;
-  inline ::PBDNSMessage_SocketFamily socketfamily() const;
-  inline void set_socketfamily(::PBDNSMessage_SocketFamily value);
-
-  // optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-  inline bool has_socketprotocol() const;
-  inline void clear_socketprotocol();
-  static const int kSocketProtocolFieldNumber = 5;
-  inline ::PBDNSMessage_SocketProtocol socketprotocol() const;
-  inline void set_socketprotocol(::PBDNSMessage_SocketProtocol value);
-
-  // optional bytes from = 6;
-  inline bool has_from() const;
-  inline void clear_from();
-  static const int kFromFieldNumber = 6;
-  inline const ::std::string& from() const;
-  inline void set_from(const ::std::string& value);
-  inline void set_from(const char* value);
-  inline void set_from(const void* value, size_t size);
-  inline ::std::string* mutable_from();
-  inline ::std::string* release_from();
-  inline void set_allocated_from(::std::string* from);
-
-  // optional bytes to = 7;
-  inline bool has_to() const;
-  inline void clear_to();
-  static const int kToFieldNumber = 7;
-  inline const ::std::string& to() const;
-  inline void set_to(const ::std::string& value);
-  inline void set_to(const char* value);
-  inline void set_to(const void* value, size_t size);
-  inline ::std::string* mutable_to();
-  inline ::std::string* release_to();
-  inline void set_allocated_to(::std::string* to);
-
-  // optional uint64 inBytes = 8;
-  inline bool has_inbytes() const;
-  inline void clear_inbytes();
-  static const int kInBytesFieldNumber = 8;
-  inline ::google::protobuf::uint64 inbytes() const;
-  inline void set_inbytes(::google::protobuf::uint64 value);
-
-  // optional uint32 timeSec = 9;
-  inline bool has_timesec() const;
-  inline void clear_timesec();
-  static const int kTimeSecFieldNumber = 9;
-  inline ::google::protobuf::uint32 timesec() const;
-  inline void set_timesec(::google::protobuf::uint32 value);
-
-  // optional uint32 timeUsec = 10;
-  inline bool has_timeusec() const;
-  inline void clear_timeusec();
-  static const int kTimeUsecFieldNumber = 10;
-  inline ::google::protobuf::uint32 timeusec() const;
-  inline void set_timeusec(::google::protobuf::uint32 value);
-
-  // optional uint32 id = 11;
-  inline bool has_id() const;
-  inline void clear_id();
-  static const int kIdFieldNumber = 11;
-  inline ::google::protobuf::uint32 id() const;
-  inline void set_id(::google::protobuf::uint32 value);
-
-  // optional .PBDNSMessage.DNSQuestion question = 12;
-  inline bool has_question() const;
-  inline void clear_question();
-  static const int kQuestionFieldNumber = 12;
-  inline const ::PBDNSMessage_DNSQuestion& question() const;
-  inline ::PBDNSMessage_DNSQuestion* mutable_question();
-  inline ::PBDNSMessage_DNSQuestion* release_question();
-  inline void set_allocated_question(::PBDNSMessage_DNSQuestion* question);
-
-  // optional .PBDNSMessage.DNSResponse response = 13;
-  inline bool has_response() const;
-  inline void clear_response();
-  static const int kResponseFieldNumber = 13;
-  inline const ::PBDNSMessage_DNSResponse& response() const;
-  inline ::PBDNSMessage_DNSResponse* mutable_response();
-  inline ::PBDNSMessage_DNSResponse* release_response();
-  inline void set_allocated_response(::PBDNSMessage_DNSResponse* response);
-
-  // @@protoc_insertion_point(class_scope:PBDNSMessage)
- private:
-  inline void set_has_type();
-  inline void clear_has_type();
-  inline void set_has_messageid();
-  inline void clear_has_messageid();
-  inline void set_has_serveridentity();
-  inline void clear_has_serveridentity();
-  inline void set_has_socketfamily();
-  inline void clear_has_socketfamily();
-  inline void set_has_socketprotocol();
-  inline void clear_has_socketprotocol();
-  inline void set_has_from();
-  inline void clear_has_from();
-  inline void set_has_to();
-  inline void clear_has_to();
-  inline void set_has_inbytes();
-  inline void clear_has_inbytes();
-  inline void set_has_timesec();
-  inline void clear_has_timesec();
-  inline void set_has_timeusec();
-  inline void clear_has_timeusec();
-  inline void set_has_id();
-  inline void clear_has_id();
-  inline void set_has_question();
-  inline void clear_has_question();
-  inline void set_has_response();
-  inline void clear_has_response();
-
-  ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
-  ::google::protobuf::uint32 _has_bits_[1];
-  mutable int _cached_size_;
-  ::std::string* messageid_;
-  int type_;
-  int socketfamily_;
-  ::std::string* serveridentity_;
-  ::std::string* from_;
-  ::std::string* to_;
-  int socketprotocol_;
-  ::google::protobuf::uint32 timesec_;
-  ::google::protobuf::uint64 inbytes_;
-  ::google::protobuf::uint32 timeusec_;
-  ::google::protobuf::uint32 id_;
-  ::PBDNSMessage_DNSQuestion* question_;
-  ::PBDNSMessage_DNSResponse* response_;
-  friend void  protobuf_AddDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_AssignDesc_pdns_2fdnsmessage_2eproto();
-  friend void protobuf_ShutdownFile_pdns_2fdnsmessage_2eproto();
-
-  void InitAsDefaultInstance();
-  static PBDNSMessage* default_instance_;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-// PBDNSMessage_DNSQuestion
-
-// optional string qName = 1;
-inline bool PBDNSMessage_DNSQuestion::has_qname() const {
-  return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void PBDNSMessage_DNSQuestion::set_has_qname() {
-  _has_bits_[0] |= 0x00000001u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_has_qname() {
-  _has_bits_[0] &= ~0x00000001u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_qname() {
-  if (qname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    qname_->clear();
-  }
-  clear_has_qname();
-}
-inline const ::std::string& PBDNSMessage_DNSQuestion::qname() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSQuestion.qName)
-  return *qname_;
-}
-inline void PBDNSMessage_DNSQuestion::set_qname(const ::std::string& value) {
-  set_has_qname();
-  if (qname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    qname_ = new ::std::string;
-  }
-  qname_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSQuestion.qName)
-}
-inline void PBDNSMessage_DNSQuestion::set_qname(const char* value) {
-  set_has_qname();
-  if (qname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    qname_ = new ::std::string;
-  }
-  qname_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.DNSQuestion.qName)
-}
-inline void PBDNSMessage_DNSQuestion::set_qname(const char* value, size_t size) {
-  set_has_qname();
-  if (qname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    qname_ = new ::std::string;
-  }
-  qname_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.DNSQuestion.qName)
-}
-inline ::std::string* PBDNSMessage_DNSQuestion::mutable_qname() {
-  set_has_qname();
-  if (qname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    qname_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.DNSQuestion.qName)
-  return qname_;
-}
-inline ::std::string* PBDNSMessage_DNSQuestion::release_qname() {
-  clear_has_qname();
-  if (qname_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = qname_;
-    qname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage_DNSQuestion::set_allocated_qname(::std::string* qname) {
-  if (qname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete qname_;
-  }
-  if (qname) {
-    set_has_qname();
-    qname_ = qname;
-  } else {
-    clear_has_qname();
-    qname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.DNSQuestion.qName)
-}
-
-// optional uint32 qType = 2;
-inline bool PBDNSMessage_DNSQuestion::has_qtype() const {
-  return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void PBDNSMessage_DNSQuestion::set_has_qtype() {
-  _has_bits_[0] |= 0x00000002u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_has_qtype() {
-  _has_bits_[0] &= ~0x00000002u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_qtype() {
-  qtype_ = 0u;
-  clear_has_qtype();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSQuestion::qtype() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSQuestion.qType)
-  return qtype_;
-}
-inline void PBDNSMessage_DNSQuestion::set_qtype(::google::protobuf::uint32 value) {
-  set_has_qtype();
-  qtype_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSQuestion.qType)
-}
-
-// optional uint32 qClass = 3;
-inline bool PBDNSMessage_DNSQuestion::has_qclass() const {
-  return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void PBDNSMessage_DNSQuestion::set_has_qclass() {
-  _has_bits_[0] |= 0x00000004u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_has_qclass() {
-  _has_bits_[0] &= ~0x00000004u;
-}
-inline void PBDNSMessage_DNSQuestion::clear_qclass() {
-  qclass_ = 0u;
-  clear_has_qclass();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSQuestion::qclass() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSQuestion.qClass)
-  return qclass_;
-}
-inline void PBDNSMessage_DNSQuestion::set_qclass(::google::protobuf::uint32 value) {
-  set_has_qclass();
-  qclass_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSQuestion.qClass)
-}
-
-// -------------------------------------------------------------------
-
-// PBDNSMessage_DNSResponse_DNSRR
-
-// optional string name = 1;
-inline bool PBDNSMessage_DNSResponse_DNSRR::has_name() const {
-  return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_has_name() {
-  _has_bits_[0] |= 0x00000001u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_has_name() {
-  _has_bits_[0] &= ~0x00000001u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_name() {
-  if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    name_->clear();
-  }
-  clear_has_name();
-}
-inline const ::std::string& PBDNSMessage_DNSResponse_DNSRR::name() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.DNSRR.name)
-  return *name_;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_name(const ::std::string& value) {
-  set_has_name();
-  if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    name_ = new ::std::string;
-  }
-  name_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.DNSRR.name)
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_name(const char* value) {
-  set_has_name();
-  if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    name_ = new ::std::string;
-  }
-  name_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.DNSResponse.DNSRR.name)
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_name(const char* value, size_t size) {
-  set_has_name();
-  if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    name_ = new ::std::string;
-  }
-  name_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.DNSResponse.DNSRR.name)
-}
-inline ::std::string* PBDNSMessage_DNSResponse_DNSRR::mutable_name() {
-  set_has_name();
-  if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    name_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.DNSResponse.DNSRR.name)
-  return name_;
-}
-inline ::std::string* PBDNSMessage_DNSResponse_DNSRR::release_name() {
-  clear_has_name();
-  if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = name_;
-    name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_allocated_name(::std::string* name) {
-  if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete name_;
-  }
-  if (name) {
-    set_has_name();
-    name_ = name;
-  } else {
-    clear_has_name();
-    name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.DNSResponse.DNSRR.name)
-}
-
-// optional uint32 type = 2;
-inline bool PBDNSMessage_DNSResponse_DNSRR::has_type() const {
-  return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_has_type() {
-  _has_bits_[0] |= 0x00000002u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_has_type() {
-  _has_bits_[0] &= ~0x00000002u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_type() {
-  type_ = 0u;
-  clear_has_type();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSResponse_DNSRR::type() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.DNSRR.type)
-  return type_;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_type(::google::protobuf::uint32 value) {
-  set_has_type();
-  type_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.DNSRR.type)
-}
-
-// optional uint32 class = 3;
-inline bool PBDNSMessage_DNSResponse_DNSRR::has_class_() const {
-  return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_has_class_() {
-  _has_bits_[0] |= 0x00000004u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_has_class_() {
-  _has_bits_[0] &= ~0x00000004u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_class_() {
-  class__ = 0u;
-  clear_has_class_();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSResponse_DNSRR::class_() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.DNSRR.class)
-  return class__;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_class_(::google::protobuf::uint32 value) {
-  set_has_class_();
-  class__ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.DNSRR.class)
-}
-
-// optional uint32 ttl = 4;
-inline bool PBDNSMessage_DNSResponse_DNSRR::has_ttl() const {
-  return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_has_ttl() {
-  _has_bits_[0] |= 0x00000008u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_has_ttl() {
-  _has_bits_[0] &= ~0x00000008u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_ttl() {
-  ttl_ = 0u;
-  clear_has_ttl();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSResponse_DNSRR::ttl() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.DNSRR.ttl)
-  return ttl_;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_ttl(::google::protobuf::uint32 value) {
-  set_has_ttl();
-  ttl_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.DNSRR.ttl)
-}
-
-// optional bytes rdata = 5;
-inline bool PBDNSMessage_DNSResponse_DNSRR::has_rdata() const {
-  return (_has_bits_[0] & 0x00000010u) != 0;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_has_rdata() {
-  _has_bits_[0] |= 0x00000010u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_has_rdata() {
-  _has_bits_[0] &= ~0x00000010u;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::clear_rdata() {
-  if (rdata_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    rdata_->clear();
-  }
-  clear_has_rdata();
-}
-inline const ::std::string& PBDNSMessage_DNSResponse_DNSRR::rdata() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.DNSRR.rdata)
-  return *rdata_;
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_rdata(const ::std::string& value) {
-  set_has_rdata();
-  if (rdata_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    rdata_ = new ::std::string;
-  }
-  rdata_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.DNSRR.rdata)
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_rdata(const char* value) {
-  set_has_rdata();
-  if (rdata_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    rdata_ = new ::std::string;
-  }
-  rdata_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.DNSResponse.DNSRR.rdata)
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_rdata(const void* value, size_t size) {
-  set_has_rdata();
-  if (rdata_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    rdata_ = new ::std::string;
-  }
-  rdata_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.DNSResponse.DNSRR.rdata)
-}
-inline ::std::string* PBDNSMessage_DNSResponse_DNSRR::mutable_rdata() {
-  set_has_rdata();
-  if (rdata_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    rdata_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.DNSResponse.DNSRR.rdata)
-  return rdata_;
-}
-inline ::std::string* PBDNSMessage_DNSResponse_DNSRR::release_rdata() {
-  clear_has_rdata();
-  if (rdata_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = rdata_;
-    rdata_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage_DNSResponse_DNSRR::set_allocated_rdata(::std::string* rdata) {
-  if (rdata_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete rdata_;
-  }
-  if (rdata) {
-    set_has_rdata();
-    rdata_ = rdata;
-  } else {
-    clear_has_rdata();
-    rdata_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.DNSResponse.DNSRR.rdata)
-}
-
-// -------------------------------------------------------------------
-
-// PBDNSMessage_DNSResponse
-
-// optional uint32 rcode = 1;
-inline bool PBDNSMessage_DNSResponse::has_rcode() const {
-  return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void PBDNSMessage_DNSResponse::set_has_rcode() {
-  _has_bits_[0] |= 0x00000001u;
-}
-inline void PBDNSMessage_DNSResponse::clear_has_rcode() {
-  _has_bits_[0] &= ~0x00000001u;
-}
-inline void PBDNSMessage_DNSResponse::clear_rcode() {
-  rcode_ = 0u;
-  clear_has_rcode();
-}
-inline ::google::protobuf::uint32 PBDNSMessage_DNSResponse::rcode() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.rcode)
-  return rcode_;
-}
-inline void PBDNSMessage_DNSResponse::set_rcode(::google::protobuf::uint32 value) {
-  set_has_rcode();
-  rcode_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.DNSResponse.rcode)
-}
-
-// repeated .PBDNSMessage.DNSResponse.DNSRR rrs = 2;
-inline int PBDNSMessage_DNSResponse::rrs_size() const {
-  return rrs_.size();
-}
-inline void PBDNSMessage_DNSResponse::clear_rrs() {
-  rrs_.Clear();
-}
-inline const ::PBDNSMessage_DNSResponse_DNSRR& PBDNSMessage_DNSResponse::rrs(int index) const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.DNSResponse.rrs)
-  return rrs_.Get(index);
-}
-inline ::PBDNSMessage_DNSResponse_DNSRR* PBDNSMessage_DNSResponse::mutable_rrs(int index) {
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.DNSResponse.rrs)
-  return rrs_.Mutable(index);
-}
-inline ::PBDNSMessage_DNSResponse_DNSRR* PBDNSMessage_DNSResponse::add_rrs() {
-  // @@protoc_insertion_point(field_add:PBDNSMessage.DNSResponse.rrs)
-  return rrs_.Add();
-}
-inline const ::google::protobuf::RepeatedPtrField< ::PBDNSMessage_DNSResponse_DNSRR >&
-PBDNSMessage_DNSResponse::rrs() const {
-  // @@protoc_insertion_point(field_list:PBDNSMessage.DNSResponse.rrs)
-  return rrs_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::PBDNSMessage_DNSResponse_DNSRR >*
-PBDNSMessage_DNSResponse::mutable_rrs() {
-  // @@protoc_insertion_point(field_mutable_list:PBDNSMessage.DNSResponse.rrs)
-  return &rrs_;
-}
-
-// -------------------------------------------------------------------
-
-// PBDNSMessage
-
-// required .PBDNSMessage.Type type = 1;
-inline bool PBDNSMessage::has_type() const {
-  return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void PBDNSMessage::set_has_type() {
-  _has_bits_[0] |= 0x00000001u;
-}
-inline void PBDNSMessage::clear_has_type() {
-  _has_bits_[0] &= ~0x00000001u;
-}
-inline void PBDNSMessage::clear_type() {
-  type_ = 1;
-  clear_has_type();
-}
-inline ::PBDNSMessage_Type PBDNSMessage::type() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.type)
-  return static_cast< ::PBDNSMessage_Type >(type_);
-}
-inline void PBDNSMessage::set_type(::PBDNSMessage_Type value) {
-  assert(::PBDNSMessage_Type_IsValid(value));
-  set_has_type();
-  type_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.type)
-}
-
-// optional bytes messageId = 2;
-inline bool PBDNSMessage::has_messageid() const {
-  return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void PBDNSMessage::set_has_messageid() {
-  _has_bits_[0] |= 0x00000002u;
-}
-inline void PBDNSMessage::clear_has_messageid() {
-  _has_bits_[0] &= ~0x00000002u;
-}
-inline void PBDNSMessage::clear_messageid() {
-  if (messageid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    messageid_->clear();
-  }
-  clear_has_messageid();
-}
-inline const ::std::string& PBDNSMessage::messageid() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.messageId)
-  return *messageid_;
-}
-inline void PBDNSMessage::set_messageid(const ::std::string& value) {
-  set_has_messageid();
-  if (messageid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    messageid_ = new ::std::string;
-  }
-  messageid_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.messageId)
-}
-inline void PBDNSMessage::set_messageid(const char* value) {
-  set_has_messageid();
-  if (messageid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    messageid_ = new ::std::string;
-  }
-  messageid_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.messageId)
-}
-inline void PBDNSMessage::set_messageid(const void* value, size_t size) {
-  set_has_messageid();
-  if (messageid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    messageid_ = new ::std::string;
-  }
-  messageid_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.messageId)
-}
-inline ::std::string* PBDNSMessage::mutable_messageid() {
-  set_has_messageid();
-  if (messageid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    messageid_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.messageId)
-  return messageid_;
-}
-inline ::std::string* PBDNSMessage::release_messageid() {
-  clear_has_messageid();
-  if (messageid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = messageid_;
-    messageid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage::set_allocated_messageid(::std::string* messageid) {
-  if (messageid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete messageid_;
-  }
-  if (messageid) {
-    set_has_messageid();
-    messageid_ = messageid;
-  } else {
-    clear_has_messageid();
-    messageid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.messageId)
-}
-
-// optional bytes serverIdentity = 3;
-inline bool PBDNSMessage::has_serveridentity() const {
-  return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void PBDNSMessage::set_has_serveridentity() {
-  _has_bits_[0] |= 0x00000004u;
-}
-inline void PBDNSMessage::clear_has_serveridentity() {
-  _has_bits_[0] &= ~0x00000004u;
-}
-inline void PBDNSMessage::clear_serveridentity() {
-  if (serveridentity_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    serveridentity_->clear();
-  }
-  clear_has_serveridentity();
-}
-inline const ::std::string& PBDNSMessage::serveridentity() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.serverIdentity)
-  return *serveridentity_;
-}
-inline void PBDNSMessage::set_serveridentity(const ::std::string& value) {
-  set_has_serveridentity();
-  if (serveridentity_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    serveridentity_ = new ::std::string;
-  }
-  serveridentity_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.serverIdentity)
-}
-inline void PBDNSMessage::set_serveridentity(const char* value) {
-  set_has_serveridentity();
-  if (serveridentity_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    serveridentity_ = new ::std::string;
-  }
-  serveridentity_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.serverIdentity)
-}
-inline void PBDNSMessage::set_serveridentity(const void* value, size_t size) {
-  set_has_serveridentity();
-  if (serveridentity_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    serveridentity_ = new ::std::string;
-  }
-  serveridentity_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.serverIdentity)
-}
-inline ::std::string* PBDNSMessage::mutable_serveridentity() {
-  set_has_serveridentity();
-  if (serveridentity_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    serveridentity_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.serverIdentity)
-  return serveridentity_;
-}
-inline ::std::string* PBDNSMessage::release_serveridentity() {
-  clear_has_serveridentity();
-  if (serveridentity_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = serveridentity_;
-    serveridentity_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage::set_allocated_serveridentity(::std::string* serveridentity) {
-  if (serveridentity_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete serveridentity_;
-  }
-  if (serveridentity) {
-    set_has_serveridentity();
-    serveridentity_ = serveridentity;
-  } else {
-    clear_has_serveridentity();
-    serveridentity_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.serverIdentity)
-}
-
-// optional .PBDNSMessage.SocketFamily socketFamily = 4;
-inline bool PBDNSMessage::has_socketfamily() const {
-  return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void PBDNSMessage::set_has_socketfamily() {
-  _has_bits_[0] |= 0x00000008u;
-}
-inline void PBDNSMessage::clear_has_socketfamily() {
-  _has_bits_[0] &= ~0x00000008u;
-}
-inline void PBDNSMessage::clear_socketfamily() {
-  socketfamily_ = 1;
-  clear_has_socketfamily();
-}
-inline ::PBDNSMessage_SocketFamily PBDNSMessage::socketfamily() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.socketFamily)
-  return static_cast< ::PBDNSMessage_SocketFamily >(socketfamily_);
-}
-inline void PBDNSMessage::set_socketfamily(::PBDNSMessage_SocketFamily value) {
-  assert(::PBDNSMessage_SocketFamily_IsValid(value));
-  set_has_socketfamily();
-  socketfamily_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.socketFamily)
-}
-
-// optional .PBDNSMessage.SocketProtocol socketProtocol = 5;
-inline bool PBDNSMessage::has_socketprotocol() const {
-  return (_has_bits_[0] & 0x00000010u) != 0;
-}
-inline void PBDNSMessage::set_has_socketprotocol() {
-  _has_bits_[0] |= 0x00000010u;
-}
-inline void PBDNSMessage::clear_has_socketprotocol() {
-  _has_bits_[0] &= ~0x00000010u;
-}
-inline void PBDNSMessage::clear_socketprotocol() {
-  socketprotocol_ = 1;
-  clear_has_socketprotocol();
-}
-inline ::PBDNSMessage_SocketProtocol PBDNSMessage::socketprotocol() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.socketProtocol)
-  return static_cast< ::PBDNSMessage_SocketProtocol >(socketprotocol_);
-}
-inline void PBDNSMessage::set_socketprotocol(::PBDNSMessage_SocketProtocol value) {
-  assert(::PBDNSMessage_SocketProtocol_IsValid(value));
-  set_has_socketprotocol();
-  socketprotocol_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.socketProtocol)
-}
-
-// optional bytes from = 6;
-inline bool PBDNSMessage::has_from() const {
-  return (_has_bits_[0] & 0x00000020u) != 0;
-}
-inline void PBDNSMessage::set_has_from() {
-  _has_bits_[0] |= 0x00000020u;
-}
-inline void PBDNSMessage::clear_has_from() {
-  _has_bits_[0] &= ~0x00000020u;
-}
-inline void PBDNSMessage::clear_from() {
-  if (from_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    from_->clear();
-  }
-  clear_has_from();
-}
-inline const ::std::string& PBDNSMessage::from() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.from)
-  return *from_;
-}
-inline void PBDNSMessage::set_from(const ::std::string& value) {
-  set_has_from();
-  if (from_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    from_ = new ::std::string;
-  }
-  from_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.from)
-}
-inline void PBDNSMessage::set_from(const char* value) {
-  set_has_from();
-  if (from_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    from_ = new ::std::string;
-  }
-  from_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.from)
-}
-inline void PBDNSMessage::set_from(const void* value, size_t size) {
-  set_has_from();
-  if (from_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    from_ = new ::std::string;
-  }
-  from_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.from)
-}
-inline ::std::string* PBDNSMessage::mutable_from() {
-  set_has_from();
-  if (from_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    from_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.from)
-  return from_;
-}
-inline ::std::string* PBDNSMessage::release_from() {
-  clear_has_from();
-  if (from_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = from_;
-    from_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage::set_allocated_from(::std::string* from) {
-  if (from_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete from_;
-  }
-  if (from) {
-    set_has_from();
-    from_ = from;
-  } else {
-    clear_has_from();
-    from_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.from)
-}
-
-// optional bytes to = 7;
-inline bool PBDNSMessage::has_to() const {
-  return (_has_bits_[0] & 0x00000040u) != 0;
-}
-inline void PBDNSMessage::set_has_to() {
-  _has_bits_[0] |= 0x00000040u;
-}
-inline void PBDNSMessage::clear_has_to() {
-  _has_bits_[0] &= ~0x00000040u;
-}
-inline void PBDNSMessage::clear_to() {
-  if (to_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    to_->clear();
-  }
-  clear_has_to();
-}
-inline const ::std::string& PBDNSMessage::to() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.to)
-  return *to_;
-}
-inline void PBDNSMessage::set_to(const ::std::string& value) {
-  set_has_to();
-  if (to_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    to_ = new ::std::string;
-  }
-  to_->assign(value);
-  // @@protoc_insertion_point(field_set:PBDNSMessage.to)
-}
-inline void PBDNSMessage::set_to(const char* value) {
-  set_has_to();
-  if (to_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    to_ = new ::std::string;
-  }
-  to_->assign(value);
-  // @@protoc_insertion_point(field_set_char:PBDNSMessage.to)
-}
-inline void PBDNSMessage::set_to(const void* value, size_t size) {
-  set_has_to();
-  if (to_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    to_ = new ::std::string;
-  }
-  to_->assign(reinterpret_cast<const char*>(value), size);
-  // @@protoc_insertion_point(field_set_pointer:PBDNSMessage.to)
-}
-inline ::std::string* PBDNSMessage::mutable_to() {
-  set_has_to();
-  if (to_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    to_ = new ::std::string;
-  }
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.to)
-  return to_;
-}
-inline ::std::string* PBDNSMessage::release_to() {
-  clear_has_to();
-  if (to_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    return NULL;
-  } else {
-    ::std::string* temp = to_;
-    to_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-    return temp;
-  }
-}
-inline void PBDNSMessage::set_allocated_to(::std::string* to) {
-  if (to_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
-    delete to_;
-  }
-  if (to) {
-    set_has_to();
-    to_ = to;
-  } else {
-    clear_has_to();
-    to_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.to)
-}
-
-// optional uint64 inBytes = 8;
-inline bool PBDNSMessage::has_inbytes() const {
-  return (_has_bits_[0] & 0x00000080u) != 0;
-}
-inline void PBDNSMessage::set_has_inbytes() {
-  _has_bits_[0] |= 0x00000080u;
-}
-inline void PBDNSMessage::clear_has_inbytes() {
-  _has_bits_[0] &= ~0x00000080u;
-}
-inline void PBDNSMessage::clear_inbytes() {
-  inbytes_ = GOOGLE_ULONGLONG(0);
-  clear_has_inbytes();
-}
-inline ::google::protobuf::uint64 PBDNSMessage::inbytes() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.inBytes)
-  return inbytes_;
-}
-inline void PBDNSMessage::set_inbytes(::google::protobuf::uint64 value) {
-  set_has_inbytes();
-  inbytes_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.inBytes)
-}
-
-// optional uint32 timeSec = 9;
-inline bool PBDNSMessage::has_timesec() const {
-  return (_has_bits_[0] & 0x00000100u) != 0;
-}
-inline void PBDNSMessage::set_has_timesec() {
-  _has_bits_[0] |= 0x00000100u;
-}
-inline void PBDNSMessage::clear_has_timesec() {
-  _has_bits_[0] &= ~0x00000100u;
-}
-inline void PBDNSMessage::clear_timesec() {
-  timesec_ = 0u;
-  clear_has_timesec();
-}
-inline ::google::protobuf::uint32 PBDNSMessage::timesec() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.timeSec)
-  return timesec_;
-}
-inline void PBDNSMessage::set_timesec(::google::protobuf::uint32 value) {
-  set_has_timesec();
-  timesec_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.timeSec)
-}
-
-// optional uint32 timeUsec = 10;
-inline bool PBDNSMessage::has_timeusec() const {
-  return (_has_bits_[0] & 0x00000200u) != 0;
-}
-inline void PBDNSMessage::set_has_timeusec() {
-  _has_bits_[0] |= 0x00000200u;
-}
-inline void PBDNSMessage::clear_has_timeusec() {
-  _has_bits_[0] &= ~0x00000200u;
-}
-inline void PBDNSMessage::clear_timeusec() {
-  timeusec_ = 0u;
-  clear_has_timeusec();
-}
-inline ::google::protobuf::uint32 PBDNSMessage::timeusec() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.timeUsec)
-  return timeusec_;
-}
-inline void PBDNSMessage::set_timeusec(::google::protobuf::uint32 value) {
-  set_has_timeusec();
-  timeusec_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.timeUsec)
-}
-
-// optional uint32 id = 11;
-inline bool PBDNSMessage::has_id() const {
-  return (_has_bits_[0] & 0x00000400u) != 0;
-}
-inline void PBDNSMessage::set_has_id() {
-  _has_bits_[0] |= 0x00000400u;
-}
-inline void PBDNSMessage::clear_has_id() {
-  _has_bits_[0] &= ~0x00000400u;
-}
-inline void PBDNSMessage::clear_id() {
-  id_ = 0u;
-  clear_has_id();
-}
-inline ::google::protobuf::uint32 PBDNSMessage::id() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.id)
-  return id_;
-}
-inline void PBDNSMessage::set_id(::google::protobuf::uint32 value) {
-  set_has_id();
-  id_ = value;
-  // @@protoc_insertion_point(field_set:PBDNSMessage.id)
-}
-
-// optional .PBDNSMessage.DNSQuestion question = 12;
-inline bool PBDNSMessage::has_question() const {
-  return (_has_bits_[0] & 0x00000800u) != 0;
-}
-inline void PBDNSMessage::set_has_question() {
-  _has_bits_[0] |= 0x00000800u;
-}
-inline void PBDNSMessage::clear_has_question() {
-  _has_bits_[0] &= ~0x00000800u;
-}
-inline void PBDNSMessage::clear_question() {
-  if (question_ != NULL) question_->::PBDNSMessage_DNSQuestion::Clear();
-  clear_has_question();
-}
-inline const ::PBDNSMessage_DNSQuestion& PBDNSMessage::question() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.question)
-  return question_ != NULL ? *question_ : *default_instance_->question_;
-}
-inline ::PBDNSMessage_DNSQuestion* PBDNSMessage::mutable_question() {
-  set_has_question();
-  if (question_ == NULL) question_ = new ::PBDNSMessage_DNSQuestion;
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.question)
-  return question_;
-}
-inline ::PBDNSMessage_DNSQuestion* PBDNSMessage::release_question() {
-  clear_has_question();
-  ::PBDNSMessage_DNSQuestion* temp = question_;
-  question_ = NULL;
-  return temp;
-}
-inline void PBDNSMessage::set_allocated_question(::PBDNSMessage_DNSQuestion* question) {
-  delete question_;
-  question_ = question;
-  if (question) {
-    set_has_question();
-  } else {
-    clear_has_question();
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.question)
-}
-
-// optional .PBDNSMessage.DNSResponse response = 13;
-inline bool PBDNSMessage::has_response() const {
-  return (_has_bits_[0] & 0x00001000u) != 0;
-}
-inline void PBDNSMessage::set_has_response() {
-  _has_bits_[0] |= 0x00001000u;
-}
-inline void PBDNSMessage::clear_has_response() {
-  _has_bits_[0] &= ~0x00001000u;
-}
-inline void PBDNSMessage::clear_response() {
-  if (response_ != NULL) response_->::PBDNSMessage_DNSResponse::Clear();
-  clear_has_response();
-}
-inline const ::PBDNSMessage_DNSResponse& PBDNSMessage::response() const {
-  // @@protoc_insertion_point(field_get:PBDNSMessage.response)
-  return response_ != NULL ? *response_ : *default_instance_->response_;
-}
-inline ::PBDNSMessage_DNSResponse* PBDNSMessage::mutable_response() {
-  set_has_response();
-  if (response_ == NULL) response_ = new ::PBDNSMessage_DNSResponse;
-  // @@protoc_insertion_point(field_mutable:PBDNSMessage.response)
-  return response_;
-}
-inline ::PBDNSMessage_DNSResponse* PBDNSMessage::release_response() {
-  clear_has_response();
-  ::PBDNSMessage_DNSResponse* temp = response_;
-  response_ = NULL;
-  return temp;
-}
-inline void PBDNSMessage::set_allocated_response(::PBDNSMessage_DNSResponse* response) {
-  delete response_;
-  response_ = response;
-  if (response) {
-    set_has_response();
-  } else {
-    clear_has_response();
-  }
-  // @@protoc_insertion_point(field_set_allocated:PBDNSMessage.response)
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-#ifndef SWIG
-namespace google {
-namespace protobuf {
-
-template <> struct is_proto_enum< ::PBDNSMessage_Type> : ::google::protobuf::internal::true_type {};
-template <>
-inline const EnumDescriptor* GetEnumDescriptor< ::PBDNSMessage_Type>() {
-  return ::PBDNSMessage_Type_descriptor();
-}
-template <> struct is_proto_enum< ::PBDNSMessage_SocketFamily> : ::google::protobuf::internal::true_type {};
-template <>
-inline const EnumDescriptor* GetEnumDescriptor< ::PBDNSMessage_SocketFamily>() {
-  return ::PBDNSMessage_SocketFamily_descriptor();
-}
-template <> struct is_proto_enum< ::PBDNSMessage_SocketProtocol> : ::google::protobuf::internal::true_type {};
-template <>
-inline const EnumDescriptor* GetEnumDescriptor< ::PBDNSMessage_SocketProtocol>() {
-  return ::PBDNSMessage_SocketProtocol_descriptor();
-}
-
-}  // namespace google
-}  // namespace protobuf
-#endif  // SWIG
-
-// @@protoc_insertion_point(global_scope)
-
-#endif  // PROTOBUF_pdns_2fdnsmessage_2eproto__INCLUDED
diff --git a/pdns/dnspcap2protobuf.cc b/pdns/dnspcap2protobuf.cc
new file mode 100644 (file)
index 0000000..448dcfb
--- /dev/null
@@ -0,0 +1,153 @@
+#include "dnsmessage.pb.h"
+#include "iputils.hh"
+#include "misc.hh"
+#include "dns.hh"
+#include "dnspcap.hh"
+#include "dnsparser.hh"
+
+#include "statbag.hh"
+StatBag S;
+
+static void addRRs(const char* packet, const size_t len, PBDNSMessage_DNSResponse& response)
+{
+  if (len < sizeof(struct dnsheader))
+    return;
+
+  const struct dnsheader* dh = (const struct dnsheader*) packet;
+
+  if (ntohs(dh->ancount) == 0)
+    return;
+
+  if (ntohs(dh->qdcount) == 0)
+    return;
+
+  vector<uint8_t> content(len - sizeof(dnsheader));
+  copy(packet + sizeof(dnsheader), packet + len, content.begin());
+  PacketReader pr(content);
+
+  size_t idx = 0;
+  DNSName rrname;
+  uint16_t qdcount = ntohs(dh->qdcount);
+  uint16_t ancount = ntohs(dh->ancount);
+  uint16_t rrtype;
+  uint16_t rrclass;
+  string blob;
+  struct dnsrecordheader ah;
+
+  rrname = pr.getName();
+  rrtype = pr.get16BitInt();
+  rrclass = pr.get16BitInt();
+
+  /* consume remaining qd if any */
+  if (qdcount > 1) {
+    for(idx = 1; idx < qdcount; idx++) {
+      rrname = pr.getName();
+      rrtype = pr.get16BitInt();
+      rrclass = pr.get16BitInt();
+      (void) rrtype;
+      (void) rrclass;
+    }
+  }
+
+  /* parse AN */
+  for (idx = 0; idx < ancount; idx++) {
+    rrname = pr.getName();
+    pr.getDnsrecordheader(ah);
+
+    pr.xfrBlob(blob);
+    if (ah.d_type == QType::A || ah.d_type == QType::AAAA) {
+      PBDNSMessage_DNSResponse_DNSRR* rr = response.add_rrs();
+      if (rr) {
+        rr->set_name(rrname.toString());
+        rr->set_type(ah.d_type);
+        rr->set_class_(ah.d_class);
+        rr->set_ttl(ah.d_ttl);
+        rr->set_rdata(blob.c_str(), blob.length());
+      }
+    }
+  }
+}
+
+int main(int argc, char **argv)
+{
+  if(argc != 3) {
+    cerr<<"This program reads DNS queries and responses from a PCAP file and stores them into our protobuf format."<<endl;
+    cerr<<"Usage: "<<argv[0]<<" <PCAP file> <out file>"<<endl;
+    exit(EXIT_FAILURE);
+  }
+
+  PcapPacketReader pr(argv[1]);
+
+  FILE* fp = fopen(argv[2], "w");
+  if (!fp) {
+    cerr<<"Error opening output file "<<argv[2]<<": "<<strerror(errno)<<endl;
+    exit(EXIT_FAILURE);
+  }
+
+  while (pr.getUDPPacket()) {
+    const dnsheader* dh=(dnsheader*)pr.d_payload;
+    if (!dh->qdcount)
+      continue;
+
+    uint16_t qtype, qclass;
+    DNSName qname;
+    try {
+      qname=DNSName((const char*)pr.d_payload, pr.d_len, sizeof(dnsheader), false, &qtype, &qclass);
+    }
+    catch(const std::exception& e) {
+      cerr<<"Error while parsing qname: "<<e.what()<<endl;
+      continue;
+    }
+
+    PBDNSMessage message;
+    message.set_timesec(pr.d_pheader.ts.tv_sec);
+    message.set_timeusec(pr.d_pheader.ts.tv_usec);
+    message.set_id(ntohs(dh->id));
+    message.set_type(dh->qr ? PBDNSMessage_Type_DNSResponseType : PBDNSMessage_Type_DNSQueryType);
+    const ComboAddress source = pr.getSource();
+    const ComboAddress dest = pr.getDest();
+    message.set_socketfamily(source.sin4.sin_family == AF_INET ? PBDNSMessage_SocketFamily_INET : PBDNSMessage_SocketFamily_INET6);
+    // we handle UDP packets only for now
+    message.set_socketprotocol(PBDNSMessage_SocketProtocol_UDP);
+    if (source.sin4.sin_family == AF_INET) {
+      message.set_from(&source.sin4.sin_addr.s_addr, sizeof(source.sin4.sin_addr.s_addr));
+    }
+    else if (source.sin4.sin_family == AF_INET6) {
+      message.set_from(&source.sin6.sin6_addr.s6_addr, sizeof(source.sin6.sin6_addr.s6_addr));
+    }
+    if (dest.sin4.sin_family == AF_INET) {
+      message.set_to(&dest.sin4.sin_addr.s_addr, sizeof(dest.sin4.sin_addr.s_addr));
+    }
+    else if (dest.sin4.sin_family == AF_INET6) {
+      message.set_to(&dest.sin6.sin6_addr.s6_addr, sizeof(dest.sin6.sin6_addr.s6_addr));
+    }
+    message.set_inbytes(pr.d_len);
+
+    PBDNSMessage_DNSQuestion question;
+    PBDNSMessage_DNSResponse response;
+    if (!dh->qr) {
+      question.set_qname(qname.toString());
+      question.set_qtype(qtype);
+      question.set_qclass(qclass);
+      message.set_allocated_question(&question);
+    }
+    else {
+      response.set_rcode(dh->rcode);
+      addRRs((const char*) dh, pr.d_len, response);
+      message.set_allocated_response(&response);
+    }
+
+    std::string str;
+    message.SerializeToString(&str);
+    uint16_t mlen = str.length();
+    fwrite(&mlen, 1, sizeof(mlen), fp);
+    fwrite(str.c_str(), 1, str.length(), fp);
+    if (!dh->qr) {
+      message.release_question();
+    }
+    else {
+      message.release_response();
+    }
+  }
+  fclose(fp);
+}