xorp

fea_node.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2007-2012 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 
00021 #ifndef __FEA_FEA_NODE_HH__
00022 #define __FEA_FEA_NODE_HH__
00023 
00024 
00025 //
00026 // FEA (Forwarding Engine Abstraction) node implementation.
00027 //
00028 
00029 #ifndef XORP_DISABLE_PROFILE
00030 #include "libxorp/profile.hh"
00031 #endif
00032 
00033 #include "fibconfig.hh"
00034 #ifndef XORP_DISABLE_FIREWALL
00035 #include "firewall_manager.hh"
00036 #endif
00037 #include "ifconfig.hh"
00038 #include "io_link_manager.hh"
00039 #include "io_ip_manager.hh"
00040 #include "io_tcpudp_manager.hh"
00041 #include "nexthop_port_mapper.hh"
00042 
00043 class EventLoop;
00044 class FeaIo;
00045 
00051 class FeaNode {
00052 public:
00060     FeaNode(EventLoop& eventloop, FeaIo& fea_io, bool is_dummy);
00061 
00065     virtual ~FeaNode();
00066 
00072     int     startup();
00073 
00081     int     shutdown();
00082 
00088     bool    is_running() const;
00089 
00095     bool have_ipv4() const;
00096 
00102     bool have_ipv6() const;
00103 
00109     bool    is_dummy() const { return _is_dummy; }
00110 
00116     EventLoop& eventloop() { return (_eventloop); }
00117 
00118 #ifndef XORP_DISABLE_PROFILE
00119 
00125     Profile& profile() { return (_profile); }
00126 #endif
00127 
00134     NexthopPortMapper& nexthop_port_mapper() { return (_nexthop_port_mapper); }
00135 
00142     IfConfig& ifconfig() { return (_ifconfig); }
00143 
00144 #ifndef XORP_DISABLE_FIREWALL
00145 
00151     FirewallManager& firewall_manager() { return (_firewall_manager); }
00152 #endif
00153 
00160     FibConfig& fibconfig() { return (_fibconfig); }
00161 
00168     IoLinkManager& io_link_manager() { return (_io_link_manager); }
00169 
00176     IoIpManager& io_ip_manager() { return (_io_ip_manager); }
00177 
00184     IoTcpUdpManager& io_tcpudp_manager() { return (_io_tcpudp_manager); }
00185 
00194     int register_data_plane_manager(FeaDataPlaneManager* fea_data_plane_manager,
00195                     bool is_exclusive);
00196 
00203     int unregister_data_plane_manager(FeaDataPlaneManager* fea_data_plane_manager);
00204 
00210     FeaIo& fea_io() { return (_fea_io); }
00211 
00212 private:
00219     int load_data_plane_managers(string& error_msg);
00220 
00227     int unload_data_plane_managers(string& error_msg);
00228 
00229     EventLoop&  _eventloop; // The event loop to use
00230     bool    _is_running;    // True if the service is running
00231     bool    _is_dummy;  // True if running in dummy node
00232 #ifndef XORP_DISABLE_PROFILE
00233     Profile _profile;   // Profile entity
00234 #endif
00235     NexthopPortMapper       _nexthop_port_mapper;   // Next-hop port mapper
00236 
00237     IfConfig            _ifconfig;
00238 #ifndef XORP_DISABLE_FIREWALL
00239     FirewallManager     _firewall_manager;
00240 #endif
00241     FibConfig           _fibconfig;
00242 
00243     IoLinkManager       _io_link_manager;
00244     IoIpManager         _io_ip_manager;
00245     IoTcpUdpManager     _io_tcpudp_manager;
00246 
00247     list<FeaDataPlaneManager*>  _fea_data_plane_managers;
00248 
00249     FeaIo&          _fea_io;    // The FeaIo entry to use
00250 };
00251 
00252 #endif // __FEA_FEA_NODE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations