blob: a896f1201428245e72bebde79ef5e5021c9a19a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright (C) 2019 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
|