xorp

rt_tab_deletion.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2009 XORP, Inc.
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/rib/rt_tab_deletion.hh,v 1.14 2008/10/02 21:58:12 bms Exp $
00021 
00022 #ifndef __RIB_RT_TAB_DELETION_HH__
00023 #define __RIB_RT_TAB_DELETION_HH__
00024 
00025 #include "libxorp/timer.hh"
00026 
00027 #include "rt_tab_base.hh"
00028 
00029 
00030 class EventLoop;
00031 
00038 template<class A>
00039 class DeletionTable : public RouteTable<A> {
00040 public:
00049     DeletionTable(const string& tablename,
00050           RouteTable<A>* parent,
00051           Trie<A,  const IPRouteEntry<A>* >* ip_route_trie,
00052           EventLoop& eventloop);
00053 
00057     ~DeletionTable();
00058 
00067     int add_route(const IPRouteEntry<A>& route, RouteTable<A>* caller);
00068 
00076     int delete_route(const IPRouteEntry<A>* route, RouteTable<A>* caller);
00077 
00083     void delete_all_routes();
00084 
00092     const IPRouteEntry<A>* lookup_route(const IPNet<A>& net) const;
00093 
00103     const IPRouteEntry<A>* lookup_route(const A& addr) const;
00104 
00117     RouteRange<A>* lookup_route_range(const A& addr) const;
00118 
00123     void background_deletion_pass();
00124 
00128     void unplumb_self();
00129 
00133     TableType type() const  { return DELETION_TABLE; }
00134 
00138     void replumb(RouteTable<A>* old_parent, RouteTable<A>* new_parent);
00139 
00143     string str() const;
00144 
00145     RouteTable<A>* parent() { return _parent; }
00146 
00147 private:
00148     RouteTable<A>*  _parent;
00149     EventLoop&      _eventloop;
00150     Trie<A, const IPRouteEntry<A>* >* _ip_route_table;
00151     XorpTimer       _background_deletion_timer;
00152 };
00153 
00154 #endif // __RIB_RT_TAB_DELETION_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations