xorp

routemap.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/routemap.hh,v 1.12 2008/10/02 21:58:12 bms Exp $
00021 
00022 #ifndef __RIB_ROUTEMAP_HH__
00023 #define __RIB_ROUTEMAP_HH__
00024 
00025 
00026 
00027 #include "libxorp/xorp.h"
00028 #include "libxorp/ipv4net.hh"
00029 #include "libxorp/ipv6net.hh"
00030 #include "libxorp/nexthop.hh"
00031 
00032 #include "route.hh"
00033 
00034 
00035 class RMAction;
00036 class RMMatch;
00037 class RMRule;
00038 
00042 class RouteMap {
00043 public:
00044     RouteMap(const string& mapname);
00045     int add_rule(RMRule* rule);
00046     string str() const;
00047 
00048 private:
00049     string      _mapname;
00050     list<RMRule* >  _ruleset;
00051 };
00052 
00056 class RMRule {
00057 public:
00058     RMRule(int seq, RMMatch* match, RMAction* action);
00059     int seq() const { return _seq; }
00060     string str() const;
00061 
00062     bool operator<(const RMRule& other) const { return (seq() < other.seq()); }
00063 
00064 private:
00065     int     _seq;
00066     RMMatch*    _match;
00067     RMAction*   _action;
00068 };
00069 
00073 class RMMatch {
00074 public:
00075     RMMatch();
00076     virtual ~RMMatch() {};
00077     virtual string str() const = 0;
00078     virtual bool match_route(const RouteEntry& re) const = 0;
00079 
00080 private:
00081 };
00082 
00086 class RMMatchIPAddr : public RMMatch {
00087 public:
00088     RMMatchIPAddr(const IPv4Net& ipv4net);
00089     ~RMMatchIPAddr() {};
00090     string str() const;
00091     bool match_route(const RouteEntry& re) const;
00092 
00093 private:
00094     IPv4Net _ipv4net;
00095 };
00096 
00100 class RMAction {
00101 public:
00102     RMAction();
00103     string str() const;
00104 
00105 private:
00106 };
00107 
00108 #endif // __RIB_ROUTEMAP_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations