xorp

ifconfig_set.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, Version 2, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 // $XORP: xorp/fea/ifconfig_set.hh,v 1.63 2008/10/02 21:56:47 bms Exp $
00021 
00022 #ifndef __FEA_IFCONFIG_SET_HH__
00023 #define __FEA_IFCONFIG_SET_HH__
00024 
00025 #include "iftree.hh"
00026 #include "fea_data_plane_manager.hh"
00027 
00028 class IfConfig;
00029 class IPvX;
00030 
00031 
00032 class IfConfigSet {
00033 public:
00040     IfConfigSet(FeaDataPlaneManager& fea_data_plane_manager)
00041     : _is_running(false),
00042       _ifconfig(fea_data_plane_manager.ifconfig()),
00043       _fea_data_plane_manager(fea_data_plane_manager)
00044     {}
00045 
00049     virtual ~IfConfigSet() {}
00050 
00056     IfConfig&   ifconfig() { return _ifconfig; }
00057 
00063     FeaDataPlaneManager& fea_data_plane_manager() { return _fea_data_plane_manager; }
00064 
00070     virtual bool is_running() const { return _is_running; }
00071 
00078     virtual int start(string& error_msg) = 0;
00079     
00086     virtual int stop(string& error_msg) = 0;
00087 
00097     virtual int push_config(const IfTree& iftree);
00098 
00099 protected:
00107     virtual bool is_discard_emulated(const IfTreeInterface& i) const = 0;
00108 
00116     virtual bool is_unreachable_emulated(const IfTreeInterface& i) const = 0;
00117 
00124     virtual int config_begin(string& error_msg) = 0;
00125 
00132     virtual int config_end(string& error_msg) = 0;
00133 
00144     virtual int config_interface_begin(const IfTreeInterface* pulled_ifp,
00145                        IfTreeInterface& config_iface,
00146                        string& error_msg) = 0;
00147 
00158     virtual int config_interface_end(const IfTreeInterface* pulled_ifp,
00159                      const IfTreeInterface& config_iface,
00160                      string& error_msg) = 0;
00161 
00176     virtual int config_vif_begin(const IfTreeInterface* pulled_ifp,
00177                  const IfTreeVif* pulled_vifp,
00178                  const IfTreeInterface& config_iface,
00179                  const IfTreeVif& config_vif,
00180                  string& error_msg) = 0;
00181 
00196     virtual int config_vif_end(const IfTreeInterface* pulled_ifp,
00197                    const IfTreeVif* pulled_vifp,
00198                    const IfTreeInterface& config_iface,
00199                    const IfTreeVif& config_vif,
00200                    string& error_msg) = 0;
00201 
00223     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00224                    const IfTreeVif* pulled_vifp,
00225                    const IfTreeAddr4* pulled_addrp,
00226                    const IfTreeInterface& config_iface,
00227                    const IfTreeVif& config_vif,
00228                    const IfTreeAddr4& config_addr,
00229                    string& error_msg) = 0;
00230 
00249     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00250                       const IfTreeVif* pulled_vifp,
00251                       const IfTreeAddr4* pulled_addrp,
00252                       const IfTreeInterface& config_iface,
00253                       const IfTreeVif& config_vif,
00254                       const IfTreeAddr4& config_addr,
00255                       string& error_msg) = 0;
00256 
00278     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00279                    const IfTreeVif* pulled_vifp,
00280                    const IfTreeAddr6* pulled_addrp,
00281                    const IfTreeInterface& config_iface,
00282                    const IfTreeVif& config_vif,
00283                    const IfTreeAddr6& config_addr,
00284                    string& error_msg) = 0;
00285 
00304     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00305                       const IfTreeVif* pulled_vifp,
00306                       const IfTreeAddr6* pulled_addrp,
00307                       const IfTreeInterface& config_iface,
00308                       const IfTreeVif& config_vif,
00309                       const IfTreeAddr6& config_addr,
00310                       string& error_msg) = 0;
00311 
00312 protected:
00313     // Misc other state
00314     bool    _is_running;
00315 
00316 private:
00317     void push_iftree_begin(const IfTree& iftree);
00318     void push_iftree_end(const IfTree& iftree);
00319     void push_interface_begin(const IfTreeInterface* pulled_ifp,
00320                   IfTreeInterface& config_iface);
00321     void push_interface_end(const IfTreeInterface* pulled_ifp,
00322                 IfTreeInterface& config_iface);
00323     void push_if_creation(const IfTreeInterface* system_ifp,
00324               IfTreeInterface& config_iface);
00325     void push_vif_begin(const IfTreeInterface* pulled_ifp,
00326             const IfTreeVif* pulled_vifp,
00327             IfTreeInterface& config_iface,
00328             IfTreeVif& config_vif);
00329     void push_vif_end(const IfTreeInterface* pulled_ifp,
00330               const IfTreeVif* pulled_vifp,
00331               IfTreeInterface& config_iface,
00332               IfTreeVif& config_vif);
00333     void push_vif_address(const IfTreeInterface* pulled_ifp,
00334               const IfTreeVif* pulled_vifp,
00335               const IfTreeAddr4* pulled_addrp,
00336               IfTreeInterface& config_iface,
00337               IfTreeVif& config_vif,
00338               IfTreeAddr4& config_addr);
00339     void push_vif_address(const IfTreeInterface* pulled_ifp,
00340               const IfTreeVif* pulled_vifp,
00341               const IfTreeAddr6* pulled_addrp,
00342               IfTreeInterface& config_iface,
00343               IfTreeVif& config_vif,
00344               IfTreeAddr6& config_addr);
00345 
00346     IfConfig&       _ifconfig;
00347     FeaDataPlaneManager& _fea_data_plane_manager;
00348 };
00349 
00350 #endif // __FEA_IFCONFIG_SET_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations