Kea 3.1.1
lease_query_impl_factory.cc
Go to the documentation of this file.
1// Copyright (C) 2020-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
11
12using namespace isc;
13using namespace isc::asiolink;
14using namespace isc::data;
15using namespace isc::lease_query;
16
17LeaseQueryImplPtr LeaseQueryImplFactory::impl_(0);
18
19void
21 if (family == AF_INET) {
22 impl_.reset(new LeaseQueryImpl4(config));
23 } else {
24 impl_.reset(new LeaseQueryImpl6(config));
25 }
26}
27
28void
30 impl_.reset();
31}
32
33const LeaseQueryImpl&
35 if (!impl_) {
36 isc_throw(Unexpected, "LeaseQueryImpl does not exist");
37 }
38
39 return (*impl_);
40}
41
44 if (!impl_) {
45 isc_throw(Unexpected, "LeaseQueryImpl does not exist");
46 }
47
48 return (*impl_);
49}
A generic exception that is thrown when an unexpected error condition occurs.
Provides configuration and for processing DHCPv4 lease queries.
Provides configuration and control flow for processing queries.
static void createImpl(uint16_t family, isc::data::ConstElementPtr config)
Creates the LeaseQueryImpl singleton.
static LeaseQueryImpl & getMutableImpl()
Fetch the LeaseQueryImpl singleton.
static const LeaseQueryImpl & getImpl()
Fetch the LeaseQueryImpl singleton.
static void destroyImpl()
Destroy the LeaseQueryImpl singleton.
Provides configuration and control flow for processing queries.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< LeaseQueryImpl > LeaseQueryImplPtr
Defines a smart pointer to LeaseQueryImpl instance.
Defines the logger used by the top-level component of kea-lfc.