xorp

rt_tab_log.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/rib/rt_tab_log.hh,v 1.10 2008/10/02 21:58:12 bms Exp $
00021 
00022 #ifndef __RIB_RT_TAB_LOG_HH__
00023 #define __RIB_RT_TAB_LOG_HH__
00024 
00025 
00026 
00027 #include "libxorp/xorp.h"
00028 #include "rt_tab_base.hh"
00029 
00030 
00043 template<typename A>
00044 class LogTable : public RouteTable<A> {
00045 public:
00046     LogTable(const string& tablename, RouteTable<A>* parent);
00047     ~LogTable();
00048 
00049     int add_route(const IPRouteEntry<A>& route, RouteTable<A>* caller);
00050     int delete_route(const IPRouteEntry<A>* , RouteTable<A>* caller);
00051     const IPRouteEntry<A>* lookup_route(const IPNet<A>& net) const;
00052     const IPRouteEntry<A>* lookup_route(const A& addr) const;
00053     RouteRange<A>* lookup_route_range(const A& addr) const;
00054     TableType type() const { return LOG_TABLE; }
00055     RouteTable<A>* parent() { return _parent; }
00056     void replumb(RouteTable<A>* old_parent, RouteTable<A>* new_parent);
00057     string str() const;
00058 
00059     uint32_t update_number() const;
00060 
00061 private:
00062     RouteTable<A>* _parent;
00063     uint32_t       _update_number;
00064 };
00065 
00066 
00067 
00074 template <typename A>
00075 class OstreamLogTable : public LogTable<A> {
00076 public:
00077     ostream& get();
00078     OstreamLogTable(const string&   tablename,
00079             RouteTable<A>*  parent,
00080             ostream&        out);
00081     int add_route(const IPRouteEntry<A>& route, RouteTable<A>* caller);
00082     int delete_route(const IPRouteEntry<A>* , RouteTable<A>* caller);
00083     string str() const;
00084 
00085 private:
00086     ostream& _o;
00087 };
00088 
00089 
00096 template <typename A>
00097 class XLogTraceTable : public LogTable<A> {
00098 public:
00099     XLogTraceTable(const string&    tablename,
00100            RouteTable<A>*   parent);
00101 
00102     int add_route(const IPRouteEntry<A>&    route,
00103           RouteTable<A>*        caller);
00104 
00105     int delete_route(const IPRouteEntry<A>*     proute,
00106              RouteTable<A>*         caller);
00107 
00108     string str() const;
00109 };
00110 
00117 template <typename A>
00118 class DebugMsgLogTable : public LogTable<A> {
00119 public:
00120     DebugMsgLogTable(const string&  tablename,
00121              RouteTable<A>*     parent);
00122 
00123     int add_route(const IPRouteEntry<A>&    route,
00124           RouteTable<A>*        caller);
00125 
00126     int delete_route(const IPRouteEntry<A>*     proute,
00127              RouteTable<A>*         caller);
00128 
00129     string str() const;
00130 };
00131 
00132 #endif // __RIB_RT_TAB_LOG_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations