diff options
Diffstat (limited to 'src/bin/d2/d2_controller.cc')
-rw-r--r-- | src/bin/d2/d2_controller.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/bin/d2/d2_controller.cc b/src/bin/d2/d2_controller.cc index 6ce6006807..a830722af3 100644 --- a/src/bin/d2/d2_controller.cc +++ b/src/bin/d2/d2_controller.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2017 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 @@ -8,6 +8,7 @@ #include <d2/d2_controller.h> #include <d2/d2_process.h> +#include <d2/parser_context.h> #include <process/spec_config.h> #include <stdlib.h> @@ -54,8 +55,31 @@ D2Controller::D2Controller() } } +isc::data::ConstElementPtr +D2Controller::parseFile(const std::string& file_name) { + isc::data::ConstElementPtr elements; + + // Read contents of the file and parse it as JSON + D2ParserContext parser; + elements = parser.parseFile(file_name, D2ParserContext::PARSER_DHCPDDNS); + if (!elements) { + isc_throw(isc::BadValue, "no configuration found in file"); + } + + return (elements); +} + D2Controller::~D2Controller() { } +std::string +D2Controller::getVersionAddendum() { + std::stringstream stream; + // Currently the only dependency D2 adds to base is cryptolink + stream << isc::cryptolink::CryptoLink::getVersion() << std::endl; + return (stream.str()); + +} + }; // end namespace isc::d2 }; // end namespace isc |