Kea 3.1.8
radius_service.cc
Go to the documentation of this file.
1// Copyright (C) 2023-2026 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 <radius_service.h>
11
12using namespace std;
13using namespace isc;
14using namespace isc::data;
15using namespace isc::util;
16
17namespace isc {
18namespace radius {
19
20std::mutex
22
23RadiusService::RadiusService(const std::string& name)
24 : name_(name), enabled_(false), peer_updates_(true),
26}
27
32
36
37 // enabled.
38 result->set("enabled", Element::create(enabled_));
39
40 // servers.
41 if (!servers_.empty()) {
43 for (auto const& server : servers_) {
44 if (server) {
45 servers->add(server->toElement());
46 }
47 }
48 result->set("servers", servers);
49 }
50
51 // attributes.
52 if (!attributes_.empty()) {
53 result->set("attributes", attributes_.toElement());
54 }
55
56 // idle-timer-interval.
57 result->set("idle-timer-interval", Element::create(idle_timer_interval_));
58
59 return (result);
60}
61
62void
64 if (idle_timer_) {
65 idle_timer_->cancel();
66 idle_timer_.reset();
67 }
68}
69
70} // end of namespace isc::radius
71} // end of namespace isc
static ElementPtr create(const Position &pos=ZERO_POSITION())
Create a NullElement.
Definition data.cc:299
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:354
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:349
bool peer_updates_
Peer updates flag.
CfgAttributes attributes_
Attribute configurations.
RadiusService(const std::string &name)
Constructor.
data::ElementPtr toElement() const override
Unparse service configuration.
size_t max_pending_requests_
Maximum number of pending requests.
asiolink::IntervalTimerPtr idle_timer_
Idle timer.
long idle_timer_interval_
Idle timer interval in seconds.
Servers servers_
Server list.
void cancelIdleTimer()
Cancel idle timer.
virtual ~RadiusService()
Destructor.
static std::mutex idle_timer_mutex_
Idle timer mutex.
std::string name_
Name (access or accounting).
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
Defines the logger used by the top-level component of kea-lfc.
RAII lock object to protect the code in the same scope with a mutex.