Kea 3.1.1
subnets_user_context.h
Go to the documentation of this file.
1// Copyright (C) 2017-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8#include <cc/data.h>
9
10namespace isc {
11namespace legal_log {
12
17template<typename SubnetPtrType>
18bool isLoggingDisabled(const SubnetPtrType& subnet) {
19 if (subnet) {
20 data::ConstElementPtr context = subnet->getContext();
21 // Context must be a map if specified.
22 if (context && (context->getType() == data::Element::map)) {
23 data::ConstElementPtr do_legal_logging = context->get("legal-logging");
24 // "legal-logging" parameter must be a boolean, if specified.
25 if (do_legal_logging && (do_legal_logging->getType() == data::Element::boolean)) {
26 return (!do_legal_logging->boolValue());
27 }
28 }
29 }
30 // legal-logging parameter not specified, so default to false.
31 return (false);
32}
33
34} // end of namespace isc::dhcp
35} // end of namespace isc
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
bool isLoggingDisabled(const SubnetPtrType &subnet)
Checks if legal logging is disabled for a subnet.
Defines the logger used by the top-level component of kea-lfc.