Kea 1.5.0
host_data_source_factory.h
Go to the documentation of this file.
1// Copyright (C) 2015-2018 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#ifndef HOST_DATA_SOURCE_FACTORY_H
8#define HOST_DATA_SOURCE_FACTORY_H
9
13#include <boost/scoped_ptr.hpp>
14#include <boost/function.hpp>
15
16#include <string>
17#include <vector>
18#include <map>
19
20namespace isc {
21namespace dhcp {
22
28public:
29 NoHostDataSourceManager(const char* file, size_t line, const char* what) :
30 isc::Exception(file, line, what) {}
31};
32
42
44public:
66 static void add(HostDataSourceList& sources, const std::string& dbaccess);
67
76 static bool del(HostDataSourceList& sources, const std::string& db_type);
77
83
95 static bool registerFactory(const std::string& db_type,
96 const Factory& factory, bool no_log = false);
97
107 static bool deregisterFactory(const std::string& db_type,
108 bool no_log = false);
109
114 static bool registeredFactory(const std::string& db_type);
115
121 static void printRegistered();
122
123private:
125 static std::map<std::string, Factory> map_;
126};
127
128
129}; // end of isc::dhcp namespace
130}; // end of isc namespace
131
132#endif
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
boost::function< HostDataSourcePtr(const db::DatabaseConnection::ParameterMap &)> Factory
Type of host data source factory.
static bool deregisterFactory(const std::string &db_type, bool no_log=false)
Deregister a host data source factory.
static void add(HostDataSourceList &sources, const std::string &dbaccess)
Create and add an instance of a host data source.
static void printRegistered()
Prints out all registered backends.
static bool registerFactory(const std::string &db_type, const Factory &factory, bool no_log=false)
Register a host data source factory.
static bool del(HostDataSourceList &sources, const std::string &db_type)
Delete a host data source.
static bool registeredFactory(const std::string &db_type)
Check if a host data source factory was registered.
No host data source instance exception.
NoHostDataSourceManager(const char *file, size_t line, const char *what)
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
std::vector< HostDataSourcePtr > HostDataSourceList
HostDataSource list.
Defines the logger used by the top-level component of kea-dhcp-ddns.