Kea 1.5.0
backend_selector.h
Go to the documentation of this file.
1// Copyright (C) 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 BACKEND_SELECTOR_H
8#define BACKEND_SELECTOR_H
9
10#include <cc/data.h>
11#include <cstdint>
12#include <string>
13
14namespace isc {
15namespace db {
16
55public:
56
61 enum class Type {
62 MYSQL,
63 PGSQL,
64 CQL,
65 UNSPEC
66 };
67
73 explicit BackendSelector();
74
78 explicit BackendSelector(const Type& backend_type);
79
87 explicit BackendSelector(const std::string& host, const uint16_t port = 0);
88
136 explicit BackendSelector(const data::ConstElementPtr& access_map);
137
139 static const BackendSelector& UNSPEC();
140
145 bool amUnspecified() const;
146
149 return (backend_type_);
150 }
151
156 std::string getBackendHost() const {
157 return (host_);
158 }
159
164 uint16_t getBackendPort() const {
165 return (port_);
166 }
167
172 std::string toText() const;
173
177 static Type stringToBackendType(const std::string& type);
178
182 static std::string backendTypeToString(const Type& type);
183
184
185private:
186
192 void validate() const;
193
195 Type backend_type_;
196
198 std::string host_;
199
201 uint16_t port_;
202};
203
204
205} // end of namespace isc::db
206} // end of namespace isc
207
208#endif
Config Backend selector.
static std::string backendTypeToString(const Type &type)
Converts backend type to string.
Type getBackendType() const
Returns backend type selected.
std::string toText() const
Returns selections as text.
static Type stringToBackendType(const std::string &type)
Converts string to backend type.
std::string getBackendHost() const
Returns host selected.
uint16_t getBackendPort() const
Returns port selected.
Type
Supported database types.
bool amUnspecified() const
Checks if selector is "unspecified".
BackendSelector()
Default constructor.
static const BackendSelector & UNSPEC()
Returns instance of the "unspecified" backend selector.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
Defines the logger used by the top-level component of kea-dhcp-ddns.