xorp

local_data.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/bgp/local_data.hh,v 1.25 2008/10/02 21:56:16 bms Exp $
00021 
00022 #ifndef __BGP_LOCAL_DATA_HH__
00023 #define __BGP_LOCAL_DATA_HH__
00024 
00025 #include "bgp_module.h"
00026 
00027 #include "libxorp/xorp.h"
00028 #include "libxorp/debug.h"
00029 #include "libxorp/ipv4.hh"
00030 #include "libxorp/asnum.hh"
00031 
00032 
00033 
00034 #include "damping.hh"
00035 
00036 
00041 class LocalData {
00042 public:
00043     LocalData(EventLoop& eventloop) : _as(AsNum::AS_INVALID), 
00044                       _use_4byte_asnums(false),
00045                       _confed_id(AsNum::AS_INVALID),
00046                       _route_reflector(false),
00047                       _damping(eventloop),
00048                       _jitter(true)
00049     {}
00050 
00051 //     LocalData(const AsNum& as, const IPv4& id)
00052 //  : _as(as), _id(id), _confed_id(AsNum::AS_INVALID)
00053 //     {}
00054 
00058     const AsNum& get_as() const { return _as; }
00059 
00063     void set_as(const AsNum& a) { _as = a; }
00064 
00068     inline bool use_4byte_asnums() const {
00069     return _use_4byte_asnums;
00070     }
00071 
00072 
00076     inline void set_use_4byte_asnums(bool use_4byte_asnums) {
00077     _use_4byte_asnums = use_4byte_asnums;
00078     }
00079 
00080 
00084     const IPv4& get_id() const { return _id; }
00085 
00089     void set_id(const IPv4& i) {
00090     _id = i;
00091     }
00092 
00096     const AsNum& get_confed_id() const { return _confed_id; }
00097 
00101     void set_confed_id(const AsNum& confed_id) { _confed_id = confed_id; }
00102 
00106     const IPv4& get_cluster_id() const {
00107     XLOG_ASSERT(_route_reflector);
00108     return _cluster_id;
00109     }
00110 
00114     void set_cluster_id(const IPv4& cluster_id) { _cluster_id = cluster_id; }
00115 
00119     const bool& get_route_reflector() const { return _route_reflector; }
00120 
00124     void set_route_reflector(const bool route_reflector) {
00125     _route_reflector = route_reflector;
00126     }
00127 
00131     Damping& get_damping() {
00132     return _damping;
00133     }
00134 
00135     void set_jitter(bool jitter) {
00136     _jitter = jitter;
00137     }
00138 
00139     bool get_jitter() const {
00140     return _jitter;
00141     }
00142 
00143 private:
00144     AsNum   _as;                    // This routers AS number.
00145     bool        _use_4byte_asnums;      // Indicates to use 4byte AS numbers.
00146     IPv4    _id;                    // This routers ID.
00147     AsNum   _confed_id;     // Confederation identifier.
00148     IPv4    _cluster_id;        // Router reflector cluster ID
00149     bool    _route_reflector;   // True if this router is a
00150                     // route reflector
00151     Damping     _damping;       // Route Flap Damping parameters
00152     bool    _jitter;        // Jitter applied to timers.
00153 };
00154 #endif // __BGP_LOCAL_DATA_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations