back to topotato report
topotato coverage report
Current view: top level - pimd - pim_ifchannel.h (source / functions) Hit Total Coverage
Test: test_pim_basic2.py::PIMTopo2Test Lines: 1 1 100.0 %
Date: 2023-02-24 18:39:36 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * PIM for Quagga
       3             :  * Copyright (C) 2008  Everton da Silva Marques
       4             :  *
       5             :  * This program is free software; you can redistribute it and/or modify
       6             :  * it under the terms of the GNU General Public License as published by
       7             :  * the Free Software Foundation; either version 2 of the License, or
       8             :  * (at your option) any later version.
       9             :  *
      10             :  * This program is distributed in the hope that it will be useful, but
      11             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :  * General Public License for more details.
      14             :  *
      15             :  * You should have received a copy of the GNU General Public License along
      16             :  * with this program; see the file COPYING; if not, write to the Free Software
      17             :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
      18             :  */
      19             : 
      20             : #ifndef PIM_IFCHANNEL_H
      21             : #define PIM_IFCHANNEL_H
      22             : 
      23             : #include <zebra.h>
      24             : 
      25             : #include "if.h"
      26             : #include "prefix.h"
      27             : 
      28             : #include "pim_assert.h"
      29             : 
      30             : struct pim_ifchannel;
      31             : #include "pim_upstream.h"
      32             : 
      33             : enum pim_ifmembership { PIM_IFMEMBERSHIP_NOINFO, PIM_IFMEMBERSHIP_INCLUDE };
      34             : 
      35             : enum pim_ifjoin_state {
      36             :         PIM_IFJOIN_NOINFO,
      37             :         PIM_IFJOIN_JOIN,
      38             :         PIM_IFJOIN_PRUNE,
      39             :         PIM_IFJOIN_PRUNE_PENDING,
      40             :         PIM_IFJOIN_PRUNE_TMP,
      41             :         PIM_IFJOIN_PRUNE_PENDING_TMP,
      42             : };
      43             : 
      44             : /*
      45             :   Flag to detect change in CouldAssert(S,G,I)
      46             : */
      47             : #define PIM_IF_FLAG_MASK_COULD_ASSERT (1 << 0)
      48             : #define PIM_IF_FLAG_TEST_COULD_ASSERT(flags) ((flags) & PIM_IF_FLAG_MASK_COULD_ASSERT)
      49             : #define PIM_IF_FLAG_SET_COULD_ASSERT(flags) ((flags) |= PIM_IF_FLAG_MASK_COULD_ASSERT)
      50             : #define PIM_IF_FLAG_UNSET_COULD_ASSERT(flags) ((flags) &= ~PIM_IF_FLAG_MASK_COULD_ASSERT)
      51             : /*
      52             :   Flag to detect change in AssertTrackingDesired(S,G,I)
      53             : */
      54             : #define PIM_IF_FLAG_MASK_ASSERT_TRACKING_DESIRED (1 << 1)
      55             : #define PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(flags) ((flags) & PIM_IF_FLAG_MASK_ASSERT_TRACKING_DESIRED)
      56             : #define PIM_IF_FLAG_SET_ASSERT_TRACKING_DESIRED(flags) ((flags) |= PIM_IF_FLAG_MASK_ASSERT_TRACKING_DESIRED)
      57             : #define PIM_IF_FLAG_UNSET_ASSERT_TRACKING_DESIRED(flags) ((flags) &= ~PIM_IF_FLAG_MASK_ASSERT_TRACKING_DESIRED)
      58             : 
      59             : /*
      60             :  * Flag to tell us if the ifchannel is (S,G,rpt)
      61             :  */
      62             : #define PIM_IF_FLAG_MASK_S_G_RPT         (1 << 2)
      63             : #define PIM_IF_FLAG_TEST_S_G_RPT(flags)  ((flags) & PIM_IF_FLAG_MASK_S_G_RPT)
      64             : #define PIM_IF_FLAG_SET_S_G_RPT(flags)   ((flags) |= PIM_IF_FLAG_MASK_S_G_RPT)
      65             : #define PIM_IF_FLAG_UNSET_S_G_RPT(flags) ((flags) &= ~PIM_IF_FLAG_MASK_S_G_RPT)
      66             : 
      67             : /*
      68             :  * Flag to tell us if the ifchannel is proto PIM
      69             :  */
      70             : #define PIM_IF_FLAG_MASK_PROTO_PIM (1 << 3)
      71             : #define PIM_IF_FLAG_TEST_PROTO_PIM(flags) ((flags)&PIM_IF_FLAG_MASK_PROTO_PIM)
      72             : #define PIM_IF_FLAG_SET_PROTO_PIM(flags) ((flags) |= PIM_IF_FLAG_MASK_PROTO_PIM)
      73             : #define PIM_IF_FLAG_UNSET_PROTO_PIM(flags)                                     \
      74             :         ((flags) &= ~PIM_IF_FLAG_MASK_PROTO_PIM)
      75             : /*
      76             :  * Flag to tell us if the ifchannel is proto IGMP
      77             :  */
      78             : #define PIM_IF_FLAG_MASK_PROTO_IGMP (1 << 4)
      79             : #define PIM_IF_FLAG_TEST_PROTO_IGMP(flags) ((flags)&PIM_IF_FLAG_MASK_PROTO_IGMP)
      80             : #define PIM_IF_FLAG_SET_PROTO_IGMP(flags)                                      \
      81             :         ((flags) |= PIM_IF_FLAG_MASK_PROTO_IGMP)
      82             : #define PIM_IF_FLAG_UNSET_PROTO_IGMP(flags)                                    \
      83             :         ((flags) &= ~PIM_IF_FLAG_MASK_PROTO_IGMP)
      84             : /*
      85             :   Per-interface (S,G) state
      86             : */
      87             : struct pim_ifchannel {
      88             :         RB_ENTRY(rb_ifchannel) pim_ifp_rb;
      89             : 
      90             :         struct pim_ifchannel *parent;
      91             :         struct list *sources;
      92             :         pim_sgaddr sg;
      93             :         char sg_str[PIM_SG_LEN];
      94             :         struct interface *interface; /* backpointer to interface */
      95             :         uint32_t flags;
      96             : 
      97             :         /* IGMPv3 determined interface has local members for (S,G) ? */
      98             :         enum pim_ifmembership local_ifmembership;
      99             : 
     100             :         /* Per-interface (S,G) Join/Prune State (Section 4.1.4 of RFC4601) */
     101             :         enum pim_ifjoin_state ifjoin_state;
     102             :         struct thread *t_ifjoin_expiry_timer;
     103             :         struct thread *t_ifjoin_prune_pending_timer;
     104             :         int64_t ifjoin_creation; /* Record uptime of ifjoin state */
     105             : 
     106             :         /* Per-interface (S,G) Assert State (Section 4.6.1 of RFC4601) */
     107             :         enum pim_ifassert_state ifassert_state;
     108             :         struct thread *t_ifassert_timer;
     109             :         pim_addr ifassert_winner;
     110             :         struct pim_assert_metric ifassert_winner_metric;
     111             :         int64_t ifassert_creation; /* Record uptime of ifassert state */
     112             :         struct pim_assert_metric ifassert_my_metric;
     113             : 
     114             :         /* Upstream (S,G) state */
     115             :         struct pim_upstream *upstream;
     116             : };
     117             : 
     118             : RB_HEAD(pim_ifchannel_rb, pim_ifchannel);
     119         521 : RB_PROTOTYPE(pim_ifchannel_rb, pim_ifchannel, pim_ifp_rb,
     120             :              pim_ifchannel_compare);
     121             : 
     122             : void pim_ifchannel_delete(struct pim_ifchannel *ch);
     123             : void pim_ifchannel_delete_all(struct interface *ifp);
     124             : void pim_ifchannel_membership_clear(struct interface *ifp);
     125             : void pim_ifchannel_delete_on_noinfo(struct interface *ifp);
     126             : struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp, pim_sgaddr *sg);
     127             : struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg,
     128             :                                         uint8_t ch_flags, int up_flags);
     129             : void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr,
     130             :                             pim_addr upstream, pim_sgaddr *sg,
     131             :                             uint8_t source_flags, uint16_t holdtime);
     132             : void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream,
     133             :                          pim_sgaddr *sg, uint8_t source_flags,
     134             :                          uint16_t holdtime);
     135             : int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg,
     136             :                                        bool is_vxlan);
     137             : void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg);
     138             : 
     139             : void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch,
     140             :                                  enum pim_ifjoin_state new_state);
     141             : const char *pim_ifchannel_ifjoin_name(enum pim_ifjoin_state ifjoin_state,
     142             :                                       int flags);
     143             : const char *pim_ifchannel_ifassert_name(enum pim_ifassert_state ifassert_state);
     144             : 
     145             : int pim_ifchannel_isin_oiflist(struct pim_ifchannel *ch);
     146             : 
     147             : void reset_ifassert_state(struct pim_ifchannel *ch);
     148             : 
     149             : void pim_ifchannel_update_could_assert(struct pim_ifchannel *ch);
     150             : void pim_ifchannel_update_my_assert_metric(struct pim_ifchannel *ch);
     151             : void pim_ifchannel_update_assert_tracking_desired(struct pim_ifchannel *ch);
     152             : 
     153             : void pim_ifchannel_scan_forward_start(struct interface *new_ifp);
     154             : void pim_ifchannel_set_star_g_join_state(struct pim_ifchannel *ch, int eom,
     155             :                                          uint8_t join);
     156             : 
     157             : int pim_ifchannel_compare(const struct pim_ifchannel *ch1,
     158             :                           const struct pim_ifchannel *ch2);
     159             : 
     160             : void delete_on_noinfo(struct pim_ifchannel *ch);
     161             : #endif /* PIM_IFCHANNEL_H */

Generated by: LCOV version v1.16-topotato