]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_neighbor.h
7bd5b1209d31bb1cf38280f440c6426690b45a76
[mirror_frr.git] / ospfd / ospf_neighbor.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * OSPF Neighbor functions.
4 * Copyright (C) 1999, 2000 Toshiaki Takada
5 */
6
7 #ifndef _ZEBRA_OSPF_NEIGHBOR_H
8 #define _ZEBRA_OSPF_NEIGHBOR_H
9
10 #include <ospfd/ospf_gr.h>
11 #include <ospfd/ospf_packet.h>
12
13 /* Neighbor Data Structure */
14 struct ospf_neighbor {
15 /* This neighbor's parent ospf interface. */
16 struct ospf_interface *oi;
17
18 /* OSPF neighbor Information */
19 uint8_t state; /* NSM status. */
20 uint8_t dd_flags; /* DD bit flags. */
21 uint32_t dd_seqnum; /* DD Sequence Number. */
22
23 /* Neighbor Information from Hello. */
24 struct prefix address; /* Neighbor Interface Address. */
25
26 struct in_addr src; /* Src address. */
27 struct in_addr router_id; /* Router ID. */
28 uint8_t options; /* Options. */
29 int priority; /* Router Priority. */
30 struct in_addr d_router; /* Designated Router. */
31 struct in_addr bd_router; /* Backup Designated Router. */
32
33 /* Last sent Database Description packet. */
34 struct ospf_packet *last_send;
35 /* Timestemp when last Database Description packet was sent */
36 struct timeval last_send_ts;
37
38 /* Last received Databse Description packet. */
39 struct {
40 uint8_t options;
41 uint8_t flags;
42 uint32_t dd_seqnum;
43 } last_recv;
44
45 /* LSA data. */
46 struct ospf_lsdb ls_rxmt;
47 struct ospf_lsdb db_sum;
48 struct ospf_lsdb ls_req;
49 struct ospf_lsa *ls_req_last;
50
51 uint32_t crypt_seqnum; /* Cryptographic Sequence Number. */
52
53 /* Timer values. */
54 uint32_t v_inactivity;
55 uint32_t v_db_desc;
56 uint32_t v_ls_req;
57 uint32_t v_ls_upd;
58
59 /* Threads. */
60 struct thread *t_inactivity;
61 struct thread *t_db_desc;
62 struct thread *t_ls_req;
63 struct thread *t_ls_upd;
64 struct thread *t_hello_reply;
65
66 /* NBMA configured neighbour */
67 struct ospf_nbr_nbma *nbr_nbma;
68
69 /* Statistics */
70 struct timeval ts_last_progress; /* last advance of NSM */
71 struct timeval ts_last_regress; /* last regressive NSM change */
72 const char *last_regress_str; /* Event which last regressed NSM */
73 uint32_t state_change; /* NSM state change counter */
74
75 /* BFD information */
76 struct bfd_session_params *bfd_session;
77
78 /* ospf graceful restart HELPER info */
79 struct ospf_helper_info gr_helper_info;
80 };
81
82 /* Macros. */
83 #define NBR_IS_DR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->d_router)
84 #define NBR_IS_BDR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->bd_router)
85
86 /* Prototypes. */
87 extern struct ospf_neighbor *ospf_nbr_new(struct ospf_interface *);
88 extern void ospf_nbr_free(struct ospf_neighbor *);
89 extern void ospf_nbr_delete(struct ospf_neighbor *);
90 extern int ospf_nbr_bidirectional(struct in_addr *, struct in_addr *, int);
91 extern void ospf_nbr_self_reset(struct ospf_interface *, struct in_addr);
92 extern void ospf_nbr_add_self(struct ospf_interface *, struct in_addr);
93 extern int ospf_nbr_count(struct ospf_interface *, int);
94 extern int ospf_nbr_count_opaque_capable(struct ospf_interface *);
95 extern struct ospf_neighbor *ospf_nbr_get(struct ospf_interface *,
96 struct ospf_header *, struct ip *,
97 struct prefix *);
98 extern struct ospf_neighbor *ospf_nbr_lookup(struct ospf_interface *,
99 struct ip *, struct ospf_header *);
100 extern struct ospf_neighbor *ospf_nbr_lookup_by_addr(struct route_table *,
101 struct in_addr *);
102 extern struct ospf_neighbor *ospf_nbr_lookup_by_routerid(struct route_table *,
103 struct in_addr *);
104 extern void ospf_renegotiate_optional_capabilities(struct ospf *top);
105 #endif /* _ZEBRA_OSPF_NEIGHBOR_H */