/src/pdns/pdns/dnsdistdist/dnsdist-query-count.hh
Line | Count | Source |
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 | | |
23 | | #pragma once |
24 | | |
25 | | #include <functional> |
26 | | #include <unordered_map> |
27 | | #include <string> |
28 | | #include <tuple> |
29 | | |
30 | | #include "lock.hh" |
31 | | |
32 | | struct DNSQuestion; |
33 | | |
34 | | namespace dnsdist::QueryCount |
35 | | { |
36 | | struct Configuration |
37 | | { |
38 | | using Filter = std::function<std::tuple<bool, std::string>(const DNSQuestion* dq)>; |
39 | 2 | Configuration() = default; |
40 | | Filter d_filter; |
41 | | bool d_enabled{false}; |
42 | | }; |
43 | | |
44 | | using Records = std::unordered_map<std::string, unsigned int>; |
45 | | extern SharedLockGuarded<Records> g_queryCountRecords; |
46 | | } |