]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix formatting issues
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 6 Mar 2024 11:09:41 +0000 (12:09 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 6 Mar 2024 11:10:07 +0000 (12:10 +0100)
pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc
pdns/dnsdistdist/dnsdist-lua-bindings.cc

index 6003f5c5e84b04eda22a9ec733331f5b16f0716c..9297dbccad81d75d9524170d0e86c09e3f91d87f 100644 (file)
@@ -42,7 +42,11 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx)
   luaCtx.registerMember<uint16_t(DNSQuestion::*)>(
     "qclass", [](const DNSQuestion& dnsQuestion) -> uint16_t { return dnsQuestion.ids.qclass; }, [](DNSQuestion& dnsQuestion, uint16_t newClass) { (void)newClass; });
   luaCtx.registerMember<int(DNSQuestion::*)>(
-    "rcode", [](const DNSQuestion& dnsQuestion) -> int { return static_cast<int>(dnsQuestion.getHeader()->rcode); }, [](DNSQuestion& dnsQuestion, int newRCode) {
+    "rcode",
+    [](const DNSQuestion& dnsQuestion) -> int {
+      return static_cast<int>(dnsQuestion.getHeader()->rcode);
+    },
+    [](DNSQuestion& dnsQuestion, int newRCode) {
       dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) {
         header.rcode = static_cast<decltype(header.rcode)>(newRCode);
         return true;
@@ -52,7 +56,11 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx)
     "remoteaddr", [](const DNSQuestion& dnsQuestion) -> ComboAddress { return dnsQuestion.ids.origRemote; }, [](DNSQuestion& dnsQuestion, const ComboAddress newRemote) { (void)newRemote; });
   /* DNSDist DNSQuestion */
   luaCtx.registerMember<dnsheader*(DNSQuestion::*)>(
-    "dh", [](const DNSQuestion& dnsQuestion) -> dnsheader* { return dnsQuestion.getMutableHeader(); }, [](DNSQuestion& dnsQuestion, const dnsheader* dnsHeader) {
+    "dh",
+    [](const DNSQuestion& dnsQuestion) -> dnsheader* {
+      return dnsQuestion.getMutableHeader();
+    },
+    [](DNSQuestion& dnsQuestion, const dnsheader* dnsHeader) {
       dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [&dnsHeader](dnsheader& header) {
         header = *dnsHeader;
         return true;
@@ -376,7 +384,11 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx)
   luaCtx.registerMember<uint16_t(DNSResponse::*)>(
     "qclass", [](const DNSResponse& dnsQuestion) -> uint16_t { return dnsQuestion.ids.qclass; }, [](DNSResponse& dnsQuestion, uint16_t newClass) { (void)newClass; });
   luaCtx.registerMember<int(DNSResponse::*)>(
-    "rcode", [](const DNSResponse& dnsQuestion) -> int { return static_cast<int>(dnsQuestion.getHeader()->rcode); }, [](DNSResponse& dnsQuestion, int newRCode) {
+    "rcode",
+    [](const DNSResponse& dnsQuestion) -> int {
+      return static_cast<int>(dnsQuestion.getHeader()->rcode);
+    },
+    [](DNSResponse& dnsQuestion, int newRCode) {
       dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) {
         header.rcode = static_cast<decltype(header.rcode)>(newRCode);
         return true;
@@ -385,7 +397,11 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx)
   luaCtx.registerMember<ComboAddress(DNSResponse::*)>(
     "remoteaddr", [](const DNSResponse& dnsQuestion) -> ComboAddress { return dnsQuestion.ids.origRemote; }, [](DNSResponse& dnsQuestion, const ComboAddress newRemote) { (void)newRemote; });
   luaCtx.registerMember<dnsheader*(DNSResponse::*)>(
-    "dh", [](const DNSResponse& dnsResponse) -> dnsheader* { return dnsResponse.getMutableHeader(); }, [](DNSResponse& dnsResponse, const dnsheader* dnsHeader) {
+    "dh",
+    [](const DNSResponse& dnsResponse) -> dnsheader* {
+      return dnsResponse.getMutableHeader();
+    },
+    [](DNSResponse& dnsResponse, const dnsheader* dnsHeader) {
       dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsResponse.getMutableData(), [&dnsHeader](dnsheader& header) {
         header = *dnsHeader;
         return true;
index ba63b54692a10bbab5db13ae61a7aef4adb382c1..21afaf5dd787e9efccced5f1ce53588ca9cdabb4 100644 (file)
@@ -283,10 +283,12 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck)
   luaCtx.registerFunction<string (DNSNameSet::*)() const>("__tostring", [](const DNSNameSet& dns) { return dns.toString(); });
   luaCtx.registerFunction<void (DNSNameSet::*)(DNSName&)>("add", [](DNSNameSet& dns, DNSName& name) { dns.insert(name); });
   luaCtx.registerFunction<bool (DNSNameSet::*)(DNSName&)>("check", [](DNSNameSet& dns, DNSName& name) { return dns.find(name) != dns.end(); });
+  // clang-format off
   luaCtx.registerFunction("delete", (size_t (DNSNameSet::*)(const DNSName&)) &DNSNameSet::erase);
   luaCtx.registerFunction("size", (size_t (DNSNameSet::*)() const) &DNSNameSet::size);
   luaCtx.registerFunction("clear", (void (DNSNameSet::*)()) &DNSNameSet::clear);
   luaCtx.registerFunction("empty", (bool (DNSNameSet::*)() const) &DNSNameSet::empty);
+  // clang-format on
 #endif /* DISABLE_DNSNAME_BINDINGS */
 
 #ifndef DISABLE_SUFFIX_MATCH_BINDINGS
@@ -346,7 +348,9 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck)
     }
   });
 
+  // clang-format off
   luaCtx.registerFunction("check", (bool (SuffixMatchNode::*)(const DNSName&) const) &SuffixMatchNode::check);
+  // clang-format on
   luaCtx.registerFunction<boost::optional<DNSName> (SuffixMatchNode::*)(const DNSName&) const>("getBestMatch", [](const SuffixMatchNode& smn, const DNSName& needle) {
     boost::optional<DNSName> result{boost::none};
     auto res = smn.getBestMatch(needle);
@@ -381,7 +385,9 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck)
   luaCtx.registerFunction("isIPv4", &Netmask::isIPv4);
   luaCtx.registerFunction("isIpv6", &Netmask::isIPv6);
   luaCtx.registerFunction("isIPv6", &Netmask::isIPv6);
+  // clang-format off
   luaCtx.registerFunction("match", (bool (Netmask::*)(const string&) const) &Netmask::match);
+  // clang-format on
   luaCtx.registerFunction("toString", &Netmask::toString);
   luaCtx.registerFunction("__tostring", &Netmask::toString);
   luaCtx.registerEqFunction(&Netmask::operator==);
@@ -405,7 +411,9 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck)
     }
   });
 
+  // clang-format off
   luaCtx.registerFunction("match", (bool (NetmaskGroup::*)(const ComboAddress&) const) &NetmaskGroup::match);
+  // clang-format on
   luaCtx.registerFunction("size", &NetmaskGroup::size);
   luaCtx.registerFunction("clear", &NetmaskGroup::clear);
   luaCtx.registerFunction<string (NetmaskGroup::*)() const>("toString", [](const NetmaskGroup& nmg) { return "NetmaskGroup " + nmg.toString(); });