xorp

rt_tab_pol_conn.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 // vim:set sts=4 ts=8:
00003 
00004 // Copyright (c) 2001-2009 XORP, Inc.
00005 //
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License, Version 2, June
00008 // 1991 as published by the Free Software Foundation. Redistribution
00009 // and/or modification of this program under the terms of any other
00010 // version of the GNU General Public License is not permitted.
00011 // 
00012 // This program is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00015 // see the GNU General Public License, Version 2, a copy of which can be
00016 // found in the XORP LICENSE.gpl file.
00017 // 
00018 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00019 // http://xorp.net
00020 
00021 // $XORP: xorp/rib/rt_tab_pol_conn.hh,v 1.9 2008/10/02 21:58:13 bms Exp $
00022 
00023 #ifndef __RIB_RT_TAB_POL_CONN_HH__
00024 #define __RIB_RT_TAB_POL_CONN_HH__
00025 
00026 #include "rt_tab_base.hh"
00027 
00028 #include "libxorp/xorp.h"
00029 #include "libxorp/xlog.h"
00030 #include "libxorp/debug.h"
00031 #include "libxorp/utils.hh"
00032 
00033 #include "policy/backend/policy_filters.hh"
00034 
00043 template<class A>
00044 class PolicyConnectedTable : public RouteTable<A> {
00045 public:
00046     static const string table_name;
00047 
00052     PolicyConnectedTable(RouteTable<A>* parent, PolicyFilters& pfs);
00053     ~PolicyConnectedTable();
00054 
00055     int add_route(const IPRouteEntry<A>& route, RouteTable<A>* caller);
00056     int delete_route(const IPRouteEntry<A>* route, RouteTable<A>* caller);
00057     const IPRouteEntry<A>* lookup_route(const IPNet<A>& net) const;
00058     const IPRouteEntry<A>* lookup_route(const A& addr) const;
00059     RouteRange<A>* lookup_route_range(const A& addr) const;
00060     TableType type() const { return POLICY_CONNECTED_TABLE; }
00061     RouteTable<A>* parent() { return _parent; }
00062     void replumb(RouteTable<A>* old_parent, RouteTable<A>* new_parent);
00063     string str() const;
00064 
00068     void push_routes();
00069 
00070 private:
00078     void do_filtering(IPRouteEntry<A>& r);
00079 
00080 
00081     typedef Trie<A, const IPRouteEntry<A>*> RouteContainer;
00082 
00083     
00084     RouteTable<A>*  _parent;
00085 
00086     RouteContainer  _route_table;   // Copy of routes
00087                     // we have this so we may push routes.
00088 
00089     PolicyFilters&  _policy_filters; // Reference to connected route filters.
00090 };
00091 
00092 #endif // __RIB_RT_TAB_POL_CONN_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations