diff --git a/src/lib/dhcpsrv/network_state.cc b/src/lib/dhcpsrv/network_state.cc index 061ada84e1..0ba3f5f939 100644 --- a/src/lib/dhcpsrv/network_state.cc +++ b/src/lib/dhcpsrv/network_state.cc @@ -23,7 +23,8 @@ namespace isc { namespace dhcp { /// @brief Implementation of the @c NetworkState class. -class NetworkStateImpl : public boost::enable_shared_from_this { +class NetworkStateImpl : public boost::enable_shared_from_this, + public CfgToElement { public: /// @brief Constructor. @@ -178,7 +179,7 @@ public: /// @brief The network state as Element. /// /// @return The network state as Element. - ConstElementPtr toElement() const { + virtual ElementPtr toElement() const { ElementPtr result = Element::createMap(); result->set("globally-disabled", Element::create(globally_disabled_)); result->set("disabled-by-db-connection", Element::create(disabled_by_db_connection_ != 0)); @@ -303,7 +304,7 @@ NetworkState::selectiveEnable(const NetworkState::Networks&) { isc_throw(NotImplemented, "selectiveEnableService is not implemented"); } -ConstElementPtr NetworkState::toElement() const { +ElementPtr NetworkState::toElement() const { MultiThreadingLock lock(*mutex_); return (impl_->toElement()); } diff --git a/src/lib/dhcpsrv/network_state.h b/src/lib/dhcpsrv/network_state.h index b48697b91e..a8f9a60dec 100644 --- a/src/lib/dhcpsrv/network_state.h +++ b/src/lib/dhcpsrv/network_state.h @@ -7,6 +7,7 @@ #ifndef NETWORK_STATE_H #define NETWORK_STATE_H +#include #include #include #include @@ -68,7 +69,7 @@ class NetworkStateImpl; /// corresponding request to enable the service. It prevents the situation that the /// service remains disabled because there were more requests to disable than to /// enable the service. It is hard to ensure the same consistency for the HA. -class NetworkState { +class NetworkState : public isc::data::CfgToElement { public: /// @brief Origin of the network state transition. @@ -205,7 +206,7 @@ public: /// @brief The network state as Element. /// /// @return The network state as Element. - isc::data::ConstElementPtr toElement() const; + virtual isc::data::ElementPtr toElement() const; //@}