Kea 2.7.6
dependency.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2024 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
9#include <eval/dependency.h>
10#include <boost/pointer_cast.hpp>
11
12namespace isc {
13namespace dhcp {
14
15bool dependOnClass(const TokenPtr& token, const std::string& name) {
16 boost::shared_ptr<TokenMember> member;
17 member = boost::dynamic_pointer_cast<TokenMember>(token);
18 if (!member) {
19 return (false);
20 }
21 return (member->getClientClass() == name);
22}
23
24bool dependOnClass(const ExpressionPtr& expr, const std::string& name) {
25 if (!expr) {
26 return (false);
27 }
28 for (auto const& it : *expr) {
29 if (dependOnClass(it, name)) {
30 return (true);
31 }
32 }
33 return (false);
34}
35
36} // end of isc::dhcp namespace
37} // end of isc namespace
boost::shared_ptr< Token > TokenPtr
Pointer to a single Token.
Definition token.h:21
boost::shared_ptr< Expression > ExpressionPtr
Definition token.h:31
bool dependOnClass(const TokenPtr &token, const std::string &name)
Checks dependency on a token.
Definition dependency.cc:15
Defines the logger used by the top-level component of kea-lfc.