Annotation of embedaddon/quagga/pimd/pim_upstream.h, revision 1.1.1.1

1.1       misho       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
                     16:   along with this program; see the file COPYING; if not, write to the
                     17:   Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
                     18:   MA 02110-1301 USA
                     19:   
                     20:   $QuaggaId: $Format:%an, %ai, %h$ $
                     21: */
                     22: 
                     23: #ifndef PIM_UPSTREAM_H
                     24: #define PIM_UPSTREAM_H
                     25: 
                     26: #include <zebra.h>
                     27: 
                     28: #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED         (1 << 0)
                     29: #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED (2 << 0)
                     30: 
                     31: #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
                     32: #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED_UPDATED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
                     33: 
                     34: #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
                     35: #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED_UPDATED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
                     36: 
                     37: #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
                     38: #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED_UPDATED(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
                     39: 
                     40: /*
                     41:   RFC 4601:
                     42: 
                     43:   Metric Preference
                     44:     Preference value assigned to the unicast routing protocol that
                     45:     provided the route to the multicast source or Rendezvous-Point.
                     46: 
                     47:   Metric
                     48:     The unicast routing table metric associated with the route used to
                     49:     reach the multicast source or Rendezvous-Point.  The metric is in
                     50:     units applicable to the unicast routing protocol used.
                     51: */
                     52: struct pim_nexthop {
                     53:   struct interface *interface;              /* RPF_interface(S) */
                     54:   struct in_addr    mrib_nexthop_addr;      /* MRIB.next_hop(S) */
                     55:   uint32_t          mrib_metric_preference; /* MRIB.pref(S) */
                     56:   uint32_t          mrib_route_metric;      /* MRIB.metric(S) */
                     57: };
                     58: 
                     59: struct pim_rpf {
                     60:   struct pim_nexthop source_nexthop;
                     61:   struct in_addr     rpf_addr;               /* RPF'(S,G) */
                     62: };
                     63: 
                     64: enum pim_rpf_result {
                     65:   PIM_RPF_OK = 0,
                     66:   PIM_RPF_CHANGED,
                     67:   PIM_RPF_FAILURE
                     68: };
                     69: 
                     70: enum pim_upstream_state {
                     71:   PIM_UPSTREAM_NOTJOINED,
                     72:   PIM_UPSTREAM_JOINED
                     73: };
                     74: 
                     75: /*
                     76:   Upstream (S,G) channel in Joined state
                     77:   
                     78:   (S,G) in the "Not Joined" state is not represented
                     79:   
                     80:   See RFC 4601: 4.5.7.  Sending (S,G) Join/Prune Message
                     81: */
                     82: struct pim_upstream {
                     83:   struct in_addr           source_addr;  /* (S,G) source key */
                     84:   struct in_addr           group_addr;   /* (S,G) group key */
                     85:   uint32_t                 flags;
                     86:   struct channel_oil      *channel_oil;
                     87: 
                     88:   enum pim_upstream_state  join_state;
                     89:   int                      ref_count;
                     90: 
                     91:   struct pim_rpf           rpf;
                     92: 
                     93:   struct thread           *t_join_timer;
                     94:   int64_t                  state_transition; /* Record current state uptime */
                     95: };
                     96: 
                     97: void pim_upstream_free(struct pim_upstream *up);
                     98: void pim_upstream_delete(struct pim_upstream *up);
                     99: struct pim_upstream *pim_upstream_find(struct in_addr source_addr,
                    100:                                       struct in_addr group_addr);
                    101: struct pim_upstream *pim_upstream_add(struct in_addr source_addr,
                    102:                                      struct in_addr group_addr);
                    103: void pim_upstream_del(struct pim_upstream *up);
                    104: 
                    105: int pim_upstream_evaluate_join_desired(struct pim_upstream *up);
                    106: void pim_upstream_update_join_desired(struct pim_upstream *up);
                    107: 
                    108: void pim_upstream_join_suppress(struct pim_upstream *up,
                    109:                                struct in_addr rpf_addr,
                    110:                                int holdtime);
                    111: void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
                    112:                                                    struct pim_upstream *up,
                    113:                                                    struct in_addr rpf_addr);
                    114: void pim_upstream_join_timer_restart(struct pim_upstream *up);
                    115: void pim_upstream_rpf_genid_changed(struct in_addr neigh_addr);
                    116: void pim_upstream_rpf_interface_changed(struct pim_upstream *up,
                    117:                                        struct interface *old_rpf_ifp);
                    118: 
                    119: void pim_upstream_update_could_assert(struct pim_upstream *up);
                    120: void pim_upstream_update_my_assert_metric(struct pim_upstream *up);
                    121: 
                    122: #endif /* PIM_UPSTREAM_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>