xorp

fea_data_plane_manager.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2007-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/fea_data_plane_manager.hh,v 1.13 2008/10/02 21:56:45 bms Exp $
00021 
00022 #ifndef __FEA_FEA_DATA_PLANE_MANAGER_HH__
00023 #define __FEA_FEA_DATA_PLANE_MANAGER_HH__
00024 
00025 
00026 
00027 class EventLoop;
00028 class FeaNode;
00029 class FibConfig;
00030 class FibConfigEntryGet;
00031 class FibConfigEntryObserver;
00032 class FibConfigEntrySet;
00033 class FibConfigForwarding;
00034 class FibConfigTableGet;
00035 class FibConfigTableObserver;
00036 class FibConfigTableSet;
00037 #ifndef XORP_DISABLE_FIREWALL
00038 class FirewallGet;
00039 class FirewallManager;
00040 class FirewallSet;
00041 #endif
00042 class IfConfig;
00043 class IfConfigGet;
00044 class IfConfigObserver;
00045 class IfConfigProperty;
00046 class IfConfigSet;
00047 class IfConfigVlanGet;
00048 class IfConfigVlanSet;
00049 class IfTree;
00050 class IoLink;
00051 class IoLinkManager;
00052 class IoIp;
00053 class IoIpManager;
00054 class IoTcpUdp;
00055 class IoTcpUdpManager;
00056 
00057 
00061 class FeaDataPlaneManager {
00062 public:
00069     FeaDataPlaneManager(FeaNode& fea_node, const string& manager_name);
00070 
00074     virtual ~FeaDataPlaneManager();
00075 
00081     const string& manager_name() const { return _manager_name; }
00082 
00089     virtual int start_manager(string& error_msg);
00090 
00097     virtual int stop_manager(string& error_msg);
00098 
00105     virtual int load_plugins(string& error_msg) = 0;
00106 
00113     virtual int unload_plugins(string& error_msg);
00114 
00120     virtual int register_plugins(string& error_msg) = 0;
00121 
00128     virtual int unregister_plugins(string& error_msg);
00129 
00136     virtual int start_plugins(string& error_msg);
00137 
00144     virtual int stop_plugins(string& error_msg);
00145 
00151     EventLoop&  eventloop();
00152 
00158     virtual bool have_ipv4() const;
00159 
00165     virtual bool have_ipv6() const;
00166 
00172     IfConfig& ifconfig();
00173 
00174 #ifndef XORP_DISABLE_FIREWALL
00175 
00180     FirewallManager& firewall_manager();
00181 
00187     FirewallGet* firewall_get() { return _firewall_get; }
00188 
00194     FirewallSet* firewall_set() { return _firewall_set; }
00195 
00196 #endif
00197 
00203     FibConfig& fibconfig();
00204 
00210     IoLinkManager& io_link_manager();
00211 
00217     IoIpManager& io_ip_manager();
00218 
00224     IoTcpUdpManager& io_tcpudp_manager();
00225 
00231     IfConfigProperty* ifconfig_property() { return _ifconfig_property; }
00232 
00238     IfConfigGet* ifconfig_get() { return _ifconfig_get; }
00239 
00245     IfConfigSet* ifconfig_set() { return _ifconfig_set; }
00246 
00252     IfConfigObserver* ifconfig_observer() { return _ifconfig_observer; }
00253 
00259     IfConfigVlanGet* ifconfig_vlan_get() { return _ifconfig_vlan_get; }
00260 
00266     IfConfigVlanSet* ifconfig_vlan_set() { return _ifconfig_vlan_set; }
00267 
00273     FibConfigForwarding* fibconfig_forwarding() { return _fibconfig_forwarding; }
00274 
00280     FibConfigEntryGet* fibconfig_entry_get() { return _fibconfig_entry_get; }
00281 
00287     FibConfigEntrySet* fibconfig_entry_set() { return _fibconfig_entry_set; }
00288 
00294     FibConfigEntryObserver* fibconfig_entry_observer() { return _fibconfig_entry_observer; }
00295 
00301     FibConfigTableGet* fibconfig_table_get() { return _fibconfig_table_get; }
00302 
00308     FibConfigTableSet* fibconfig_table_set() { return _fibconfig_table_set; }
00309 
00315     FibConfigTableObserver* fibconfig_table_observer() { return _fibconfig_table_observer; }
00316 
00329     virtual IoLink* allocate_io_link(const IfTree& iftree,
00330                      const string& if_name,
00331                      const string& vif_name,
00332                      uint16_t ether_type,
00333                      const string& filter_program) = 0;
00334 
00340     virtual void deallocate_io_link(IoLink* io_link);
00341 
00351     virtual IoIp* allocate_io_ip(const IfTree& iftree, int family,
00352                  uint8_t ip_protocol) = 0;
00353 
00359     virtual void deallocate_io_ip(IoIp* io_ip);
00360 
00371     virtual IoTcpUdp* allocate_io_tcpudp(const IfTree& iftree, int family,
00372                      bool is_tcp) = 0;
00373 
00379     virtual void deallocate_io_tcpudp(IoTcpUdp* io_tcpudp);
00380 
00381 protected:
00390     int register_all_plugins(bool is_exclusive, string& error_msg);
00391 
00398     int stop_all_plugins(string& error_msg);
00399 
00400     FeaNode&    _fea_node;
00401 
00402     //
00403     // The plugins
00404     //
00405     IfConfigProperty*       _ifconfig_property;
00406     IfConfigGet*        _ifconfig_get;
00407     IfConfigSet*        _ifconfig_set;
00408     IfConfigObserver*       _ifconfig_observer;
00409     IfConfigVlanGet*        _ifconfig_vlan_get;
00410     IfConfigVlanSet*        _ifconfig_vlan_set;
00411 #ifndef XORP_DISABLE_FIREWALL
00412     FirewallGet*        _firewall_get;
00413     FirewallSet*        _firewall_set;
00414 #endif
00415     FibConfigForwarding*    _fibconfig_forwarding;
00416     FibConfigEntryGet*      _fibconfig_entry_get;
00417     FibConfigEntrySet*      _fibconfig_entry_set;
00418     FibConfigEntryObserver* _fibconfig_entry_observer;
00419     FibConfigTableGet*      _fibconfig_table_get;
00420     FibConfigTableSet*      _fibconfig_table_set;
00421     FibConfigTableObserver* _fibconfig_table_observer;
00422     list<IoLink *>      _io_link_list;
00423     list<IoIp *>        _io_ip_list;
00424     list<IoTcpUdp *>        _io_tcpudp_list;
00425 
00426     //
00427     // Misc other state
00428     //
00429     const string    _manager_name;      // The data plane manager name
00430     bool        _is_loaded_plugins; // True if plugins are loaded
00431     bool        _is_running_manager;    // True if manager is running
00432     bool        _is_running_plugins;    // True if plugins are running
00433 };
00434 
00435 #endif // __FEA_FEA_DATA_PLANE_MANAGER_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations