diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
commit | f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch) | |
tree | 49e44c6f87febed37efb953ab5485aa49f6481a7 /src/lib/database/server.cc | |
parent | Initial commit. (diff) | |
download | isc-kea-upstream.tar.xz isc-kea-upstream.zip |
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/database/server.cc')
-rw-r--r-- | src/lib/database/server.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/database/server.cc b/src/lib/database/server.cc new file mode 100644 index 0000000..1b6fcd1 --- /dev/null +++ b/src/lib/database/server.cc @@ -0,0 +1,44 @@ +// Copyright (C) 2019-2020 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <database/server.h> +#include <exceptions/exceptions.h> +#include <boost/make_shared.hpp> + +using namespace isc::db; +using namespace isc::data; + +namespace isc { +namespace db { + +Server::Server(const ServerTag& tag, const std::string& description) + : BaseStampedElement(), server_tag_(tag), description_(description) { + + if (description_.length() > 65536) { + isc_throw(BadValue, "server description must not be longer than" + " 65536 characters"); + } +} + +ServerPtr +Server::create(const ServerTag& tag, const std::string& description) { + return (boost::make_shared<Server>(tag, description)); +} + +ElementPtr +Server::toElement() const { + ElementPtr result = Element::createMap(); + + result->set("server-tag", Element::create(getServerTagAsText())); + result->set("description", Element::create(getDescription())); + + return (result); +} + +} // end of namespace isc::db +} // end of namespace isc |