- name: "file_name"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "File to log to. Set to an empty string to log to the normal stdout log, this only works when ``-v`` is set on the command line"
- name: "binary"
type: "bool"
default: "true"
- cpp-optional: false
+ optional: false
description: "Whether to do binary logging"
- name: "append"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to append to an existing file"
- name: "buffered"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to use buffered I/O"
- name: "verbose_only"
type: "bool"
default: "true"
- cpp-optional: false
+ optional: false
description: "Whether to log only in verbose mode when logging to stdout"
- name: "include_timestamp"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to include a timestamp for every entry"
- name: "lua"
description: "Invoke a Lua function that accepts a :class:`DNSQuestion`. The function should return a :ref:`DNSAction`. If the Lua code fails, ``ServFail`` is returned"
- name: "stop_processing"
type: "bool"
default: "true"
- cpp-optional: false
+ optional: false
description: "Whether subsequent rules should be executed after this one"
- name: "QPS"
description: "Drop a packet if it does exceed the ``limit`` queries per second limit. Letting the subsequent rules apply otherwise"
- name: "stop_processing"
type: "bool"
default: "true"
- cpp-optional: false
+ optional: false
description: "Whether subsequent rules should be executed after this one"
- name: "RCode"
description: "Reply immediately by turning the query into a response with the specified rcode"
type: "String"
default: ""
description: "The IPv6 netmask, if any"
- cpp-optional: false
+ optional: false
- name: "SetECSOverride"
description: "Whether an existing EDNS Client Subnet value should be overridden (true) or not (false). Subsequent rules are processed after this action"
parameters:
- name: "extra_text"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "The optional EDNS Extended DNS Error extra text"
- name: "SetMacAddr"
description: "Add the source MAC address to the query as an EDNS0 option. This action is currently only supported on Linux. Subsequent rules are processed after this action"
- name: "reason"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "The SNMP trap reason"
- name: "Spoof"
description: "Forge a response with the specified IPv4 (for an A query) or IPv6 (for an AAAA) addresses. If you specify multiple addresses, all that match the query type (A, AAAA or ANY) will get spoofed in"
return out;
}
-template <class T>
-std::optional<T> boostToStandardOptional(const std::optional<T>& boostOpt)
-{
- return boostOpt ? *boostOpt : std::optional<T>();
-}
-
// NOLINTNEXTLINE(readability-function-cognitive-complexity): this function declares Lua bindings, even with a good refactoring it will likely blow up the threshold
void setupLuaActions(LuaContext& luaCtx)
{
const auto& smn = *boost::get<const SuffixMatchNode&>(&names);
return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn, quiet ? *quiet : false));
}
-
-template <class T>
-std::optional<T> boostToStandardOptional(const std::optional<T>& boostOpt)
-{
- return boostOpt ? *boostOpt : std::optional<T>();
-}
}
void setupLuaRuleChainsManagement(LuaContext& luaCtx)
- name: "file_name"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "File to log to. Set to an empty string to log to the normal stdout log, this only works when ``-v`` is set on the command line"
- name: "append"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to append to an existing file"
- name: "buffered"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to use buffered I/O"
- name: "verbose_only"
type: "bool"
default: "true"
- cpp-optional: false
+ optional: false
description: "Whether to log only in verbose mode when logging to stdout"
- name: "include_timestamp"
type: "bool"
default: "false"
- cpp-optional: false
+ optional: false
description: "Whether to include a timestamp for every entry"
- name: "lua"
description: "Invoke a Lua function that accepts a :class:`DNSResponse`. The function should return a :ref:`DNSResponseAction`. If the Lua code fails, ``ServFail`` is returned"
- name: "extra_text"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "The optional EDNS Extended DNS Error extra text"
- name: "SetMaxReturnedTTL"
description: "Cap the TTLs of the response to the given maximum, but only after inserting the response into the packet cache with the initial TTL values"
- name: "reason"
type: "String"
default: ""
- cpp-optional: false
+ optional: false
description: "The SNMP trap reason"
- name: "TC"
description: "Truncate an existing answer, to force the client to TCP. Only applied to answers that will be sent to the client over TCP. In addition to the TC bit being set, all records are removed from the answer, authority and additional sections"
if 'default' in parameter:
if lua_interface:
ptype = type_to_cpp(parameter['type'], lua_interface, True)
- ptype = f'boost::optional<{ptype}>'
- elif not 'cpp-optional' in parameter or parameter['cpp-optional']:
+ ptype = f'std::optional<{ptype}>'
+ elif not 'optional' in parameter or parameter['optional']:
ptype = type_to_cpp(parameter['type'], lua_interface, True)
ptype = f'std::optional<{ptype}>'
if len(output) > 0:
output += f'{pname}'
continue
- cpp_optional = not 'cpp-optional' in parameter or parameter['cpp-optional']
- if lua_interface and not cpp_optional:
+ optional = not 'optional' in parameter or parameter['optional']
+ if lua_interface and not optional:
# We are the Lua binding, and the factory does not handle optional values
# -> pass the value if any, and the default otherwise
default = parameter['default']
- elif lua_interface and cpp_optional:
- # we are the Lua binding, the factory does handle optional values,
- # -> boost::optional to std::optional
- output += f'boostToStandardOptional({pname})'
- continue
- elif not lua_interface and cpp_optional:
+ elif not lua_interface and optional:
# We are the C++ factory and we do handle optional values
# -> pass the value if any, and the default otherwise
default = parameter['default']