xorp

pim_mrib_table.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/pim/pim_mrib_table.hh,v 1.15 2008/10/02 21:57:53 bms Exp $
00021 
00022 
00023 #ifndef __PIM_PIM_MRIB_TABLE_HH__
00024 #define __PIM_PIM_MRIB_TABLE_HH__
00025 
00026 
00027 //
00028 // PIM Multicast Routing Information Base Table header file.
00029 //
00030 
00031 
00032 
00033 
00034 #include "libxorp/timer.hh"
00035 #include "mrt/mrib_table.hh"
00036 
00037 
00038 //
00039 // Constants definitions
00040 //
00041 
00042 //
00043 // Structures/classes, typedefs and macros
00044 //
00045 
00046 class IPvXNet;
00047 class PimMrt;
00048 class PimNode;
00049 
00050 // PIM-specific Multicast Routing Information Base Table
00051 
00055 class PimMribTable : public MribTable {
00056 public:
00062     PimMribTable(PimNode& pim_node);
00063 
00067     virtual ~PimMribTable();
00068     
00069     // Redirection functions (to the pim_node)    
00070 
00077     PimNode&    pim_node() const { return (_pim_node);          }
00078 
00085     int     family();
00086 
00093     PimMrt& pim_mrt();
00094 
00098     void    clear();
00099 
00108     Mrib    *find(const IPvX& address) const;
00109     
00125     void    add_pending_insert(uint32_t tid, const Mrib& mrib,
00126                    const string& next_hop_vif_name);
00127 
00134     void    add_pending_remove(uint32_t tid, const Mrib& mrib);
00135 
00141     void    add_pending_remove_all_entries(uint32_t tid);
00142 
00148     void    commit_pending_transactions(uint32_t tid);
00149     
00156     void    apply_mrib_changes();
00157     
00163     list<IPvXNet>& modified_prefix_list() { return (_modified_prefix_list); }
00164 
00172     void    resolve_prefixes_by_vif_name(const string& next_hop_vif_name,
00173                          uint32_t next_hop_vif_index);
00174 
00175 private:
00176     PimNode&    _pim_node;      // The PIM node this table belongs to.
00177     
00181     void    add_modified_prefix(const IPvXNet& modified_prefix);
00182 
00187     void    add_unresolved_prefix(const IPvXNet& dest_prefix,
00188                       const string& next_hop_vif_name);
00189 
00194     void    delete_unresolved_prefix(const IPvXNet& dest_prefix);
00195 
00196     // The merged and enlarged list of modified prefixes that need
00197     // to be applied to the PimMrt.
00198     list<IPvXNet> _modified_prefix_list;
00199 
00200     // The map of unresolved prefixes whose next-hop vif name was not resolved
00201     map<IPvXNet, string> _unresolved_prefixes;
00202 };
00203 
00204 #endif // __PIM_PIM_MRIB_TABLE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations