]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Improve const-correctness of Lua bindings 9721/head
authorgeorgeto <georgeto@mailbox.org>
Fri, 13 Nov 2020 13:05:36 +0000 (14:05 +0100)
committergeorgeto <georgeto@mailbox.org>
Fri, 13 Nov 2020 14:19:41 +0000 (15:19 +0100)
commitacf16adc245382ade8c3c5423abb6328a62e3ec7
tree5e4f25cfb1c3dfcd9b4f18114adc6525974ac0bb
parent878ba55d6f6a605cccb59e23fab098f4512e3fc8
dnsdist: Improve const-correctness of Lua bindings

Since LuaWrapper enforces const-correctness, a const (shared) pointer
to an object can only read members and call const methods.
Therefore we have to take care to use the const qualifier during
registration of constant lambda Lua function bindings.

An example where the absence of the const qualifier was problematic is
LuaRule, which invokes its user provided match function with a constant
DNSQuestion object. Because the functions of DNSQuestion lacked
the const qualifier (e.g. getTag()), it was not possible to call them
from within the LuaRule match function.
pdns/dnsdist-ecs.cc
pdns/dnsdist-ecs.hh
pdns/dnsdist-lua-actions.cc
pdns/dnsdist-lua-bindings-dnsquestion.cc
pdns/dnsdist-lua-bindings.cc
pdns/dnsdist-lua-rules.cc
pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-lua-bindings-dnscrypt.cc
pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc
pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc
regression-tests.dnsdist/test_Advanced.py