]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsdist-protobuf.cc
Protobuf refactoring
[thirdparty/pdns.git] / pdns / dnsdist-protobuf.cc
1
2 #include "config.h"
3
4 #include "dnsdist.hh"
5 #include "gettime.hh"
6
7 #include "dnsparser.hh"
8 #include "dnsdist-protobuf.hh"
9
10 #ifdef HAVE_PROTOBUF
11 #include "dnsmessage.pb.h"
12
13 DNSDistProtoBufMessage::DNSDistProtoBufMessage(DNSProtoBufMessageType type, const DNSQuestion& dq): DNSProtoBufMessage(type, dq.uniqueId, dq.remote, dq.local, *dq.qname, dq.qtype, dq.qclass, dq.dh->id, dq.tcp, dq.len)
14 {
15 if (type == Response) {
16 PBDNSMessage_DNSResponse* response = d_message.mutable_response();
17 if (response) {
18 response->set_rcode(dq.dh->rcode);
19 }
20 addRRsFromPacket((const char*) dq.dh, dq.len);
21 }
22 };
23
24 #endif /* HAVE_PROTOBUF */