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_NEIGHBOR_H
24#define PIM_NEIGHBOR_H
25
26#include <zebra.h>
27
28#include "if.h"
29#include "linklist.h"
30
31#include "pim_tlv.h"
32
33struct pim_neighbor {
34  int64_t            creation; /* timestamp of creation */
35  struct in_addr     source_addr;
36  pim_hello_options  hello_options;
37  uint16_t           holdtime;
38  uint16_t           propagation_delay_msec;
39  uint16_t           override_interval_msec;
40  uint32_t           dr_priority;
41  uint32_t           generation_id;
42  struct list       *prefix_list; /* list of struct prefix */
43  struct thread     *t_expire_timer;
44  struct interface  *interface;
45};
46
47void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime);
48void pim_neighbor_free(struct pim_neighbor *neigh);
49struct pim_neighbor *pim_neighbor_find(struct interface *ifp,
50				       struct in_addr source_addr);
51struct pim_neighbor *pim_neighbor_add(struct interface *ifp,
52				      struct in_addr source_addr,
53				      pim_hello_options hello_options,
54				      uint16_t holdtime,
55				      uint16_t propagation_delay,
56				      uint16_t override_interval,
57				      uint32_t dr_priority,
58				      uint32_t generation_id,
59				      struct list *addr_list);
60void pim_neighbor_delete(struct interface *ifp,
61			 struct pim_neighbor *neigh,
62			 const char *delete_message);
63void pim_neighbor_delete_all(struct interface *ifp,
64			     const char *delete_message);
65void pim_neighbor_update(struct pim_neighbor *neigh,
66			 pim_hello_options hello_options,
67			 uint16_t holdtime,
68			 uint32_t dr_priority,
69			 struct list *addr_list);
70struct prefix *pim_neighbor_find_secondary(struct pim_neighbor *neigh,
71					   struct in_addr addr);
72void pim_if_dr_election(struct interface *ifp);
73
74#endif /* PIM_NEIGHBOR_H */
75