]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/rec-lua-conf.hh
Merge remote-tracking branch 'origin/master' into rsakey-warn-keysize
[thirdparty/pdns.git] / pdns / rec-lua-conf.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 #include <set>
24
25 #include "sholder.hh"
26 #include "sortlist.hh"
27 #include "filterpo.hh"
28 #include "validate.hh"
29
30 struct ProtobufExportConfig
31 {
32 std::set<uint16_t> exportTypes = { QType::A, QType::AAAA, QType::CNAME };
33 ComboAddress server;
34 uint64_t maxQueuedEntries{100};
35 uint16_t timeout{2};
36 uint16_t reconnectWaitTime{1};
37 bool asyncConnect{false};
38 bool enabled{false};
39 bool logQueries{true};
40 bool logResponses{true};
41 bool taggedOnly{false};
42 };
43
44 class LuaConfigItems
45 {
46 public:
47 LuaConfigItems();
48 SortList sortlist;
49 DNSFilterEngine dfe;
50 map<DNSName,dsmap_t> dsAnchors;
51 map<DNSName,std::string> negAnchors;
52 ProtobufExportConfig protobufExportConfig;
53 ProtobufExportConfig outgoingProtobufExportConfig;
54 /* we need to increment this every time the configuration
55 is reloaded, so we know if we need to reload the protobuf
56 remote loggers */
57 uint64_t generation{0};
58 uint8_t protobufMaskV4{32};
59 uint8_t protobufMaskV6{128};
60 };
61
62 extern GlobalStateHolder<LuaConfigItems> g_luaconfs;
63
64 struct luaConfigDelayedThreads
65 {
66 std::vector<std::tuple<std::vector<ComboAddress>, boost::optional<DNSFilterEngine::Policy>, uint32_t, size_t, TSIGTriplet, size_t, ComboAddress, uint16_t, std::shared_ptr<SOARecordContent>, std::string> > rpzMasterThreads;
67 };
68
69 void loadRecursorLuaConfig(const std::string& fname, luaConfigDelayedThreads& delayedThreads);
70 void startLuaConfigDelayedThreads(const luaConfigDelayedThreads& delayedThreads, uint64_t generation);
71