xorp

pim_mre_track_state.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_TRACK_STATE_HH__
00022 #define __PIM_PIM_MRE_TRACK_STATE_HH__
00023 
00024 
00025 //
00026 // PIM Multicast Routing Entry state tracking definitions.
00027 //
00028 
00029 #include "pim_mre.hh"
00030 
00031 
00032 class PimMfc;
00033 class PimMreAction;
00034 class PimMrt;
00035 class PimNbr;
00036 
00037 // State tracking for PIM-specific Multicast Routing Entry
00038 class PimMreTrackState {
00039 public:
00040     PimMreTrackState(PimMrt* pim_mrt);
00041 
00042     // General info: PimNode, PimMrt, family, etc.
00043     PimNode*    pim_node()  const;
00044     PimMrt* pim_mrt()   const   { return _pim_mrt;      }
00045     int     family()    const;
00046     
00047     void    print_actions_name() const;
00048     void    print_actions_num() const;
00049     
00050     //
00051     // The input state
00052     //
00053     enum input_state_t {
00054     INPUT_STATE_RP_CHANGED = 0,             // 0
00055     INPUT_STATE_MRIB_RP_CHANGED,                // 1
00056     INPUT_STATE_MRIB_S_CHANGED,             // 2
00057     INPUT_STATE_NBR_MRIB_NEXT_HOP_RP_CHANGED,       // 3
00058     INPUT_STATE_NBR_MRIB_NEXT_HOP_RP_GEN_ID_CHANGED,    // 4
00059     INPUT_STATE_NBR_MRIB_NEXT_HOP_RP_G_CHANGED,     // 5
00060     INPUT_STATE_NBR_MRIB_NEXT_HOP_S_CHANGED,        // 6
00061     INPUT_STATE_RPFP_NBR_WC_CHANGED,            // 7
00062     INPUT_STATE_RPFP_NBR_WC_GEN_ID_CHANGED,         // 8
00063     INPUT_STATE_RPFP_NBR_SG_CHANGED,            // 9
00064     INPUT_STATE_RPFP_NBR_SG_GEN_ID_CHANGED,         // 10
00065     INPUT_STATE_RPFP_NBR_SG_RPT_CHANGED,            // 11
00066     INPUT_STATE_RECEIVE_JOIN_RP,                // 12
00067     INPUT_STATE_RECEIVE_JOIN_WC,                // 13
00068     INPUT_STATE_RECEIVE_JOIN_SG,                // 14
00069     INPUT_STATE_RECEIVE_JOIN_SG_RPT,            // 15
00070     INPUT_STATE_RECEIVE_PRUNE_RP,               // 16
00071     INPUT_STATE_RECEIVE_PRUNE_WC,               // 17
00072     INPUT_STATE_RECEIVE_PRUNE_SG,               // 18
00073     INPUT_STATE_RECEIVE_PRUNE_SG_RPT,           // 19
00074     INPUT_STATE_RECEIVE_END_OF_MESSAGE_SG_RPT,      // 20
00075     INPUT_STATE_SEE_PRUNE_WC,               // 21
00076     INPUT_STATE_DOWNSTREAM_JP_STATE_RP,         // 22
00077     INPUT_STATE_DOWNSTREAM_JP_STATE_WC,         // 23
00078     INPUT_STATE_DOWNSTREAM_JP_STATE_SG,         // 24
00079     INPUT_STATE_DOWNSTREAM_JP_STATE_SG_RPT,         // 25
00080     INPUT_STATE_UPSTREAM_JP_STATE_SG,           // 26
00081     INPUT_STATE_LOCAL_RECEIVER_INCLUDE_WC,          // 27
00082     INPUT_STATE_LOCAL_RECEIVER_INCLUDE_SG,          // 28
00083     INPUT_STATE_LOCAL_RECEIVER_EXCLUDE_SG,          // 29
00084     INPUT_STATE_ASSERT_STATE_WC,                // 30
00085     INPUT_STATE_ASSERT_STATE_SG,                // 31
00086     INPUT_STATE_ASSERT_WINNER_NBR_WC_GEN_ID_CHANGED,    // 32
00087     INPUT_STATE_ASSERT_WINNER_NBR_SG_GEN_ID_CHANGED,    // 33
00088     INPUT_STATE_ASSERT_WINNER_NBR_WC_NLT_EXPIRED,       // 34
00089     INPUT_STATE_ASSERT_WINNER_NBR_SG_NLT_EXPIRED,       // 35
00090     INPUT_STATE_ASSERT_RPF_INTERFACE_WC_CHANGED,        // 36
00091     INPUT_STATE_ASSERT_RPF_INTERFACE_SG_CHANGED,        // 37
00092     INPUT_STATE_I_AM_DR,                    // 38
00093     INPUT_STATE_MY_IP_ADDRESS,              // 39
00094     INPUT_STATE_MY_IP_SUBNET_ADDRESS,           // 40
00095     INPUT_STATE_SPT_SWITCH_THRESHOLD_CHANGED_MFC,       // 41
00096     INPUT_STATE_WAS_SWITCH_TO_SPT_DESIRED_SG,       // 42
00097     INPUT_STATE_KEEPALIVE_TIMER_SG,             // 43
00098     INPUT_STATE_SPTBIT_SG,                  // 44
00099     INPUT_STATE_IN_START_VIF,               // 45
00100     INPUT_STATE_IN_STOP_VIF,                // 46
00101     INPUT_STATE_IN_ADD_PIM_MRE_RP,              // 47
00102     INPUT_STATE_IN_ADD_PIM_MRE_WC,              // 48
00103     INPUT_STATE_IN_ADD_PIM_MRE_SG,              // 49
00104     INPUT_STATE_IN_ADD_PIM_MRE_SG_RPT,          // 50
00105     INPUT_STATE_IN_REMOVE_PIM_MRE_RP,           // 51
00106     INPUT_STATE_IN_REMOVE_PIM_MRE_WC,           // 52
00107     INPUT_STATE_IN_REMOVE_PIM_MRE_SG,           // 53
00108     INPUT_STATE_IN_REMOVE_PIM_MRE_SG_RPT,           // 54
00109     INPUT_STATE_IN_REMOVE_PIM_MFC,              // 55
00110     //
00111     // XXX: INPUT_STATE_IN_REMOVE_MISC is a special input state
00112     // without output actions that is used only to remove various
00113     // entries when the event-handling task itself is deleted.
00114     //
00115     INPUT_STATE_IN_REMOVE_MISC,             // 55
00116     INPUT_STATE_MAX
00117     };
00118     //
00119     // The output state
00120     //
00121     enum output_state_t {
00122     OUTPUT_STATE_RP_WC = 0,                 // 0
00123     OUTPUT_STATE_RP_SG,                 // 1
00124     OUTPUT_STATE_RP_SG_RPT,                 // 2
00125     OUTPUT_STATE_RP_MFC,                    // 3
00126     OUTPUT_STATE_MRIB_RP_RP,                // 4
00127     OUTPUT_STATE_MRIB_RP_WC,                // 5
00128     OUTPUT_STATE_MRIB_RP_SG,                // 6
00129     OUTPUT_STATE_MRIB_RP_SG_RPT,                // 7
00130     OUTPUT_STATE_MRIB_S_SG,                 // 8
00131     OUTPUT_STATE_MRIB_S_SG_RPT,             // 9
00132     OUTPUT_STATE_IS_JOIN_DESIRED_RP,            // 10
00133     OUTPUT_STATE_IS_JOIN_DESIRED_WC,            // 11
00134     OUTPUT_STATE_IS_JOIN_DESIRED_SG,            // 12
00135     OUTPUT_STATE_IS_PRUNE_DESIRED_SG_RPT,           // 13
00136     OUTPUT_STATE_IS_PRUNE_DESIRED_SG_RPT_SG,        // 14
00137     OUTPUT_STATE_IS_RPT_JOIN_DESIRED_G,         // 15
00138     OUTPUT_STATE_INHERITED_OLIST_SG_RPT,            // 16
00139     OUTPUT_STATE_IIF_OLIST_MFC,             // 17
00140     OUTPUT_STATE_MONITORING_SWITCH_TO_SPT_DESIRED_MFC,  // 18
00141     OUTPUT_STATE_SPT_SWITCH_THRESHOLD_CHANGED_MFC,      // 19
00142     OUTPUT_STATE_IS_DIRECTLY_CONNECTED_SG,          // 20
00143     OUTPUT_STATE_IS_COULD_REGISTER_SG,          // 21
00144     OUTPUT_STATE_ASSERT_TRACKING_DESIRED_SG,        // 22
00145     OUTPUT_STATE_ASSERT_TRACKING_DESIRED_WC,        // 23
00146     OUTPUT_STATE_COULD_ASSERT_SG,               // 24
00147     OUTPUT_STATE_COULD_ASSERT_WC,               // 25
00148     OUTPUT_STATE_MY_ASSERT_METRIC_SG,           // 26
00149     OUTPUT_STATE_MY_ASSERT_METRIC_WC,           // 27
00150     OUTPUT_STATE_ASSERT_RPF_INTERFACE_SG,           // 28
00151     OUTPUT_STATE_ASSERT_RPF_INTERFACE_WC,           // 29
00152     OUTPUT_STATE_ASSERT_RECEIVE_JOIN_SG,            // 30
00153     OUTPUT_STATE_ASSERT_RECEIVE_JOIN_WC,            // 31
00154     OUTPUT_STATE_ASSERT_WINNER_NBR_SG_GEN_ID,       // 32
00155     OUTPUT_STATE_ASSERT_WINNER_NBR_WC_GEN_ID,       // 33
00156     OUTPUT_STATE_ASSERT_WINNER_NBR_SG_NLT,          // 34
00157     OUTPUT_STATE_ASSERT_WINNER_NBR_WC_NLT,          // 35
00158     OUTPUT_STATE_RECEIVE_JOIN_WC_BY_SG_RPT,         // 36
00159     OUTPUT_STATE_RECEIVE_END_OF_MESSAGE_SG_RPT,     // 37
00160     OUTPUT_STATE_SG_SEE_PRUNE_WC,               // 38
00161     OUTPUT_STATE_RPFP_NBR_WC_ASSERT,            // 39
00162     OUTPUT_STATE_RPFP_NBR_WC_NOT_ASSERT,            // 40
00163     OUTPUT_STATE_RPFP_NBR_WC_GEN_ID,            // 41
00164     OUTPUT_STATE_RPFP_NBR_SG_ASSERT,            // 42
00165     OUTPUT_STATE_RPFP_NBR_SG_NOT_ASSERT,            // 43
00166     OUTPUT_STATE_RPFP_NBR_SG_GEN_ID,            // 44
00167     OUTPUT_STATE_RPFP_NBR_SG_RPT,               // 45
00168     OUTPUT_STATE_RPFP_NBR_SG_RPT_SG,            // 46
00169     OUTPUT_STATE_NBR_MRIB_NEXT_HOP_RP_RP,           // 47
00170     OUTPUT_STATE_NBR_MRIB_NEXT_HOP_RP_WC,           // 48
00171     OUTPUT_STATE_NBR_MRIB_NEXT_HOP_RP_GEN_ID,       // 49
00172     OUTPUT_STATE_NBR_MRIB_NEXT_HOP_S,           // 50
00173     OUTPUT_STATE_OUT_START_VIF_RP,              // 51
00174     OUTPUT_STATE_OUT_START_VIF_WC,              // 52
00175     OUTPUT_STATE_OUT_START_VIF_SG,              // 53
00176     OUTPUT_STATE_OUT_START_VIF_SG_RPT,          // 54
00177     OUTPUT_STATE_OUT_STOP_VIF_RP,               // 55
00178     OUTPUT_STATE_OUT_STOP_VIF_WC,               // 56
00179     OUTPUT_STATE_OUT_STOP_VIF_SG,               // 57
00180     OUTPUT_STATE_OUT_STOP_VIF_SG_RPT,           // 58
00181     OUTPUT_STATE_OUT_ADD_PIM_MRE_RP_ENTRY_RP,       // 59
00182     OUTPUT_STATE_OUT_ADD_PIM_MRE_RP_ENTRY_WC,       // 60
00183     OUTPUT_STATE_OUT_ADD_PIM_MRE_RP_ENTRY_SG,       // 61
00184     OUTPUT_STATE_OUT_ADD_PIM_MRE_RP_ENTRY_SG_RPT,       // 62
00185     OUTPUT_STATE_OUT_ADD_PIM_MRE_WC_ENTRY_WC,       // 63
00186     OUTPUT_STATE_OUT_ADD_PIM_MRE_WC_ENTRY_SG,       // 64
00187     OUTPUT_STATE_OUT_ADD_PIM_MRE_WC_ENTRY_SG_RPT,       // 65
00188     OUTPUT_STATE_OUT_ADD_PIM_MRE_SG_ENTRY_SG,       // 66
00189     OUTPUT_STATE_OUT_ADD_PIM_MRE_SG_ENTRY_SG_RPT,       // 67
00190     OUTPUT_STATE_OUT_ADD_PIM_MRE_SG_RPT_ENTRY_SG,       // 68
00191     OUTPUT_STATE_OUT_ADD_PIM_MRE_SG_RPT_ENTRY_SG_RPT,   // 69
00192     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_RP_ENTRY_RP,        // 70
00193     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_RP_ENTRY_WC,        // 71
00194     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_RP_ENTRY_SG,        // 72
00195     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_RP_ENTRY_SG_RPT,    // 73
00196     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_WC_ENTRY_WC,        // 74
00197     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_WC_ENTRY_SG,        // 75
00198     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_WC_ENTRY_SG_RPT,    // 76
00199     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_SG_ENTRY_SG,        // 77
00200     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_SG_ENTRY_SG_RPT,    // 78
00201     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_SG_RPT_ENTRY_SG,    // 79
00202     OUTPUT_STATE_OUT_REMOVE_PIM_MRE_SG_RPT_ENTRY_SG_RPT,    // 80
00203     OUTPUT_STATE_OUT_REMOVE_PIM_MFC_ENTRY_MFC,      // 81
00204     OUTPUT_STATE_UPDATE_SPTBIT_MFC,             // 82
00205     OUTPUT_STATE_SET_KEEPALIVE_TIMER_SG,            // 83
00206     OUTPUT_STATE_MAX
00207     };
00208     
00209     //
00210     // The input state methods
00211     //
00212     void    input_state_rp_changed(list<PimMreAction> action_list);
00213     void    input_state_mrib_rp_changed(list<PimMreAction> action_list);
00214     void    input_state_mrib_s_changed(list<PimMreAction> action_list);
00215     void    input_state_nbr_mrib_next_hop_rp_changed(list<PimMreAction> action_list);
00216     void    input_state_nbr_mrib_next_hop_rp_gen_id_changed(list<PimMreAction> action_list);
00217     void    input_state_nbr_mrib_next_hop_rp_g_changed(list<PimMreAction> action_list);
00218     void    input_state_nbr_mrib_next_hop_s_changed(list<PimMreAction> action_list);
00219     void    input_state_rpfp_nbr_wc_changed(list<PimMreAction> action_list);
00220     void    input_state_rpfp_nbr_wc_gen_id_changed(list<PimMreAction> action_list);
00221     void    input_state_rpfp_nbr_sg_changed(list<PimMreAction> action_list);
00222     void    input_state_rpfp_nbr_sg_gen_id_changed(list<PimMreAction> action_list);
00223     void    input_state_rpfp_nbr_sg_rpt_changed(list<PimMreAction> action_list);
00224     void    input_state_receive_join_rp(list<PimMreAction> action_list);
00225     void    input_state_receive_join_wc(list<PimMreAction> action_list);
00226     void    input_state_receive_join_sg(list<PimMreAction> action_list);
00227     void    input_state_receive_join_sg_rpt(list<PimMreAction> action_list);
00228     void    input_state_receive_prune_rp(list<PimMreAction> action_list);
00229     void    input_state_receive_prune_wc(list<PimMreAction> action_list);
00230     void    input_state_receive_prune_sg(list<PimMreAction> action_list);
00231     void    input_state_receive_prune_sg_rpt(list<PimMreAction> action_list);
00232     void    input_state_receive_end_of_message_sg_rpt(list<PimMreAction> action_list);
00233     void    input_state_see_prune_wc(list<PimMreAction> action_list);
00234     void    input_state_downstream_jp_state_rp(list<PimMreAction> action_list);
00235     void    input_state_downstream_jp_state_wc(list<PimMreAction> action_list);
00236     void    input_state_downstream_jp_state_sg(list<PimMreAction> action_list);
00237     void    input_state_downstream_jp_state_sg_rpt(list<PimMreAction> action_list);
00238     void    input_state_upstream_jp_state_sg(list<PimMreAction> action_list);
00239     void    input_state_local_receiver_include_wc(list<PimMreAction> action_list);
00240     void    input_state_local_receiver_include_sg(list<PimMreAction> action_list);
00241     void    input_state_local_receiver_exclude_sg(list<PimMreAction> action_list);
00242     void    input_state_assert_state_wc(list<PimMreAction> action_list);
00243     void    input_state_assert_state_sg(list<PimMreAction> action_list);
00244     void    input_state_assert_winner_nbr_wc_gen_id_changed(list<PimMreAction> action_list);
00245     void    input_state_assert_winner_nbr_sg_gen_id_changed(list<PimMreAction> action_list);
00246     void    input_state_assert_winner_nbr_wc_nlt_expired(list<PimMreAction> action_list);
00247     void    input_state_assert_winner_nbr_sg_nlt_expired(list<PimMreAction> action_list);
00248     void    input_state_assert_rpf_interface_wc_changed(list<PimMreAction> action_list);
00249     void    input_state_assert_rpf_interface_sg_changed(list<PimMreAction> action_list);
00250     void    input_state_i_am_dr(list<PimMreAction> action_list);
00251     void    input_state_my_ip_address(list<PimMreAction> action_list);
00252     void    input_state_my_ip_subnet_address(list<PimMreAction> action_list);
00253     void    input_state_spt_switch_threshold_changed_mfc(list<PimMreAction> action_list);
00254     void    input_state_was_switch_to_spt_desired_sg(list<PimMreAction> action_list);
00255     void    input_state_keepalive_timer_sg(list<PimMreAction> action_list);
00256     void    input_state_sptbit_sg(list<PimMreAction> action_list);
00257     void    input_state_in_start_vif(list<PimMreAction> action_list);
00258     void    input_state_in_stop_vif(list<PimMreAction> action_list);
00259     void    input_state_in_add_pim_mre_rp(list<PimMreAction> action_list);
00260     void    input_state_in_add_pim_mre_wc(list<PimMreAction> action_list);
00261     void    input_state_in_add_pim_mre_sg(list<PimMreAction> action_list);
00262     void    input_state_in_add_pim_mre_sg_rpt(list<PimMreAction> action_list);
00263     void    input_state_in_remove_pim_mre_rp(list<PimMreAction> action_list);
00264     void    input_state_in_remove_pim_mre_wc(list<PimMreAction> action_list);
00265     void    input_state_in_remove_pim_mre_sg(list<PimMreAction> action_list);
00266     void    input_state_in_remove_pim_mre_sg_rpt(list<PimMreAction> action_list);
00267     void    input_state_in_remove_pim_mfc(list<PimMreAction> action_list);
00268     
00269     
00270     //
00271     // The output state methods
00272     //
00273     list<PimMreAction>  output_state_rp_wc(list<PimMreAction> action_list);
00274     list<PimMreAction>  output_state_rp_sg(list<PimMreAction> action_list);
00275     list<PimMreAction>  output_state_rp_sg_rpt(list<PimMreAction> action_list);
00276     list<PimMreAction>  output_state_rp_mfc(list<PimMreAction> action_list);
00277     list<PimMreAction>  output_state_mrib_rp_rp(list<PimMreAction> action_list);
00278     list<PimMreAction>  output_state_mrib_rp_wc(list<PimMreAction> action_list);
00279     list<PimMreAction>  output_state_mrib_rp_sg(list<PimMreAction> action_list);
00280     list<PimMreAction>  output_state_mrib_rp_sg_rpt(list<PimMreAction> action_list);
00281     list<PimMreAction>  output_state_mrib_s_sg(list<PimMreAction> action_list);
00282     list<PimMreAction>  output_state_mrib_s_sg_rpt(list<PimMreAction> action_list);
00283     list<PimMreAction>  output_state_is_join_desired_rp(list<PimMreAction> action_list);
00284     list<PimMreAction>  output_state_is_join_desired_wc(list<PimMreAction> action_list);
00285     list<PimMreAction>  output_state_is_join_desired_sg(list<PimMreAction> action_list);
00286     list<PimMreAction>  output_state_is_prune_desired_sg_rpt(list<PimMreAction> action_list);
00287     list<PimMreAction>  output_state_is_prune_desired_sg_rpt_sg(list<PimMreAction> action_list);
00288     list<PimMreAction>  output_state_is_rpt_join_desired_g(list<PimMreAction> action_list);
00289     list<PimMreAction>  output_state_inherited_olist_sg_rpt(list<PimMreAction> action_list);
00290     list<PimMreAction>  output_state_iif_olist_mfc(list<PimMreAction> action_list);
00291     list<PimMreAction>  output_state_monitoring_switch_to_spt_desired_mfc(list<PimMreAction> action_list);
00292     list<PimMreAction>  output_state_spt_switch_threshold_changed_mfc(list<PimMreAction> action_list);
00293     list<PimMreAction>  output_state_is_directly_connected_sg(list<PimMreAction> action_list);
00294     list<PimMreAction>  output_state_is_could_register_sg(list<PimMreAction> action_list);
00295     list<PimMreAction>  output_state_assert_tracking_desired_sg(list<PimMreAction> action_list);
00296     list<PimMreAction>  output_state_assert_tracking_desired_wc(list<PimMreAction> action_list);
00297     list<PimMreAction>  output_state_could_assert_sg(list<PimMreAction> action_list);
00298     list<PimMreAction>  output_state_could_assert_wc(list<PimMreAction> action_list);
00299     list<PimMreAction>  output_state_my_assert_metric_sg(list<PimMreAction> action_list);
00300     list<PimMreAction>  output_state_my_assert_metric_wc(list<PimMreAction> action_list);
00301     list<PimMreAction>  output_state_assert_rpf_interface_sg(list<PimMreAction> action_list);
00302     list<PimMreAction>  output_state_assert_rpf_interface_wc(list<PimMreAction> action_list);
00303     list<PimMreAction>  output_state_assert_receive_join_sg(list<PimMreAction> action_list);
00304     list<PimMreAction>  output_state_assert_receive_join_wc(list<PimMreAction> action_list);
00305     list<PimMreAction>  output_state_assert_winner_nbr_sg_gen_id(list<PimMreAction> action_list);
00306     list<PimMreAction>  output_state_assert_winner_nbr_wc_gen_id(list<PimMreAction> action_list);
00307     list<PimMreAction>  output_state_assert_winner_nbr_sg_nlt(list<PimMreAction> action_list);
00308     list<PimMreAction>  output_state_assert_winner_nbr_wc_nlt(list<PimMreAction> action_list);
00309     list<PimMreAction>  output_state_receive_join_wc_by_sg_rpt(list<PimMreAction> action_list);
00310     list<PimMreAction>  output_state_receive_end_of_message_sg_rpt(list<PimMreAction> action_list);
00311     list<PimMreAction>  output_state_sg_see_prune_wc(list<PimMreAction> action_list);
00312     list<PimMreAction>  output_state_rpfp_nbr_wc_assert(list<PimMreAction> action_list);
00313     list<PimMreAction>  output_state_rpfp_nbr_wc_not_assert(list<PimMreAction> action_list);
00314     list<PimMreAction>  output_state_rpfp_nbr_wc_gen_id(list<PimMreAction> action_list);
00315     list<PimMreAction>  output_state_rpfp_nbr_sg_assert(list<PimMreAction> action_list);
00316     list<PimMreAction>  output_state_rpfp_nbr_sg_not_assert(list<PimMreAction> action_list);
00317     list<PimMreAction>  output_state_rpfp_nbr_sg_gen_id(list<PimMreAction> action_list);
00318     list<PimMreAction>  output_state_rpfp_nbr_sg_rpt(list<PimMreAction> action_list);
00319     list<PimMreAction>  output_state_rpfp_nbr_sg_rpt_sg(list<PimMreAction> action_list);
00320     list<PimMreAction>  output_state_nbr_mrib_next_hop_rp_rp(list<PimMreAction> action_list);
00321     list<PimMreAction>  output_state_nbr_mrib_next_hop_rp_wc(list<PimMreAction> action_list);
00322     list<PimMreAction>  output_state_nbr_mrib_next_hop_rp_gen_id(list<PimMreAction> action_list);
00323     list<PimMreAction>  output_state_nbr_mrib_next_hop_s(list<PimMreAction> action_list);
00324     list<PimMreAction>  output_state_out_start_vif_rp(list<PimMreAction> action_list);
00325     list<PimMreAction>  output_state_out_start_vif_wc(list<PimMreAction> action_list);
00326     list<PimMreAction>  output_state_out_start_vif_sg(list<PimMreAction> action_list);
00327     list<PimMreAction>  output_state_out_start_vif_sg_rpt(list<PimMreAction> action_list);
00328     list<PimMreAction>  output_state_out_stop_vif_rp(list<PimMreAction> action_list);
00329     list<PimMreAction>  output_state_out_stop_vif_wc(list<PimMreAction> action_list);
00330     list<PimMreAction>  output_state_out_stop_vif_sg(list<PimMreAction> action_list);
00331     list<PimMreAction>  output_state_out_stop_vif_sg_rpt(list<PimMreAction> action_list);
00332     list<PimMreAction>  output_state_out_add_pim_mre_rp_entry_rp(list<PimMreAction> action_list);
00333     list<PimMreAction>  output_state_out_add_pim_mre_rp_entry_wc(list<PimMreAction> action_list);
00334     list<PimMreAction>  output_state_out_add_pim_mre_rp_entry_sg(list<PimMreAction> action_list);
00335     list<PimMreAction>  output_state_out_add_pim_mre_rp_entry_sg_rpt(list<PimMreAction> action_list);
00336     list<PimMreAction>  output_state_out_add_pim_mre_wc_entry_wc(list<PimMreAction> action_list);
00337     list<PimMreAction>  output_state_out_add_pim_mre_wc_entry_sg(list<PimMreAction> action_list);
00338     list<PimMreAction>  output_state_out_add_pim_mre_wc_entry_sg_rpt(list<PimMreAction> action_list);
00339     list<PimMreAction>  output_state_out_add_pim_mre_sg_entry_sg(list<PimMreAction> action_list);
00340     list<PimMreAction>  output_state_out_add_pim_mre_sg_entry_sg_rpt(list<PimMreAction> action_list);
00341     list<PimMreAction>  output_state_out_add_pim_mre_sg_rpt_entry_sg(list<PimMreAction> action_list);
00342     list<PimMreAction>  output_state_out_add_pim_mre_sg_rpt_entry_sg_rpt(list<PimMreAction> action_list);
00343     list<PimMreAction>  output_state_out_remove_pim_mre_rp_entry_rp(list<PimMreAction> action_list);
00344     list<PimMreAction>  output_state_out_remove_pim_mre_rp_entry_wc(list<PimMreAction> action_list);
00345     list<PimMreAction>  output_state_out_remove_pim_mre_rp_entry_sg(list<PimMreAction> action_list);
00346     list<PimMreAction>  output_state_out_remove_pim_mre_rp_entry_sg_rpt(list<PimMreAction> action_list);
00347     list<PimMreAction>  output_state_out_remove_pim_mre_wc_entry_wc(list<PimMreAction> action_list);
00348     list<PimMreAction>  output_state_out_remove_pim_mre_wc_entry_sg(list<PimMreAction> action_list);
00349     list<PimMreAction>  output_state_out_remove_pim_mre_wc_entry_sg_rpt(list<PimMreAction> action_list);
00350     list<PimMreAction>  output_state_out_remove_pim_mre_sg_entry_sg(list<PimMreAction> action_list);
00351     list<PimMreAction>  output_state_out_remove_pim_mre_sg_entry_sg_rpt(list<PimMreAction> action_list);
00352     list<PimMreAction>  output_state_out_remove_pim_mre_sg_rpt_entry_sg(list<PimMreAction> action_list);
00353     list<PimMreAction>  output_state_out_remove_pim_mre_sg_rpt_entry_sg_rpt(list<PimMreAction> action_list);
00354     list<PimMreAction>  output_state_out_remove_pim_mfc_entry_mfc(list<PimMreAction> action_list);
00355     list<PimMreAction>  output_state_update_sptbit_mfc(list<PimMreAction> action_list);
00356     list<PimMreAction>  output_state_set_keepalive_timer_sg(list<PimMreAction> action_list);
00357     
00358     //
00359     // The output actions
00360     //
00361     const list<PimMreAction>& output_action_rp(input_state_t input_state) const {
00362     return (_output_action_rp[input_state]);
00363     }
00364     const list<PimMreAction>& output_action_wc(input_state_t input_state) const {
00365     return (_output_action_wc[input_state]);
00366     }
00367     const list<PimMreAction>& output_action_sg_sg_rpt(input_state_t input_state) const {
00368     return (_output_action_sg_sg_rpt[input_state]);
00369     }
00370     const list<PimMreAction>& output_action_mfc(input_state_t input_state) const {
00371     return (_output_action_mfc[input_state]);
00372     }
00373     
00374     //
00375     // The remove state methods
00376     //
00377     list<PimMreAction>  remove_state(list<PimMreAction> action_list);
00378     list<PimMreAction>  remove_state_rpfp_nbr_wc_not_assert_changed(list<PimMreAction> action_list);
00379     list<PimMreAction>  remove_state_rpfp_nbr_sg_not_assert_changed(list<PimMreAction> action_list);
00380     
00381     
00382 private:
00383     //
00384     // Methods related to actions
00385     // 
00386     int     add_action_list(input_state_t input_state,
00387                 list<PimMreAction> action_list);
00388     int     add_action(input_state_t input_state,
00389                const PimMreAction& action);
00390     bool    can_add_action_to_list(const list<PimMreAction>& action_list,
00391                        const PimMreAction& action) const;
00392     list<PimMreAction>  remove_action_from_list(list<PimMreAction> action_list,
00393                         PimMreAction keep_action,
00394                         PimMreAction remove_action);
00395     
00396     // The list of the (*,*,RP) actions
00397     list<PimMreAction>  _output_action_rp[INPUT_STATE_MAX];
00398     // The list of the (*,G) actions
00399     list<PimMreAction>  _output_action_wc[INPUT_STATE_MAX];
00400     // The list of the (S,G) and (S,G,rpt) actions (in order of appearance)
00401     list<PimMreAction>  _output_action_sg_sg_rpt[INPUT_STATE_MAX];
00402     // The list of the MFC actions
00403     list<PimMreAction>  _output_action_mfc[INPUT_STATE_MAX];
00404     // The list of all actions:
00405     // - The (*,*,RP) actions are first.
00406     // - The (*,G) actions follow the (*,*,RP) actions.
00407     // - The (S,G) and (S,G,rpt) actions (in order of appearance)
00408     //   follow the (*,G) actions.
00409     list<PimMreAction>  _output_action[INPUT_STATE_MAX];
00410     
00411     class ActionLists {
00412     public:
00413     void clear();
00414     void add_action_list(list<PimMreAction> action_list);
00415     list<PimMreAction> compute_action_list();
00416     
00417     private:
00418     PimMreAction    pop_next_action();
00419     bool        is_head_only_action(const PimMreAction& action) const;
00420     
00421     vector<list<PimMreAction> > _action_list_vector;
00422     };
00423     
00424     ActionLists     _action_lists[INPUT_STATE_MAX];
00425     
00426     //
00427     // The track state methods
00428     //
00429     // The RP entry
00430     void    track_state_rp(list<PimMreAction> action_list);
00431     void    track_state_rp_wc(list<PimMreAction> action_list);
00432     void    track_state_rp_sg(list<PimMreAction> action_list);
00433     void    track_state_rp_sg_rpt(list<PimMreAction> action_list);
00434     void    track_state_rp_mfc(list<PimMreAction> action_list);
00435     void    track_state_mrib_rp_rp(list<PimMreAction> action_list);
00436     void    track_state_mrib_rp_wc(list<PimMreAction> action_list);
00437     void    track_state_mrib_rp_sg(list<PimMreAction> action_list);
00438     void    track_state_mrib_rp_sg_rpt(list<PimMreAction> action_list);
00439     void    track_state_mrib_s_sg(list<PimMreAction> action_list);
00440     void    track_state_mrib_s_sg_rpt(list<PimMreAction> action_list);
00441     // MRIB info
00442     void    track_state_mrib_rp(list<PimMreAction> action_list);
00443     void    track_state_mrib_s(list<PimMreAction> action_list);
00444     void    track_state_rpf_interface_rp(list<PimMreAction> action_list);
00445     void    track_state_rpf_interface_s(list<PimMreAction> action_list);
00446     // RPF neighbor info
00447     void    track_state_nbr_mrib_next_hop_rp_rp(list<PimMreAction> action_list);
00448     void    track_state_nbr_mrib_next_hop_rp_wc(list<PimMreAction> action_list);
00449     void    track_state_nbr_mrib_next_hop_rp_gen_id(list<PimMreAction> action_list);
00450     void    track_state_nbr_mrib_next_hop_rp_g(list<PimMreAction> action_list);
00451     void    track_state_nbr_mrib_next_hop_s(list<PimMreAction> action_list);
00452     void    track_state_mrib_pref_metric_s(list<PimMreAction> action_list);
00453     void    track_state_mrib_pref_metric_rp(list<PimMreAction> action_list);
00454     // JOIN/PRUNE info
00455     void    track_state_receive_join_rp(list<PimMreAction> action_list);
00456     void    track_state_receive_join_wc(list<PimMreAction> action_list);
00457     void    track_state_receive_join_sg(list<PimMreAction> action_list);
00458     void    track_state_receive_join_sg_rpt(list<PimMreAction> action_list);
00459     void    track_state_receive_prune_rp(list<PimMreAction> action_list);
00460     void    track_state_receive_prune_wc(list<PimMreAction> action_list);
00461     void    track_state_receive_prune_sg(list<PimMreAction> action_list);
00462     void    track_state_receive_prune_sg_rpt(list<PimMreAction> action_list);
00463     void    track_state_receive_end_of_message_sg_rpt(list<PimMreAction> action_list);
00464     void    track_state_sg_see_prune_wc(list<PimMreAction> action_list);
00465     // J/P (downstream) state (per interface)
00466     void    track_state_downstream_jp_state_rp(list<PimMreAction> action_list);
00467     void    track_state_downstream_jp_state_wc(list<PimMreAction> action_list);
00468     void    track_state_downstream_jp_state_sg(list<PimMreAction> action_list);
00469     void    track_state_downstream_jp_state_sg_rpt(list<PimMreAction> action_list);
00470     // J/P (upstream) state
00471     void    track_state_upstream_jp_state_sg(list<PimMreAction> action_list);
00472     // Local receivers info
00473     void    track_state_local_receiver_include_wc(list<PimMreAction> action_list);
00474     void    track_state_local_receiver_include_sg(list<PimMreAction> action_list);
00475     void    track_state_local_receiver_exclude_sg(list<PimMreAction> action_list);
00476     void    track_state_assert_state_wc(list<PimMreAction> action_list);
00477     void    track_state_assert_state_sg(list<PimMreAction> action_list);
00478     // MISC. info
00479     void    track_state_i_am_dr(list<PimMreAction> action_list);
00480     void    track_state_my_ip_address(list<PimMreAction> action_list);
00481     void    track_state_my_ip_subnet_address(list<PimMreAction> action_list);
00482     void    track_state_monitoring_switch_to_spt_desired_mfc(list<PimMreAction> action_list);
00483     void    track_state_monitoring_switch_to_spt_desired_sg(list<PimMreAction> action_list);
00484     void    track_state_spt_switch_threshold_changed_mfc(list<PimMreAction> action_list);
00485     void    track_state_was_switch_to_spt_desired_sg(list<PimMreAction> action_list);
00486     // MISC. timers
00487     void    track_state_keepalive_timer_sg(list<PimMreAction> action_list);
00488     // J/P state recomputation
00489     void    track_state_immediate_olist_rp(list<PimMreAction> action_list);
00490     void    track_state_immediate_olist_wc(list<PimMreAction> action_list);
00491     void    track_state_immediate_olist_sg(list<PimMreAction> action_list);
00492     void    track_state_inherited_olist_sg_rpt(list<PimMreAction> action_list);
00493     void    track_state_inherited_olist_sg(list<PimMreAction> action_list);
00494     void    track_state_iif_olist_mfc(list<PimMreAction> action_list);
00495     void    track_state_pim_include_wc(list<PimMreAction> action_list);
00496     void    track_state_pim_include_sg(list<PimMreAction> action_list);
00497     void    track_state_pim_exclude_sg(list<PimMreAction> action_list);
00498     void    track_state_joins_rp(list<PimMreAction> action_list);
00499     void    track_state_joins_wc(list<PimMreAction> action_list);
00500     void    track_state_joins_sg(list<PimMreAction> action_list);
00501     void    track_state_prunes_sg_rpt(list<PimMreAction> action_list);
00502     void    track_state_rpfp_nbr_wc(list<PimMreAction> action_list);
00503     void    track_state_rpfp_nbr_wc_assert(list<PimMreAction> action_list);
00504     void    track_state_rpfp_nbr_wc_not_assert(list<PimMreAction> action_list);
00505     void    track_state_rpfp_nbr_wc_gen_id(list<PimMreAction> action_list);
00506     void    track_state_rpfp_nbr_sg(list<PimMreAction> action_list);
00507     void    track_state_rpfp_nbr_sg_assert(list<PimMreAction> action_list);
00508     void    track_state_rpfp_nbr_sg_not_assert(list<PimMreAction> action_list);
00509     void    track_state_rpfp_nbr_sg_gen_id(list<PimMreAction> action_list);
00510     void    track_state_rpfp_nbr_sg_rpt(list<PimMreAction> action_list);
00511     void    track_state_rpfp_nbr_sg_rpt_sg(list<PimMreAction> action_list);
00512     // Data
00513     void    track_state_sptbit_sg(list<PimMreAction> action_list);
00514     void    track_state_is_directly_connected_sg(list<PimMreAction> action_list);
00515     void    track_state_is_could_register_sg(list<PimMreAction> action_list);
00516     void    track_state_is_join_desired_rp(list<PimMreAction> action_list);
00517     void    track_state_is_join_desired_wc(list<PimMreAction> action_list);
00518     void    track_state_is_join_desired_sg(list<PimMreAction> action_list);
00519     void    track_state_is_prune_desired_sg_rpt(list<PimMreAction> action_list);
00520     void    track_state_is_prune_desired_sg_rpt_sg(list<PimMreAction> action_list);
00521     void    track_state_is_rpt_join_desired_g(list<PimMreAction> action_list);
00522     void    track_state_could_assert_sg(list<PimMreAction> action_list);
00523     void    track_state_assert_tracking_desired_sg(list<PimMreAction> action_list);
00524     void    track_state_could_assert_wc(list<PimMreAction> action_list);
00525     void    track_state_assert_tracking_desired_wc(list<PimMreAction> action_list);
00526     void    track_state_my_assert_metric_sg(list<PimMreAction> action_list);
00527     void    track_state_my_assert_metric_wc(list<PimMreAction> action_list);
00528     void    track_state_spt_assert_metric(list<PimMreAction> action_list);
00529     void    track_state_rpt_assert_metric(list<PimMreAction> action_list);
00530     void    track_state_lost_assert_sg_rpt(list<PimMreAction> action_list);
00531     void    track_state_lost_assert_sg(list<PimMreAction> action_list);
00532     void    track_state_lost_assert_wc(list<PimMreAction> action_list);
00533     void    track_state_assert_rpf_interface_sg(list<PimMreAction> action_list);
00534     void    track_state_assert_rpf_interface_wc(list<PimMreAction> action_list);
00535     void    track_state_assert_receive_join_sg(list<PimMreAction> action_list);
00536     void    track_state_assert_receive_join_wc(list<PimMreAction> action_list);
00537     void    track_state_assert_winner_nbr_sg_gen_id(list<PimMreAction> action_list);
00538     void    track_state_assert_winner_nbr_wc_gen_id(list<PimMreAction> action_list);
00539     void    track_state_assert_winner_nbr_sg_nlt(list<PimMreAction> action_list);
00540     void    track_state_assert_winner_nbr_wc_nlt(list<PimMreAction> action_list);
00541     void    track_state_receive_join_wc_by_sg_rpt(list<PimMreAction> action_list);
00542     void    track_state_i_am_assert_winner_sg(list<PimMreAction> action_list);
00543     void    track_state_i_am_assert_winner_wc(list<PimMreAction> action_list);
00544     void    track_state_i_am_assert_loser_sg(list<PimMreAction> action_list);
00545     void    track_state_i_am_assert_loser_wc(list<PimMreAction> action_list);
00546     void    track_state_assert_winner_sg(list<PimMreAction> action_list);
00547     void    track_state_assert_winner_wc(list<PimMreAction> action_list);
00548     void    track_state_assert_winner_metric_sg(list<PimMreAction> action_list);
00549     void    track_state_assert_winner_metric_wc(list<PimMreAction> action_list);
00550     void    track_state_assert_winner_metric_is_better_than_spt_assert_metric_sg(list<PimMreAction> action_list);
00551     // MISC. other stuff
00552     void    track_state_in_start_vif(list<PimMreAction> action_list);
00553     void    track_state_in_stop_vif(list<PimMreAction> action_list);
00554     void    track_state_out_start_vif_rp(list<PimMreAction> action_list);
00555     void    track_state_out_start_vif_wc(list<PimMreAction> action_list);
00556     void    track_state_out_start_vif_sg(list<PimMreAction> action_list);
00557     void    track_state_out_start_vif_sg_rpt(list<PimMreAction> action_list);
00558     void    track_state_out_stop_vif_rp(list<PimMreAction> action_list);
00559     void    track_state_out_stop_vif_wc(list<PimMreAction> action_list);
00560     void    track_state_out_stop_vif_sg(list<PimMreAction> action_list);
00561     void    track_state_out_stop_vif_sg_rpt(list<PimMreAction> action_list);
00562     void    track_state_in_add_pim_mre_rp(list<PimMreAction> action_list);
00563     void    track_state_in_add_pim_mre_wc(list<PimMreAction> action_list);
00564     void    track_state_in_add_pim_mre_sg(list<PimMreAction> action_list);
00565     void    track_state_in_add_pim_mre_sg_rpt(list<PimMreAction> action_list);
00566     void    track_state_in_remove_pim_mre_rp(list<PimMreAction> action_list);
00567     void    track_state_in_remove_pim_mre_wc(list<PimMreAction> action_list);
00568     void    track_state_in_remove_pim_mre_sg(list<PimMreAction> action_list);
00569     void    track_state_in_remove_pim_mre_sg_rpt(list<PimMreAction> action_list);
00570     void    track_state_in_remove_pim_mfc(list<PimMreAction> action_list);
00571     void    track_state_out_add_pim_mre_rp_entry_rp(list<PimMreAction> action_list);
00572     void    track_state_out_add_pim_mre_rp_entry_wc(list<PimMreAction> action_list);
00573     void    track_state_out_add_pim_mre_rp_entry_sg(list<PimMreAction> action_list);
00574     void    track_state_out_add_pim_mre_rp_entry_sg_rpt(list<PimMreAction> action_list);
00575     void    track_state_out_add_pim_mre_wc_entry_wc(list<PimMreAction> action_list);
00576     void    track_state_out_add_pim_mre_wc_entry_sg(list<PimMreAction> action_list);
00577     void    track_state_out_add_pim_mre_wc_entry_sg_rpt(list<PimMreAction> action_list);
00578     void    track_state_out_add_pim_mre_sg_entry_sg(list<PimMreAction> action_list);
00579     void    track_state_out_add_pim_mre_sg_entry_sg_rpt(list<PimMreAction> action_list);
00580     void    track_state_out_add_pim_mre_sg_rpt_entry_sg(list<PimMreAction> action_list);
00581     void    track_state_out_add_pim_mre_sg_rpt_entry_sg_rpt(list<PimMreAction> action_list);
00582     void    track_state_out_remove_pim_mre_rp_entry_rp(list<PimMreAction> action_list);
00583     void    track_state_out_remove_pim_mre_rp_entry_wc(list<PimMreAction> action_list);
00584     void    track_state_out_remove_pim_mre_rp_entry_sg(list<PimMreAction> action_list);
00585     void    track_state_out_remove_pim_mre_rp_entry_sg_rpt(list<PimMreAction> action_list);
00586     void    track_state_out_remove_pim_mre_wc_entry_wc(list<PimMreAction> action_list);
00587     void    track_state_out_remove_pim_mre_wc_entry_sg(list<PimMreAction> action_list);
00588     void    track_state_out_remove_pim_mre_wc_entry_sg_rpt(list<PimMreAction> action_list);
00589     void    track_state_out_remove_pim_mre_sg_entry_sg(list<PimMreAction> action_list);
00590     void    track_state_out_remove_pim_mre_sg_entry_sg_rpt(list<PimMreAction> action_list);
00591     void    track_state_out_remove_pim_mre_sg_rpt_entry_sg(list<PimMreAction> action_list);
00592     void    track_state_out_remove_pim_mre_sg_rpt_entry_sg_rpt(list<PimMreAction> action_list);
00593     void    track_state_out_remove_pim_mfc_entry_mfc(list<PimMreAction> action_list);
00594     void    track_state_update_sptbit_mfc(list<PimMreAction> action_list);
00595     void    track_state_set_keepalive_timer_sg(list<PimMreAction> action_list);
00596     
00597     // Private state
00598     PimMrt* _pim_mrt;       // The PIM MRT
00599 };
00600 
00601 // Class to keep state for taking actions
00602 class PimMreAction {
00603 public:
00604     // XXX: the @param entry type is one of the following:
00605     // PIM_MRE_SG, PIM_MRE_SG_RPT, PIM_MRE_WC, PIM_MRE_RP, PIM_MFC
00606     PimMreAction(PimMreTrackState::output_state_t output_state,
00607          uint32_t entry_type)
00608     : _output_state(output_state), _entry_type (entry_type) {}
00609     PimMreAction(const PimMreAction& action)
00610     : _output_state(action.output_state()),
00611       _entry_type(action.entry_type()) {}
00612 #ifdef XORP_USE_USTL
00613     PimMreAction() { }
00614 #endif
00615     PimMreTrackState::output_state_t output_state() const {
00616     return (_output_state);
00617     }
00618     bool is_sg() const { return (_entry_type & PIM_MRE_SG); }
00619     bool is_sg_rpt() const { return (_entry_type & PIM_MRE_SG_RPT); }
00620     bool is_wc() const { return (_entry_type & PIM_MRE_WC); }
00621     bool is_rp() const { return (_entry_type & PIM_MRE_RP); }
00622     bool is_mfc() const { return (_entry_type & PIM_MFC); }
00623     uint32_t entry_type() const { return (_entry_type); }
00624     
00625     bool operator==(const PimMreAction& action) const {
00626     return ((output_state() == action.output_state())
00627         && (entry_type() == action.entry_type()));
00628     }
00629     
00630     void perform_action(PimMre& pim_mre, uint32_t vif_index,
00631             const IPvX& addr_arg);
00632     void perform_action(PimMfc& pim_mfc);
00633     
00634     
00635 private:
00636     PimMreTrackState::output_state_t    _output_state;
00637     uint32_t    _entry_type;
00638 };
00639 
00640 
00641 #endif // __PIM_PIM_MRE_TRACK_STATE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations