Skip to content

Commit 40371e6

Browse files
committed
new dnsmessage_b2 file
1 parent 2c379e7 commit 40371e6

File tree

2 files changed

+91
-40
lines changed

2 files changed

+91
-40
lines changed
Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
/*
2-
* This file is part of PowerDNS or dnsdist.
3-
* Copyright -- PowerDNS.COM B.V. and its contributors
2+
* This file describes the message format used by the protobuf logging feature in PowerDNS and dnsdist.
43
*
5-
* This program is free software; you can redistribute it and/or modify
6-
* it under the terms of version 2 of the GNU General Public License as
7-
* published by the Free Software Foundation.
8-
*
9-
* In addition, for the avoidance of any doubt, permission is granted to
10-
* link this program with OpenSSL and to (re)distribute the binaries
11-
* produced as the result of such linking.
12-
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program; if not, write to the Free Software
20-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4+
* MIT License
5+
*
6+
* Copyright (c) 2016-now PowerDNS.COM B.V. and its contributors.
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
2125
*/
2226
syntax = "proto2";
2327

2428
message PBDNSMessage {
2529
enum Type {
26-
DNSQueryType = 1;
27-
DNSResponseType = 2;
28-
DNSOutgoingQueryType = 3;
29-
DNSIncomingResponseType = 4;
30+
DNSQueryType = 1; // Query received by the service
31+
DNSResponseType = 2; // Response returned by the service
32+
DNSOutgoingQueryType = 3; // Query sent out by the service to a remote server
33+
DNSIncomingResponseType = 4; // Response returned by the remote server
3034
}
3135
enum SocketFamily {
3236
INET = 1; // IPv4 (RFC 791)
@@ -37,45 +41,47 @@ message PBDNSMessage {
3741
TCP = 2; // Transmission Control Protocol (RFC 793)
3842
}
3943
enum PolicyType {
40-
UNKNOWN = 1; // No policy applied, or unknown type
44+
UNKNOWN = 1; // No RPZ policy applied, or unknown type
4145
QNAME = 2; // Policy matched on the QName
4246
CLIENTIP = 3; // Policy matched on the client IP
4347
RESPONSEIP = 4; // Policy matched on one of the IPs contained in the answer
4448
NSDNAME = 5; // Policy matched on the name of one nameserver involved
4549
NSIP = 6; // Policy matched on the IP of one nameserver involved
4650
}
47-
required Type type = 1;
51+
required Type type = 1; // Type of event
4852
optional bytes messageId = 2; // UUID, shared by the query and the response
4953
optional bytes serverIdentity = 3; // ID of the server emitting the protobuf message
5054
optional SocketFamily socketFamily = 4;
5155
optional SocketProtocol socketProtocol = 5;
52-
optional bytes from = 6; // DNS requestor (client)
53-
optional bytes to = 7; // DNS responder (server)
56+
optional bytes from = 6; // DNS requestor (client) as 4 (IPv4) or 16 (IPv6) raw bytes in network byte order
57+
optional bytes to = 7; // DNS responder (server) as 4 (IPv4) or 16 (IPv6) raw bytes in network byte order
5458
optional uint64 inBytes = 8; // Size of the query or response on the wire
5559
optional uint32 timeSec = 9; // Time of message reception (seconds since epoch)
5660
optional uint32 timeUsec = 10; // Time of message reception (additional micro-seconds)
5761
optional uint32 id = 11; // ID of the query/response as found in the DNS header
5862

5963
message DNSQuestion {
60-
optional string qName = 1;
61-
optional uint32 qType = 2;
62-
optional uint32 qClass = 3;
64+
optional string qName = 1; // Fully qualified DNS name (with trailing dot)
65+
optional uint32 qType = 2; // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
66+
optional uint32 qClass = 3; // Typically 1 (IN), see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
6367
}
64-
optional DNSQuestion question = 12;
68+
optional DNSQuestion question = 12; // DNS query received from client
6569

6670
message DNSResponse {
71+
// See exportTypes in https://docs.powerdns.com/recursor/lua-config/protobuf.html#protobufServer
72+
// for the list of supported resource record types.
6773
message DNSRR {
68-
optional string name = 1;
69-
optional uint32 type = 2;
70-
optional uint32 class = 3;
71-
optional uint32 ttl = 4;
72-
optional bytes rdata = 5;
74+
optional string name = 1; // Fully qualified DNS name (with trailing dot)
75+
optional uint32 type = 2; // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
76+
optional uint32 class = 3; // Typically 1 (IN), see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
77+
optional uint32 ttl = 4; // TTL in seconds
78+
optional bytes rdata = 5; // raw address bytes in network byte order for A & AAAA; text representation for others, with fully qualified (trailing dot) domain names
7379
optional bool udr = 6; // True if this is the first time this RR has been seen for this question
7480
}
7581
optional uint32 rcode = 1; // DNS Response code, or 65536 for a network error including a timeout
76-
repeated DNSRR rrs = 2;
82+
repeated DNSRR rrs = 2; // DNS resource records in response
7783
optional string appliedPolicy = 3; // Filtering policy (RPZ or Lua) applied
78-
repeated string tags = 4; // Additional tags
84+
repeated string tags = 4; // Additional tags applied
7985
optional uint32 queryTimeSec = 5; // Time of the corresponding query reception (seconds since epoch)
8086
optional uint32 queryTimeUsec = 6; // Time of the corresponding query reception (additional micro-seconds)
8187
optional PolicyType appliedPolicyType = 7; // Type of the filtering policy (RPZ or Lua) applied
@@ -84,12 +90,16 @@ message PBDNSMessage {
8490
}
8591

8692
optional DNSResponse response = 13;
87-
optional bytes originalRequestorSubnet = 14; // EDNS Client Subnet value
93+
optional bytes originalRequestorSubnet = 14; // EDNS Client Subnet value (4 or 16 raw bytes in network byte order)
8894
optional string requestorId = 15; // Username of the requestor
8995
optional bytes initialRequestId = 16; // UUID of the incoming query that initiated this outgoing query or incoming response
90-
optional bytes deviceId = 17; // Device ID of the requestor (could be mac address IP address or e.g. IMEI)
96+
optional bytes deviceId = 17; // Device ID of the requestor (could be mac address IP address or e.g. IMEI, format implementation dependent)
9197
optional bool newlyObservedDomain = 18; // True if the domain has not been seen before
9298
optional string deviceName = 19; // Device name of the requestor
9399
optional uint32 fromPort = 20; // Source port of the DNS query (client)
94100
optional uint32 toPort = 21; // Destination port of the DNS query (server)
95101
}
102+
103+
message PBDNSMessageList {
104+
repeated PBDNSMessage msg = 1;
105+
}

pdns_protobuf_receiver/dnsmessage_pb2.py

Lines changed: 42 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)