xorp

mfea_vif.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 
00021 #ifndef __FEA_MFEA_VIF_HH__
00022 #define __FEA_MFEA_VIF_HH__
00023 
00024 
00025 //
00026 // MFEA virtual interface definition.
00027 //
00028 
00029 #include "libxorp/vif.hh"
00030 #include "libproto/proto_unit.hh"
00031 
00032 
00033 class MfeaNode;
00034 
00038 class MfeaVif : public ProtoUnit, public Vif {
00039 public:
00046     MfeaVif(MfeaNode& mfea_node, const Vif& vif);
00047     
00056     MfeaVif(MfeaNode& mfea_node, const MfeaVif& mfea_vif);
00057     
00061     virtual ~MfeaVif();
00062     
00069     int     start(string& error_msg);
00070     
00077     int     stop(string& error_msg);
00078 
00084     void    enable();
00085     
00092     void    disable();
00093 
00095     void notifyUpdated();
00096 
00109     int register_protocol(const string& module_instance_name,
00110               uint8_t   ip_protocol,
00111               string&   error_msg);
00112 
00121     int unregister_protocol(const string&   module_instance_name,
00122                 string&     error_msg);
00123 
00131     uint8_t min_ttl_threshold() const { return (_min_ttl_threshold); }
00132     
00140     void    set_min_ttl_threshold(uint8_t v) { _min_ttl_threshold = v; }
00141     
00149     uint32_t    max_rate_limit() const { return (_max_rate_limit); }
00150     
00158     void    set_max_rate_limit(uint32_t v) { _max_rate_limit = v; }
00159 
00165     const string& registered_module_instance_name() const {
00166     return _registered_module_instance_name;
00167     }
00168 
00174     uint8_t registered_ip_protocol() const {
00175     return (_registered_ip_protocol);
00176     }
00177 
00178 private:
00179     // Private functions
00180     MfeaNode&   mfea_node() const   { return (_mfea_node);      }
00181 
00191     string  flags_string() const;
00192     
00193     // Private state
00194     MfeaNode&   _mfea_node;     // The MFEA node I belong to
00195     uint8_t _min_ttl_threshold; // Min. TTL required to forward mcast pkts
00196     uint32_t    _max_rate_limit;    // Max. bw rate allowed to forward mcast
00197 
00198     //
00199     // State to keep information about the registered multicast routing
00200     // protocol for this vif.
00201     // There can be only one protocol instance registered which will be
00202     // responsible for the multicast routing on the vif.
00203     //
00204     string  _registered_module_instance_name;
00205     uint8_t _registered_ip_protocol;
00206 
00207     bool wants_to_be_started; // as soon as we can, ie if the interface appears.
00208 };
00209 
00210 //
00211 // Global variables
00212 //
00213 
00214 //
00215 // Global functions prototypes
00216 //
00217 
00218 #endif // __FEA_MFEA_VIF_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations