]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsdist-lua-vars.cc
2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
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.
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.
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.
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.
23 #include "ednsoptions.hh"
27 g_lua
.writeVariable("DNSAction", std::unordered_map
<string
,int>{
28 {"Drop", (int)DNSAction::Action::Drop
},
29 {"Nxdomain", (int)DNSAction::Action::Nxdomain
},
30 {"Refused", (int)DNSAction::Action::Refused
},
31 {"Spoof", (int)DNSAction::Action::Spoof
},
32 {"Allow", (int)DNSAction::Action::Allow
},
33 {"HeaderModify", (int)DNSAction::Action::HeaderModify
},
34 {"Pool", (int)DNSAction::Action::Pool
},
35 {"None",(int)DNSAction::Action::None
},
36 {"NoOp",(int)DNSAction::Action::NoOp
},
37 {"Delay", (int)DNSAction::Action::Delay
},
38 {"Truncate", (int)DNSAction::Action::Truncate
},
39 {"ServFail", (int)DNSAction::Action::ServFail
},
40 {"NoRecurse", (int)DNSAction::Action::NoRecurse
}
43 g_lua
.writeVariable("DNSResponseAction", std::unordered_map
<string
,int>{
44 {"Allow", (int)DNSResponseAction::Action::Allow
},
45 {"Delay", (int)DNSResponseAction::Action::Delay
},
46 {"Drop", (int)DNSResponseAction::Action::Drop
},
47 {"HeaderModify", (int)DNSResponseAction::Action::HeaderModify
},
48 {"ServFail", (int)DNSResponseAction::Action::ServFail
},
49 {"None", (int)DNSResponseAction::Action::None
}
52 g_lua
.writeVariable("DNSClass", std::unordered_map
<string
,int>{
54 {"CHAOS", QClass::CHAOS
},
55 {"NONE", QClass::NONE
},
59 g_lua
.writeVariable("DNSOpcode", std::unordered_map
<string
,int>{
60 {"Query", Opcode::Query
},
61 {"IQuery", Opcode::IQuery
},
62 {"Status", Opcode::Status
},
63 {"Notify", Opcode::Notify
},
64 {"Update", Opcode::Update
}
67 g_lua
.writeVariable("DNSSection", std::unordered_map
<string
,int>{
74 g_lua
.writeVariable("EDNSOptionCode", std::unordered_map
<string
,int>{
75 {"NSID", EDNSOptionCode::NSID
},
76 {"DAU", EDNSOptionCode::DAU
},
77 {"DHU", EDNSOptionCode::DHU
},
78 {"N3U", EDNSOptionCode::N3U
},
79 {"ECS", EDNSOptionCode::ECS
},
80 {"EXPIRE", EDNSOptionCode::EXPIRE
},
81 {"COOKIE", EDNSOptionCode::COOKIE
},
82 {"TCPKEEPALIVE", EDNSOptionCode::TCPKEEPALIVE
},
83 {"PADDING", EDNSOptionCode::PADDING
},
84 {"CHAIN", EDNSOptionCode::CHAIN
},
85 {"KEYTAG", EDNSOptionCode::KEYTAG
}
88 vector
<pair
<string
, int> > rcodes
= {{"NOERROR", RCode::NoError
},
89 {"FORMERR", RCode::FormErr
},
90 {"SERVFAIL", RCode::ServFail
},
91 {"NXDOMAIN", RCode::NXDomain
},
92 {"NOTIMP", RCode::NotImp
},
93 {"REFUSED", RCode::Refused
},
94 {"YXDOMAIN", RCode::YXDomain
},
95 {"YXRRSET", RCode::YXRRSet
},
96 {"NXRRSET", RCode::NXRRSet
},
97 {"NOTAUTH", RCode::NotAuth
},
98 {"NOTZONE", RCode::NotZone
},
99 {"BADVERS", ERCode::BADVERS
},
100 {"BADSIG", ERCode::BADSIG
},
101 {"BADKEY", ERCode::BADKEY
},
102 {"BADTIME", ERCode::BADTIME
},
103 {"BADMODE", ERCode::BADMODE
},
104 {"BADNAME", ERCode::BADNAME
},
105 {"BADALG", ERCode::BADALG
},
106 {"BADTRUNC", ERCode::BADTRUNC
},
107 {"BADCOOKIE",ERCode::BADCOOKIE
},
109 vector
<pair
<string
, int> > dd
;
110 for(const auto& n
: QType::names
)
111 dd
.push_back({n
.first
, n
.second
});
112 for(const auto& n
: rcodes
)
113 dd
.push_back({n
.first
, n
.second
});
114 g_lua
.writeVariable("dnsdist", dd
);
117 g_lua
.writeVariable("DNSCryptExchangeVersion", std::unordered_map
<string
,int>{
118 { "VERSION1", DNSCryptExchangeVersion::VERSION1
},
119 { "VERSION2", DNSCryptExchangeVersion::VERSION2
},
123 g_lua
.writeVariable("EDNSOptionCode", std::unordered_map
<string
, uint8_t>{
124 { "NSID", EDNSOptionCode::NSID
},
125 { "DAU", EDNSOptionCode::DAU
},
126 { "DHU", EDNSOptionCode::DHU
},
127 { "N3U", EDNSOptionCode::N3U
},
128 { "ECS", EDNSOptionCode::ECS
},
129 { "EXPIRE", EDNSOptionCode::EXPIRE
},
130 { "COOKIE", EDNSOptionCode::COOKIE
},
131 { "TCPKEEPALIVE", EDNSOptionCode::TCPKEEPALIVE
},
132 { "PADDING", EDNSOptionCode::PADDING
},
133 { "CHAIN", EDNSOptionCode::CHAIN
}