blob: f7b18742fb60e996d8cf9b5190b8b2775c630816 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
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
18 * along with GNU Zebra; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23#ifndef _ZEBRA_OSPF_NEIGHBOR_H
24#define _ZEBRA_OSPF_NEIGHBOR_H
25
26/* Neighbor Data Structure */
27struct ospf_neighbor
28{
29 /* This neighbor's parent ospf interface. */
30 struct ospf_interface *oi;
31
32 /* OSPF neighbor Information */
33 u_char state; /* NSM status. */
34 u_char dd_flags; /* DD bit flags. */
35 u_int32_t dd_seqnum; /* DD Sequence Number. */
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. */
42 u_char options; /* Options. */
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
54 {
55 u_char options;
56 u_char flags;
57 u_int32_t dd_seqnum;
58 } last_recv;
59
60 /* LSA data. */
61 struct ospf_lsdb ls_rxmt;
62 struct ospf_lsdb db_sum;
63 struct ospf_lsdb ls_req;
64 struct ospf_lsa *ls_req_last;
65
66 u_int32_t crypt_seqnum; /* Cryptographic Sequence Number. */
67
68 /* Timer values. */
69 u_int32_t v_inactivity;
70 u_int32_t v_db_desc;
71 u_int32_t v_ls_req;
72 u_int32_t v_ls_upd;
73
74 /* Threads. */
75 struct thread *t_inactivity;
76 struct thread *t_db_desc;
77 struct thread *t_ls_req;
78 struct thread *t_ls_upd;
79 struct thread *t_hello_reply;
80
81 /* Statistics Field */
82 u_int32_t state_change;
83 struct ospf_nbr_nbma *nbr_nbma;
84};
85
86/* Macros. */
87#define NBR_IS_DR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->d_router)
88#define NBR_IS_BDR(n) IPV4_ADDR_SAME (&n->address.u.prefix4, &n->bd_router)
89
90/* Prototypes. */
91struct ospf_neighbor *ospf_nbr_new (struct ospf_interface *);
92void ospf_nbr_free (struct ospf_neighbor *);
93void ospf_nbr_delete (struct ospf_neighbor *);
94int ospf_nbr_bidirectional (struct in_addr *, struct in_addr *, int);
95void ospf_nbr_add_self (struct ospf_interface *);
96int ospf_nbr_count (struct route_table *, int);
97#ifdef HAVE_OPAQUE_LSA
98int ospf_opaque_capable_nbr_count (struct route_table *nbrs, int status);
99#endif /* HAVE_OPAQUE_LSA */
100struct ospf_neighbor *ospf_nbr_lookup_by_addr (struct route_table *,
101 struct in_addr *);
102struct ospf_neighbor *ospf_nbr_lookup_by_routerid (struct route_table *,
103 struct in_addr *);
104void ospf_renegotiate_optional_capabilities (struct ospf *top);
105
106#endif /* _ZEBRA_OSPF_NEIGHBOR_H */