// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- // Copyright (c) 2007-2008 XORP, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software") // to deal in the Software without restriction, subject to the conditions // listed in the XORP LICENSE file. These conditions include: you must // preserve this copyright notice, and you cannot mention the copyright // holders in advertising related to the Software without their permission. // The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This // notice is a summary of the XORP LICENSE file; the license in that file is // legally binding. // $XORP: xorp/fea/ifconfig_vlan_set.hh,v 1.10 2008/07/23 05:10:09 pavlin Exp $ #ifndef __FEA_IFCONFIG_VLAN_SET_HH__ #define __FEA_IFCONFIG_VLAN_SET_HH__ #include "iftree.hh" #include "fea_data_plane_manager.hh" class IfConfig; class IfConfigVlanSet { public: /** * Constructor. * * @param fea_data_plane_manager the corresponding data plane manager * (@ref FeaDataPlaneManager). */ IfConfigVlanSet(FeaDataPlaneManager& fea_data_plane_manager) : _is_running(false), _ifconfig(fea_data_plane_manager.ifconfig()), _fea_data_plane_manager(fea_data_plane_manager) {} /** * Virtual destructor. */ virtual ~IfConfigVlanSet() {} /** * 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) = 0; /** * Stop operation. * * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ virtual int stop(string& error_msg) = 0; /** * Add a VLAN. * * If an entry for the same VLAN already exists, is is overwritten * with the new information. * * @param pulled_ifp pointer to the interface information pulled from * the system. * @param pulled_vifp pointer to the vif information pulled from * the system. * @param config_iface reference to the interface with the information * to configure. * @param config_vif reference to the vif with the information * to configure. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ virtual int config_add_vlan(const IfTreeInterface* pulled_ifp, const IfTreeVif* pulled_vifp, const IfTreeInterface& config_iface, const IfTreeVif& config_vif, string& error_msg) = 0; /** * Delete a VLAN. * * @param pulled_ifp pointer to the interface information pulled from * the system. * @param pulled_vifp pointer to the vif information pulled from * the system. * @param config_iface reference to the interface with the information * to configure. * @param config_vif reference to the vif with the information * to configure. * @param error_msg the error message (if error). * @return XORP_OK on success, otherwise XORP_ERROR. */ virtual int config_delete_vlan(const IfTreeInterface* pulled_ifp, const IfTreeVif* pulled_vifp, const IfTreeInterface& config_iface, const IfTreeVif& config_vif, string& error_msg) = 0; protected: // Misc other state bool _is_running; private: IfConfig& _ifconfig; FeaDataPlaneManager& _fea_data_plane_manager; }; #endif // __FEA_IFCONFIG_VLAN_SET_HH__