]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsmessage.proto
Merge pull request #7903 from Habbie/dnsdist-doc-nits
[thirdparty/pdns.git] / pdns / dnsmessage.proto
1 /*
2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
4 *
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.
21 */
22 syntax = "proto2";
23
24 message PBDNSMessage {
25 enum Type {
26 DNSQueryType = 1;
27 DNSResponseType = 2;
28 DNSOutgoingQueryType = 3;
29 DNSIncomingResponseType = 4;
30 }
31 enum SocketFamily {
32 INET = 1; // IPv4 (RFC 791)
33 INET6 = 2; // IPv6 (RFC 2460)
34 }
35 enum SocketProtocol {
36 UDP = 1; // User Datagram Protocol (RFC 768)
37 TCP = 2; // Transmission Control Protocol (RFC 793)
38 }
39 enum PolicyType {
40 UNKNOWN = 1; // No policy applied, or unknown type
41 QNAME = 2; // Policy matched on the QName
42 CLIENTIP = 3; // Policy matched on the client IP
43 RESPONSEIP = 4; // Policy matched on one of the IPs contained in the answer
44 NSDNAME = 5; // Policy matched on the name of one nameserver involved
45 NSIP = 6; // Policy matched on the IP of one nameserver involved
46 }
47 required Type type = 1;
48 optional bytes messageId = 2; // UUID, shared by the query and the response
49 optional bytes serverIdentity = 3; // ID of the server emitting the protobuf message
50 optional SocketFamily socketFamily = 4;
51 optional SocketProtocol socketProtocol = 5;
52 optional bytes from = 6; // DNS requestor (client)
53 optional bytes to = 7; // DNS responder (server)
54 optional uint64 inBytes = 8; // Size of the query or response on the wire
55 optional uint32 timeSec = 9; // Time of message reception (seconds since epoch)
56 optional uint32 timeUsec = 10; // Time of message reception (additional micro-seconds)
57 optional uint32 id = 11; // ID of the query/response as found in the DNS header
58
59 message DNSQuestion {
60 optional string qName = 1;
61 optional uint32 qType = 2;
62 optional uint32 qClass = 3;
63 }
64 optional DNSQuestion question = 12;
65
66 message DNSResponse {
67 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;
73 optional bool udr = 6; // True if this is the first time this RR has been seen for this question
74 }
75 optional uint32 rcode = 1;
76 repeated DNSRR rrs = 2;
77 optional string appliedPolicy = 3; // Filtering policy (RPZ or Lua) applied
78 repeated string tags = 4; // Additional tags
79 optional uint32 queryTimeSec = 5; // Time of the corresponding query reception (seconds since epoch)
80 optional uint32 queryTimeUsec = 6; // Time of the corresponding query reception (additional micro-seconds)
81 optional PolicyType appliedPolicyType = 7; // Type of the filtering policy (RPZ or Lua) applied
82 }
83
84 optional DNSResponse response = 13;
85 optional bytes originalRequestorSubnet = 14; // EDNS Client Subnet value
86 optional string requestorId = 15; // Username of the requestor
87 optional bytes initialRequestId = 16; // UUID of the incoming query that initiated this outgoing query or incoming response
88 optional bytes deviceId = 17; // Device ID of the requestor (could be mac address IP address or e.g. IMEI)
89 optional bool newlyObservedDomain = 18; // True if the domain has not been seen before
90 }