Kea 2.7.6
server.cc
Go to the documentation of this file.
1// Copyright (C) 2019-2020 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 <database/server.h>
11#include <boost/make_shared.hpp>
12
13using namespace isc::db;
14using namespace isc::data;
15
16namespace isc {
17namespace db {
18
19Server::Server(const ServerTag& tag, const std::string& description)
20 : BaseStampedElement(), server_tag_(tag), description_(description) {
21
22 if (description_.length() > 65536) {
23 isc_throw(BadValue, "server description must not be longer than"
24 " 65536 characters");
25 }
26}
27
29Server::create(const ServerTag& tag, const std::string& description) {
30 return (boost::make_shared<Server>(tag, description));
31}
32
36
37 result->set("server-tag", Element::create(getServerTagAsText()));
38 result->set("description", Element::create(getDescription()));
39
40 return (result);
41}
42
43} // end of namespace isc::db
44} // end of namespace isc
This class represents configuration element which is associated with database identifier and the modi...
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
Represents a server tag.
Definition server_tag.h:25
static ServerPtr create(const data::ServerTag &tag, const std::string &description="")
Factory function to be used to create an instance of the Server object.
Definition server.cc:29
virtual data::ElementPtr toElement() const
Unparses server object.
Definition server.cc:34
std::string getServerTagAsText() const
Returns server tag as text.
Definition server.h:61
Server(const data::ServerTag &tag, const std::string &description)
Constructor.
Definition server.cc:19
std::string getDescription() const
Returns the description of the server.
Definition server.h:69
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition server.h:22
Defines the logger used by the top-level component of kea-lfc.