]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_neighbor.h
Merge pull request #538 from qlyoung/fix-stack-access-2
[mirror_frr.git] / ospfd / ospf_neighbor.h
1 /*
2 * OSPF Neighbor functions.
3 * Copyright (C) 1999, 2000 Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
6 *
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 *
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
20 */
21
22 #ifndef _ZEBRA_OSPF_NEIGHBOR_H
23 #define _ZEBRA_OSPF_NEIGHBOR_H
24
25 #include <ospfd/ospf_packet.h>
26
27 /* Neighbor Data Structure */
28 struct ospf_neighbor
29 {
30 /* This neighbor's parent ospf interface. */
31 struct ospf_interface *oi;
32
33 /* OSPF neighbor Information */
34 u_char state; /* NSM status. */
35 u_char dd_flags; /* DD bit flags. */
36 u_int32_t dd_seqnum; /* DD Sequence Number. */
37
38 /* Neighbor Information from Hello. */
39 struct prefix address; /* Neighbor Interface Address. */
40
41 struct in_addr src; /* Src address. */
42 struct in_addr router_id; /* Router ID. */
43 u_char options; /* Options. */
44 int priority; /* Router Priority. */
45 struct in_addr d_router; /* Designated Router. */
46 struct in_addr bd_router; /* Backup Designated Router. */
47
48 /* Last sent Database Description packet. */
49 struct ospf_packet *last_send;
50 /* Timestemp when last Database Description packet was sent */
51 struct timeval last_send_ts;
52
53 /* Last received Databse Description packet. */
54 struct
55 {
56 u_char options;
57 u_char flags;
58 u_int32_t dd_seqnum;
59 } last_recv;
60
61 /* LSA data. */
62 struct ospf_lsdb ls_rxmt;
63 struct ospf_lsdb db_sum;
64 struct ospf_lsdb ls_req;
65 struct ospf_lsa *ls_req_last;
66
67 u_int32_t crypt_seqnum; /* Cryptographic Sequence Number. */
68
69 /* Timer values. */
70 u_int32_t v_inactivity;
71 u_int32_t v_db_desc;
72 u_int32_t v_ls_req;
73 u_int32_t v_ls_upd;
74
75 /* Threads. */
76 struct thread *t_inactivity;
77 struct thread *t_db_desc;
78 struct thread *t_ls_req;
79 struct thread *t_ls_upd;
80 struct thread *t_hello_reply;
81
82 /* NBMA configured neighbour */
83 struct ospf_nbr_nbma *nbr_nbma;
84
85 /* Statistics */
86 struct timeval ts_last_progress; /* last advance of NSM */
87 struct timeval ts_last_regress; /* last regressive NSM change */
88 const char *last_regress_str; /* Event which last regressed NSM */
89 u_int32_t state_change; /* NSM state change counter */
90
91 /* BFD information */
92 void *bfd_info;
93 };
94
95 /* Macros. */
96 #define NBR_IS_DR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->d_router)
97 #define NBR_IS_BDR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->bd_router)
98
99 /* Prototypes. */
100 extern struct ospf_neighbor *ospf_nbr_new (struct ospf_interface *);
101 extern void ospf_nbr_free (struct ospf_neighbor *);
102 extern void ospf_nbr_delete (struct ospf_neighbor *);
103 extern int ospf_nbr_bidirectional (struct in_addr *, struct in_addr *, int);
104 extern void ospf_nbr_self_reset (struct ospf_interface *, struct in_addr);
105 extern void ospf_nbr_add_self (struct ospf_interface *, struct in_addr);
106 extern int ospf_nbr_count (struct ospf_interface *, int);
107 extern int ospf_nbr_count_opaque_capable (struct ospf_interface *);
108 extern struct ospf_neighbor *ospf_nbr_get (struct ospf_interface *,
109 struct ospf_header *,
110 struct ip *, struct prefix *);
111 extern struct ospf_neighbor *ospf_nbr_lookup (struct ospf_interface *,
112 struct ip *,
113 struct ospf_header *);
114 extern struct ospf_neighbor *ospf_nbr_lookup_by_addr (struct route_table *,
115 struct in_addr *);
116 extern struct ospf_neighbor *ospf_nbr_lookup_by_routerid (struct route_table
117 *,
118 struct in_addr *);
119 extern void ospf_renegotiate_optional_capabilities (struct ospf *top);
120
121 #endif /* _ZEBRA_OSPF_NEIGHBOR_H */