diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:36:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:36:04 +0000 |
commit | 040eee1aa49b49df4698d83a05af57c220127fd1 (patch) | |
tree | f635435954e6ccde5eee9893889e24f30ca68346 /src/lib/database/server.cc | |
parent | Initial commit. (diff) | |
download | isc-kea-040eee1aa49b49df4698d83a05af57c220127fd1.tar.xz isc-kea-040eee1aa49b49df4698d83a05af57c220127fd1.zip |
Adding upstream version 2.2.0.upstream/2.2.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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 |