xorp

mld6igmp_source_record.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/contrib/mld6igmp_lite/mld6igmp_source_record.hh,v 1.3 2008/10/02 21:56:32 bms Exp $
00021 
00022 #ifndef __MLD6IGMP_MLD6IGMP_SOURCE_RECORD_HH__
00023 #define __MLD6IGMP_MLD6IGMP_SOURCE_RECORD_HH__
00024 
00025 
00026 //
00027 // IGMP and MLD source record.
00028 //
00029 
00030 
00031 
00032 
00033 
00034 #include "libxorp/ipvx.hh"
00035 #include "libxorp/timer.hh"
00036 
00037 
00038 //
00039 // Constants definitions
00040 //
00041 
00042 //
00043 // Structures/classes, typedefs and macros
00044 //
00045 
00046 class EventLoop;
00047 class Mld6igmpGroupRecord;
00048 
00053 class Mld6igmpSourceRecord {
00054 public:
00061     Mld6igmpSourceRecord(Mld6igmpGroupRecord& group_record,
00062              const IPvX& source);
00063     
00067     ~Mld6igmpSourceRecord();
00068 
00074     Mld6igmpGroupRecord& group_record() const   { return (_group_record); }
00075     
00081     const IPvX& source() const      { return (_source); }
00082 
00088     int family() const { return _source.af(); }
00089 
00095     void set_source_timer(const TimeVal& timeval);
00096 
00100     void cancel_source_timer();
00101 
00108     void lower_source_timer(const TimeVal& timeval);
00109 
00115     XorpTimer& source_timer() { return _source_timer; }
00116 
00122     uint32_t    timeout_sec()   const;
00123 
00129     size_t query_retransmission_count() const {
00130     return _query_retransmission_count;
00131     }
00132 
00138     void set_query_retransmission_count(size_t v) {
00139     _query_retransmission_count = v;
00140     }
00141 
00142 private:
00146     void source_timer_timeout();
00147 
00148     Mld6igmpGroupRecord& _group_record; // The group record we belong to
00149     IPvX    _source;        // The source address
00150     XorpTimer   _source_timer;      // The source timer
00151     size_t  _query_retransmission_count; // Count for periodic Queries
00152 };
00153 
00157 class Mld6igmpSourceSet : public map<IPvX, Mld6igmpSourceRecord *> {
00158 public:
00164     Mld6igmpSourceSet(Mld6igmpGroupRecord& group_record);
00165 
00169     ~Mld6igmpSourceSet();
00170 
00178     Mld6igmpSourceRecord* find_source_record(const IPvX& source);
00179 
00183     void delete_payload_and_clear();
00184 
00191     Mld6igmpSourceSet& operator=(const Mld6igmpSourceSet& other);
00192 
00200     Mld6igmpSourceSet operator+(const Mld6igmpSourceSet& other);
00201 
00210     Mld6igmpSourceSet operator+(const set<IPvX>& other);
00211 
00219     Mld6igmpSourceSet operator*(const Mld6igmpSourceSet& other);
00220 
00229     Mld6igmpSourceSet operator*(const set<IPvX>& other);
00230 
00238     Mld6igmpSourceSet operator-(const Mld6igmpSourceSet& other);
00239 
00248     Mld6igmpSourceSet operator-(const set<IPvX>& other);
00249 
00257     void set_source_timer(const set<IPvX>& sources, const TimeVal& timeval);
00258 
00264     void set_source_timer(const TimeVal& timeval);
00265 
00272     void cancel_source_timer(const set<IPvX>& sources);
00273 
00277     void cancel_source_timer();
00278 
00286     void lower_source_timer(const set<IPvX>& sources, const TimeVal& timeval);
00287 
00293     set<IPvX> extract_source_addresses() const;
00294 
00295 private:
00296     Mld6igmpGroupRecord& _group_record; // The group record this set belongs to
00297 };
00298 
00299 
00300 //
00301 // Global variables
00302 //
00303 
00304 //
00305 // Global functions prototypes
00306 //
00307 
00308 #endif // __MLD6IGMP_MLD6IGMP_SOURCE_RECORD_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations