]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_neighbor.h
bgpd: move non-best local path checks outside the function
[mirror_frr.git] / ospfd / ospf_neighbor.h
CommitLineData
718e3744 1/*
2 * OSPF Neighbor functions.
3 * Copyright (C) 1999, 2000 Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
896014f4 6 *
718e3744 7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
896014f4
DL
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
718e3744 20 */
21
22#ifndef _ZEBRA_OSPF_NEIGHBOR_H
23#define _ZEBRA_OSPF_NEIGHBOR_H
24
d3f0d621 25#include <ospfd/ospf_packet.h>
26
718e3744 27/* Neighbor Data Structure */
d62a17ae 28struct ospf_neighbor {
29 /* This neighbor's parent ospf interface. */
30 struct ospf_interface *oi;
31
32 /* OSPF neighbor Information */
d7c0a89a
QY
33 uint8_t state; /* NSM status. */
34 uint8_t dd_flags; /* DD bit flags. */
35 uint32_t dd_seqnum; /* DD Sequence Number. */
d62a17ae 36
37 /* Neighbor Information from Hello. */
38 struct prefix address; /* Neighbor Interface Address. */
39
40 struct in_addr src; /* Src address. */
41 struct in_addr router_id; /* Router ID. */
d7c0a89a 42 uint8_t options; /* Options. */
d62a17ae 43 int priority; /* Router Priority. */
44 struct in_addr d_router; /* Designated Router. */
45 struct in_addr bd_router; /* Backup Designated Router. */
46
47 /* Last sent Database Description packet. */
48 struct ospf_packet *last_send;
49 /* Timestemp when last Database Description packet was sent */
50 struct timeval last_send_ts;
51
52 /* Last received Databse Description packet. */
53 struct {
d7c0a89a
QY
54 uint8_t options;
55 uint8_t flags;
56 uint32_t dd_seqnum;
d62a17ae 57 } last_recv;
58
59 /* LSA data. */
60 struct ospf_lsdb ls_rxmt;
61 struct ospf_lsdb db_sum;
62 struct ospf_lsdb ls_req;
63 struct ospf_lsa *ls_req_last;
64
d7c0a89a 65 uint32_t crypt_seqnum; /* Cryptographic Sequence Number. */
d62a17ae 66
67 /* Timer values. */
d7c0a89a
QY
68 uint32_t v_inactivity;
69 uint32_t v_db_desc;
70 uint32_t v_ls_req;
71 uint32_t v_ls_upd;
d62a17ae 72
73 /* Threads. */
74 struct thread *t_inactivity;
75 struct thread *t_db_desc;
76 struct thread *t_ls_req;
77 struct thread *t_ls_upd;
78 struct thread *t_hello_reply;
79
80 /* NBMA configured neighbour */
81 struct ospf_nbr_nbma *nbr_nbma;
82
83 /* Statistics */
84 struct timeval ts_last_progress; /* last advance of NSM */
85 struct timeval ts_last_regress; /* last regressive NSM change */
86 const char *last_regress_str; /* Event which last regressed NSM */
d7c0a89a 87 uint32_t state_change; /* NSM state change counter */
d62a17ae 88
89 /* BFD information */
90 void *bfd_info;
718e3744 91};
92
93/* Macros. */
94#define NBR_IS_DR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->d_router)
95#define NBR_IS_BDR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->bd_router)
96
97/* Prototypes. */
d62a17ae 98extern struct ospf_neighbor *ospf_nbr_new(struct ospf_interface *);
99extern void ospf_nbr_free(struct ospf_neighbor *);
100extern void ospf_nbr_delete(struct ospf_neighbor *);
101extern int ospf_nbr_bidirectional(struct in_addr *, struct in_addr *, int);
102extern void ospf_nbr_self_reset(struct ospf_interface *, struct in_addr);
103extern void ospf_nbr_add_self(struct ospf_interface *, struct in_addr);
104extern int ospf_nbr_count(struct ospf_interface *, int);
105extern int ospf_nbr_count_opaque_capable(struct ospf_interface *);
106extern struct ospf_neighbor *ospf_nbr_get(struct ospf_interface *,
107 struct ospf_header *, struct ip *,
108 struct prefix *);
109extern struct ospf_neighbor *ospf_nbr_lookup(struct ospf_interface *,
110 struct ip *, struct ospf_header *);
111extern struct ospf_neighbor *ospf_nbr_lookup_by_addr(struct route_table *,
112 struct in_addr *);
113extern struct ospf_neighbor *ospf_nbr_lookup_by_routerid(struct route_table *,
114 struct in_addr *);
115extern void ospf_renegotiate_optional_capabilities(struct ospf *top);
718e3744 116
117#endif /* _ZEBRA_OSPF_NEIGHBOR_H */