]>
Commit | Line | Data |
---|---|---|
5e7672ff RG |
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 "dnsdist.hh" | |
25 | ||
26 | extern "C" { | |
0ed8f0fa | 27 | #include "dnsdist-lua-ffi-interface.h" |
5e7672ff RG |
28 | } |
29 | ||
30 | // dnsdist_ffi_dnsquestion_t is a lightuserdata | |
31 | template<> | |
32 | struct LuaContext::Pusher<dnsdist_ffi_dnsquestion_t*> { | |
33 | static const int minSize = 1; | |
34 | static const int maxSize = 1; | |
35 | ||
36 | static PushedObject push(lua_State* state, dnsdist_ffi_dnsquestion_t* ptr) noexcept { | |
37 | lua_pushlightuserdata(state, ptr); | |
38 | return PushedObject{state, 1}; | |
39 | } | |
40 | }; | |
41 | ||
42 | struct dnsdist_ffi_dnsquestion_t | |
43 | { | |
44 | dnsdist_ffi_dnsquestion_t(DNSQuestion* dq_): dq(dq_) | |
45 | { | |
46 | } | |
47 | ||
48 | DNSQuestion* dq{nullptr}; | |
49 | std::vector<dnsdist_ednsoption_t> ednsOptionsVect; | |
0ed8f0fa RG |
50 | std::vector<dnsdist_http_header_t> httpHeadersVect; |
51 | std::vector<dnsdist_tag_t> tagsVect; | |
5e7672ff | 52 | std::unordered_map<std::string, std::string> httpHeaders; |
0ed8f0fa | 53 | std::string trailingData; |
5e7672ff RG |
54 | boost::optional<std::string> result{boost::none}; |
55 | boost::optional<std::string> httpPath{boost::none}; | |
56 | boost::optional<std::string> httpQueryString{boost::none}; | |
57 | boost::optional<std::string> httpHost{boost::none}; | |
58 | boost::optional<std::string> httpScheme{boost::none}; | |
59 | }; | |
0ed8f0fa RG |
60 | |
61 | const std::string& getLuaFFIWrappers(); |