// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- // Copyright (c) 2007-2009 XORP, Inc. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License, Version 2, June // 1991 as published by the Free Software Foundation. Redistribution // and/or modification of this program under the terms of any other // version of the GNU General Public License is not permitted. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details, // see the GNU General Public License, Version 2, a copy of which can be // found in the XORP LICENSE.gpl file. // // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; // http://xorp.net // $XORP: xorp/fea/ifconfig_property.hh,v 1.6 2009/01/05 18:30:49 jtc Exp $ #ifndef __FEA_IFCONFIG_PROPERTY_HH__ #define __FEA_IFCONFIG_PROPERTY_HH__ #include "fea_data_plane_manager.hh" class IfConfig; class IfConfigProperty { public: /** * Constructor. * * @param fea_data_plane_manager the corresponding data plane manager * (@ref FeaDataPlaneManager). */ IfConfigProperty(FeaDataPlaneManager& fea_data_plane_manager); /** * Virtual destructor. */ virtual ~IfConfigProperty(); /** * Get the @ref IfConfig instance. * * @return the @ref IfConfig instance. */ IfConfig& ifconfig() { return _ifconfig; } /** * Get the @ref FeaDataPlaneManager instance. * * @return the @ref FeaDataPlaneManager instance. */ FeaDataPlaneManager& fea_data_plane_manager() { return _fea_data_plane_manager; } /** * Test whether this instance is running. * * @return true if the instance is running, otherwise false. */ virtual bool is_running() const { return _is_running; } /** * Start operation. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ virtual int start(string& error_msg); /** * Stop operation. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ virtual int stop(string& error_msg); /** * Return true if the underlying system supports IPv4. * * @return true if the underlying system supports IPv4, otherwise false. */ virtual bool have_ipv4() const { return (_have_ipv4); } /** * Return true if the underlying system supports IPv6. * * @return true if the underlying system supports IPv6, otherwise false. */ virtual bool have_ipv6() const { return (_have_ipv6); } /** * Test whether the underlying system supports IPv4. * * @return true if the underlying system supports IPv4, otherwise false. */ virtual bool test_have_ipv4() const = 0; /** * Test whether the underlying system supports IPv6. * * @return true if the underlying system supports IPv6, otherwise false. */ virtual bool test_have_ipv6() const = 0; protected: // Misc other state bool _is_running; private: IfConfig& _ifconfig; FeaDataPlaneManager& _fea_data_plane_manager; // Cached state whether the system has IPv4 or IPv6 support bool _have_ipv4; bool _have_ipv6; bool _first_start; // True if started for first time }; #endif // __FEA_IFCONFIG_PROPERTY_HH__