xorp

rt_tab_pol_redist.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_redist.hh,v 1.9 2008/10/02 21:58:13 bms Exp $
00022 
00023 #ifndef __RIB_RT_TAB_POL_REDIST_HH__
00024 #define __RIB_RT_TAB_POL_REDIST_HH__
00025 
00026 #include "rt_tab_base.hh"
00027 
00028 #include "libxorp/xorp.h"
00029 #include "libxorp/utils.hh"
00030 #include "libxorp/eventloop.hh"
00031 
00032 #include "libxipc/xrl_std_router.hh"
00033 
00034 #include "policy/backend/policy_redist_map.hh"
00035 
00036 #include "xrl/interfaces/policy_redist4_xif.hh"
00037 #include "xrl/interfaces/policy_redist6_xif.hh"
00038 
00046 template<class A>
00047 class PolicyRedistTable : public RouteTable<A> {
00048 public:
00049     static const string table_name;
00050 
00051     PolicyRedistTable(RouteTable<A>* parent, XrlRouter& rtr, PolicyRedistMap&,
00052               bool multicast);
00053 
00054     int add_route(const IPRouteEntry<A>& route, RouteTable<A>* caller);
00055     int delete_route(const IPRouteEntry<A>* route, RouteTable<A>* caller);
00056     const IPRouteEntry<A>* lookup_route(const IPNet<A>& net) const;
00057     const IPRouteEntry<A>* lookup_route(const A& addr) const;
00058     RouteRange<A>* lookup_route_range(const A& addr) const;
00059     TableType type() const { return POLICY_REDIST_TABLE; }
00060     RouteTable<A>* parent() { return _parent; }
00061     void replumb(RouteTable<A>* old_parent, RouteTable<A>* new_parent);
00062     string str() const;
00063 
00064     void xrl_cb(const XrlError&, string); 
00065 
00075     void replace_policytags(const IPRouteEntry<A>& route,
00076                             const PolicyTags& prevtags,
00077                             RouteTable<A>* caller);
00078  
00079 
00080 private:
00081     typedef set<string> Set;
00082 
00089     void add_redist(const IPRouteEntry<A>& route, const Set& protos);
00090 
00097     void del_redist(const IPRouteEntry<A>& route, const Set& protos);
00098    
00105     void add_redist(const IPRouteEntry<A>& route, const string& proto);
00106 
00113     void del_redist(const IPRouteEntry<A>& route, const string& proto);
00114 
00115 
00116     RouteTable<A>*      _parent;
00117     
00118     XrlRouter&          _xrl_router;
00119     EventLoop&          _eventloop;
00120 
00121     PolicyRedistMap&        _redist_map;
00122 
00123     XrlPolicyRedist4V0p1Client  _redist4_client;
00124     XrlPolicyRedist6V0p1Client  _redist6_client;
00125 
00126     bool            _multicast;
00127 };
00128 
00129 #endif // __RIB_RT_TAB_POL_REDIST_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations