xorp

pim_proto_assert.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2009 XORP, Inc.
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/pim/pim_proto_assert.hh,v 1.12 2008/10/02 21:57:54 bms Exp $
00021 
00022 
00023 #ifndef __PIM_PIM_PROTO_ASSERT_HH__
00024 #define __PIM_PIM_PROTO_ASSERT_HH__
00025 
00026 
00027 //
00028 // PIM Assert related definitions.
00029 //
00030 
00031 
00032 #include "libxorp/ipvx.hh"
00033 
00034 
00035 //
00036 // Constants definitions
00037 //
00038 
00039 //
00040 // Structures/classes, typedefs and macros
00041 //
00042 
00043 // Assert-related metric
00044 class AssertMetric {
00045 public:
00046     AssertMetric(const IPvX& addr) : _addr(addr) {}
00047     bool    rpt_bit_flag() const { return (_rpt_bit_flag); }
00048     void    set_rpt_bit_flag(bool v) { _rpt_bit_flag = v; }
00049     uint32_t    metric_preference() const { return (_metric_preference); }
00050     void    set_metric_preference(uint32_t v) { _metric_preference = v; }
00051     uint32_t    metric() const { return (_metric); }
00052     void    set_metric(uint32_t v) { _metric = v; }
00053     const IPvX& addr() const { return (_addr); }
00054     void    set_addr(const IPvX& v) { _addr = v; }
00055     bool    operator>(const AssertMetric& other) const;
00056     bool    is_assert_cancel_metric() const;
00057     
00058 private:
00059     bool    _rpt_bit_flag;      // The SPT/RPT bit
00060     uint32_t    _metric_preference; // The metric preference
00061     uint32_t    _metric;        // The metric
00062     IPvX    _addr;          // The address of the Assert origin
00063 };
00064 
00065 enum assert_state_t {
00066     ASSERT_STATE_NOINFO = 0,
00067     ASSERT_STATE_WINNER,
00068     ASSERT_STATE_LOSER
00069 };
00070 
00071 //
00072 // Global variables
00073 //
00074 
00075 //
00076 // Global functions prototypes
00077 //
00078 
00079 #endif // __PIM_PIM_PROTO_ASSERT_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations