xorp

pim_mre_task.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 
00021 #ifndef __PIM_PIM_MRE_TASK_HH__
00022 #define __PIM_PIM_MRE_TASK_HH__
00023 
00024 
00025 //
00026 // PIM Multicast Routing Entry task definitions.
00027 //
00028 
00029 
00030 
00031 
00032 #include "libxorp/time_slice.hh"
00033 #include "pim_mre.hh"
00034 #include "pim_mre_track_state.hh"
00035 
00036 
00037 //
00038 // Constants definitions
00039 //
00040 
00041 
00042 //
00043 // Structures/classes, typedefs and macros
00044 //
00045 
00046 class PimMrt;
00047 
00048 // Task for PIM-specific Multicast Routing Entry
00049 class PimMreTask {
00050 public:
00051     PimMreTask(PimMrt* pim_mrt, PimMreTrackState::input_state_t input_state);
00052     ~PimMreTask();
00053     
00054     // General info: PimNode, PimMrt, family, etc.
00055     PimNode*    pim_node()  const;
00056     PimMrt* pim_mrt()   const   { return _pim_mrt;      }
00057     int     family()    const;
00058     
00059     bool    run_task();
00060     bool    run_task_rp();
00061     bool    run_task_wc();
00062     bool    run_task_sg_sg_rpt();
00063     bool    run_task_mfc();
00064     void    perform_pim_mre_actions(PimMre *pim_mre);
00065     void    perform_pim_mre_sg_sg_rpt_actions(PimMre *pim_mre_sg,
00066                           PimMre *pim_mre_sg_rpt);
00067     void    perform_pim_mfc_actions(PimMfc *pim_mfc);
00068     void    perform_pim_mfc_actions(const IPvX& source_addr,
00069                     const IPvX& group_addr);
00070     void    add_pim_mre(PimMre *pim_mre);
00071     void    add_pim_mre_delete(PimMre *pim_mre);
00072     void    add_pim_mfc(PimMfc *pim_mfc);
00073     void    add_pim_mfc_delete(PimMfc *pim_mfc);
00074     void    add_mrib_delete_list(const list<Mrib *>& mrib_list);
00075     
00076     //
00077     // (*,*,RP) state setup
00078     //
00079     void    set_rp_addr_rp(const IPvX& rp_addr) {
00080     _rp_addr_rp = rp_addr;
00081     _is_set_rp_addr_rp = true;
00082     }
00083     void    set_rp_addr_prefix_rp(const IPvXNet& rp_addr_prefix) {
00084     _rp_addr_prefix_rp = rp_addr_prefix;
00085     _is_set_rp_addr_prefix_rp = true;
00086     }
00087     
00088     //
00089     // (*,G) state setup
00090     //
00091     void    set_group_addr_wc(const IPvX& group_addr) {
00092     _group_addr_wc = group_addr;
00093     _is_set_group_addr_wc = true;
00094     }
00095     void    set_rp_addr_wc(const IPvX& rp_addr) {
00096     _rp_addr_wc = rp_addr;
00097     _is_set_rp_addr_wc = true;
00098     }
00099     void    set_group_addr_prefix_wc(const IPvXNet& group_addr_prefix) {
00100     _group_addr_prefix_wc = group_addr_prefix;
00101     _is_set_group_addr_prefix_wc = true;
00102     }
00103     
00104     //
00105     // (S,G) and (S,G,rpt) state setup
00106     //
00107     void    set_source_addr_sg_sg_rpt(const IPvX& source_addr) {
00108     _source_addr_sg_sg_rpt = source_addr;
00109     _is_set_source_addr_sg_sg_rpt = true;
00110     }
00111     void    set_group_addr_sg_sg_rpt(const IPvX& group_addr) {
00112     _group_addr_sg_sg_rpt = group_addr;
00113     _is_set_group_addr_sg_sg_rpt = true;
00114     }
00115     void    set_source_addr_prefix_sg_sg_rpt(const IPvXNet& addr_prefix) {
00116     _source_addr_prefix_sg_sg_rpt = addr_prefix;
00117     _is_set_source_addr_prefix_sg_sg_rpt = true;
00118     }
00119     void    set_rp_addr_sg_sg_rpt(const IPvX& rp_addr) {
00120     _rp_addr_sg_sg_rpt = rp_addr;
00121     _is_set_rp_addr_sg_sg_rpt = true;
00122     }
00123     
00124     //
00125     // PimMfc state setup
00126     //
00127     void    set_source_addr_mfc(const IPvX& source_addr) {
00128     _source_addr_mfc = source_addr;
00129     _is_set_source_addr_mfc = true;
00130     }
00131     void    set_group_addr_mfc(const IPvX& group_addr) {
00132     _group_addr_mfc = group_addr;
00133     _is_set_group_addr_mfc = true;
00134     }
00135     void    set_source_addr_prefix_mfc(const IPvXNet& addr_prefix) {
00136     _source_addr_prefix_mfc = addr_prefix;
00137     _is_set_source_addr_prefix_mfc = true;
00138     }
00139     void    set_rp_addr_mfc(const IPvX& rp_addr) {
00140     _rp_addr_mfc = rp_addr;
00141     _is_set_rp_addr_mfc = true;
00142     }
00143     
00144     //
00145     // Other related setup
00146     //
00147     void    set_pim_nbr_addr_rp(const IPvX& v) {
00148     _pim_nbr_addr = v;
00149     _is_set_pim_nbr_addr_rp = true;
00150     }
00151     void    set_pim_nbr_addr_wc(const IPvX& v) {
00152     _pim_nbr_addr = v;
00153     _is_set_pim_nbr_addr_wc = true;
00154     }
00155     void    set_pim_nbr_addr_sg_sg_rpt(const IPvX& v) {
00156     _pim_nbr_addr = v;
00157     _is_set_pim_nbr_addr_sg_sg_rpt = true;
00158     }
00159     void    set_vif_index(uint32_t v) { _vif_index = v; }
00160     void    set_addr_arg(const IPvX& v) { _addr_arg = v; }
00161     
00162     //
00163     // Misc. information
00164     //
00165     uint32_t    vif_index() const { return (_vif_index); }
00166     const IPvX& addr_arg() const { return (_addr_arg); }
00167     PimMreTrackState::input_state_t input_state() const { return (_input_state); }
00168     
00169 private:
00170     // Private state
00171     PimMrt* _pim_mrt;       // The PIM MRT
00172     
00173     list<PimMreAction>  _action_list_rp; // The list of (*,*,RP) actions
00174     list<PimMreAction>  _action_list_wc; // The list of (*,G) actions
00175     list<PimMreAction>  _action_list_sg_sg_rpt; // The list of (S,G) and
00176                         // (S,G,rpt) actions
00177     list<PimMreAction>  _action_list_mfc; // The list of MFC actions
00178     
00179     TimeSlice       _time_slice;    // The time slice
00180     
00181     const PimMreTrackState::input_state_t _input_state; // The input state
00182     
00183     //
00184     // (*,*,RP) related state
00185     //
00186     bool    _is_set_rp_addr_rp;
00187     IPvX    _rp_addr_rp;
00188     bool    _is_set_rp_addr_prefix_rp;
00189     IPvXNet _rp_addr_prefix_rp;
00190     list<PimMre *> _pim_mre_rp_list;        // (*,*,RP) entries to process
00191     list<PimMre *> _pim_mre_rp_processed_list;  // (*,*,RP) processed entries
00192     list<PimMre *> _pim_mre_rp_delete_list; // (*,*,RP) entries to delete
00193     // State to continue the processing with the next time slice
00194     bool    _is_processing_rp;
00195     bool    _is_processing_rp_addr_rp;
00196     IPvX    _processing_rp_addr_rp;
00197     
00198     //
00199     // (*,G) related state
00200     //
00201     bool    _is_set_group_addr_wc;
00202     IPvX    _group_addr_wc;
00203     bool    _is_set_rp_addr_wc;
00204     IPvX    _rp_addr_wc;
00205     bool    _is_set_group_addr_prefix_wc;
00206     IPvXNet _group_addr_prefix_wc;
00207     list<PimMre *> _pim_mre_wc_list;        // (*,G) entries to process
00208     list<PimMre *> _pim_mre_wc_processed_list;  // (*,G) processed entries
00209     list<PimMre *> _pim_mre_wc_delete_list; // (*,G) entries to delete
00210     // State to continue the processing with the next time slice
00211     bool    _is_processing_wc;
00212     bool    _is_processing_rp_addr_wc;
00213     IPvX    _processing_rp_addr_wc;
00214     bool    _is_processing_group_addr_wc;
00215     IPvX    _processing_group_addr_wc;
00216     
00217     //
00218     // (S,G) and (S,G,rpt) related state
00219     //
00220     bool    _is_set_source_addr_sg_sg_rpt;
00221     IPvX    _source_addr_sg_sg_rpt;
00222     bool    _is_set_group_addr_sg_sg_rpt;
00223     IPvX    _group_addr_sg_sg_rpt;
00224     bool    _is_set_source_addr_prefix_sg_sg_rpt;
00225     IPvXNet _source_addr_prefix_sg_sg_rpt;
00226     bool    _is_set_rp_addr_sg_sg_rpt;
00227     IPvX    _rp_addr_sg_sg_rpt;
00228     list<PimMre *> _pim_mre_sg_list;        // (S,G) entries to process
00229     list<PimMre *> _pim_mre_sg_processed_list;  // (S,G) processed entries
00230     list<PimMre *> _pim_mre_sg_delete_list; // (S,G) entries to delete
00231     list<PimMre *> _pim_mre_sg_rpt_list;    // (S,G,rpt) entries to process
00232     list<PimMre *> _pim_mre_sg_rpt_processed_list;// (S,G,rpt) processed entries
00233     list<PimMre *> _pim_mre_sg_rpt_delete_list; // (S,G,rpt) entries to delete
00234     // State to continue the processing with the next time slice
00235     bool    _is_processing_sg_sg_rpt;
00236     bool    _is_processing_sg_source_addr_sg_sg_rpt;
00237     IPvX    _processing_sg_source_addr_sg_sg_rpt;
00238     bool    _is_processing_sg_rpt_source_addr_sg_sg_rpt;
00239     IPvX    _processing_sg_rpt_source_addr_sg_sg_rpt;
00240     bool    _is_processing_sg_group_addr_sg_sg_rpt;
00241     IPvX    _processing_sg_group_addr_sg_sg_rpt;
00242     bool    _is_processing_sg_rpt_group_addr_sg_sg_rpt;
00243     IPvX    _processing_sg_rpt_group_addr_sg_sg_rpt;
00244     bool    _is_processing_rp_addr_sg;
00245     bool    _is_processing_rp_addr_sg_rpt;
00246     IPvX    _processing_rp_addr_sg_sg_rpt;
00247     
00248     //
00249     // PimMfc related state
00250     //
00251     bool    _is_set_source_addr_mfc;
00252     IPvX    _source_addr_mfc;
00253     bool    _is_set_group_addr_mfc;
00254     IPvX    _group_addr_mfc;
00255     bool    _is_set_source_addr_prefix_mfc;
00256     IPvXNet _source_addr_prefix_mfc;
00257     bool    _is_set_rp_addr_mfc;
00258     IPvX    _rp_addr_mfc;
00259     list<PimMfc *> _pim_mfc_list;       // PimMfc entries to process
00260     list<PimMfc *> _pim_mfc_processed_list; // PimMfc processed entries
00261     list<PimMfc *> _pim_mfc_delete_list;    // PimMfc entries to delete
00262     // State to continue the processing with the next time slice
00263     bool    _is_processing_mfc;
00264     bool    _is_processing_source_addr_mfc;
00265     IPvX    _processing_source_addr_mfc;
00266     bool    _is_processing_group_addr_mfc;
00267     IPvX    _processing_group_addr_mfc;
00268     bool    _is_processing_rp_addr_mfc;
00269     IPvX    _processing_rp_addr_mfc;
00270     
00271     //
00272     // (*,*,RP), (*,G), (S,G), (S,G,rpt) PimNbr related state
00273     //
00274     bool    _is_set_pim_nbr_addr_rp;
00275     bool    _is_set_pim_nbr_addr_wc;
00276     bool    _is_set_pim_nbr_addr_sg_sg_rpt;
00277     IPvX    _pim_nbr_addr;
00278     bool    _is_processing_pim_nbr_addr_rp;
00279     bool    _is_processing_pim_nbr_addr_wc;
00280     bool    _is_processing_pim_nbr_addr_sg;
00281     bool    _is_processing_pim_nbr_addr_sg_rpt;
00282     
00283     // The 'occasionally-used' argument(s).
00284     uint32_t    _vif_index;
00285     IPvX    _addr_arg;
00286 
00287     //
00288     // Mrib related state
00289     //
00290     list<Mrib *> _mrib_delete_list;
00291 };
00292 
00293 #endif // __PIM_PIM_MRE_TASK_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations