]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnstap.hh
Merge pull request #7945 from pieterlexis/syncres-CNAME-cache-cleanup
[thirdparty/pdns.git] / pdns / dnstap.hh
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 #pragma once
23
24 #include <cstddef>
25 #include <string>
26
27 #include "config.h"
28
29 #include "dnsname.hh"
30 #include "iputils.hh"
31
32 #ifdef HAVE_PROTOBUF
33 #include <boost/uuid/uuid.hpp>
34 #include "dnstap.pb.h"
35 #endif /* HAVE_PROTOBUF */
36
37 class DnstapMessage
38 {
39 public:
40 DnstapMessage(const std::string& identity, const ComboAddress* requestor, const ComboAddress* responder, bool isTCP, const char* packet, const size_t len, const struct timespec* queryTime, const struct timespec* responseTime);
41 void serialize(std::string& data) const;
42 std::string toDebugString() const;
43
44 void setExtra(const std::string& extra);
45
46 #ifdef HAVE_PROTOBUF
47 protected:
48 dnstap::Dnstap proto_message;
49 #endif /* HAVE_PROTOBUF */
50 };