]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_route.h
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / ospfd / ospf_route.h
CommitLineData
718e3744 1/*
2 * OSPF routing table.
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 it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * 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_ROUTE_H
23#define _ZEBRA_OSPF_ROUTE_H
24
25#define OSPF_DESTINATION_ROUTER 1
26#define OSPF_DESTINATION_NETWORK 2
27#define OSPF_DESTINATION_DISCARD 3
28
29#define OSPF_PATH_MIN 0
30#define OSPF_PATH_INTRA_AREA 1
31#define OSPF_PATH_INTER_AREA 2
32#define OSPF_PATH_TYPE1_EXTERNAL 3
33#define OSPF_PATH_TYPE2_EXTERNAL 4
34#define OSPF_PATH_MAX 5
35
36/* OSPF Path. */
37struct ospf_path
38{
39 struct in_addr nexthop;
40 struct in_addr adv_router;
b892f1dd 41 ifindex_t ifindex;
525c1839 42 unsigned char unnumbered;
718e3744 43};
44
45/* Below is the structure linked to every
46 route node. Note that for Network routing
47 entries a single ospf_route is kept, while
48 for ABRs and ASBRs (Router routing entries),
49 we link an instance of ospf_router_route
50 where a list of paths is maintained, so
51
52 nr->info is a (struct ospf_route *) for OSPF_DESTINATION_NETWORK
53 but
54 nr->info is a (struct ospf_router_route *) for OSPF_DESTINATION_ROUTER
55*/
56
57struct route_standard
58{
59 /* Link Sate Origin. */
60 struct lsa_header *origin;
61
62 /* Associated Area. */
63 struct in_addr area_id; /* The area the route belongs to */
64
718e3744 65 /* Area Type */
66 int external_routing;
718e3744 67
68 /* Optional Capability. */
69 u_char options; /* Get from LSA header. */
70
71 /* */
72 u_char flags; /* From router-LSA */
73};
74
75struct route_external
76{
77 /* Link State Origin. */
78 struct ospf_lsa *origin;
79
80 /* Link State Cost Type2. */
81 u_int32_t type2_cost;
82
83 /* Tag value. */
84 u_int32_t tag;
85
86 /* ASBR route. */
87 struct ospf_route *asbr;
88};
89
90struct ospf_route
91{
718e3744 92 /* Destination Type. */
93 u_char type;
94
95 /* Destination ID. */ /* i.e. Link State ID. */
96 struct in_addr id;
97
98 /* Address Mask. */
99 struct in_addr mask; /* Only valid for networks. */
100
101 /* Path Type. */
102 u_char path_type;
103
104 /* List of Paths. */
52dc7ee6 105 struct list *paths;
718e3744 106
107 /* Link State Cost. */
108 u_int32_t cost; /* i.e. metric. */
109
110 /* Route specific info. */
111 union
112 {
113 struct route_standard std;
114 struct route_external ext;
115 } u;
116};
117
4dadc291 118extern struct ospf_path *ospf_path_new (void);
119extern void ospf_path_free (struct ospf_path *);
120extern struct ospf_path *ospf_path_lookup (struct list *, struct ospf_path *);
121extern struct ospf_route *ospf_route_new (void);
122extern void ospf_route_free (struct ospf_route *);
123extern void ospf_route_delete (struct route_table *);
124extern void ospf_route_table_free (struct route_table *);
125
126extern void ospf_route_install (struct ospf *, struct route_table *);
127extern void ospf_route_table_dump (struct route_table *);
128
129extern void ospf_intra_add_router (struct route_table *, struct vertex *,
130 struct ospf_area *);
131
132extern void ospf_intra_add_transit (struct route_table *, struct vertex *,
133 struct ospf_area *);
134
135extern void ospf_intra_add_stub (struct route_table *,
136 struct router_lsa_link *, struct vertex *,
b3bc68e5 137 struct ospf_area *,
57c639f0 138 int parent_is_root, int);
4dadc291 139
140extern int ospf_route_cmp (struct ospf *, struct ospf_route *,
718e3744 141 struct ospf_route *);
4dadc291 142extern void ospf_route_copy_nexthops (struct ospf_route *, struct list *);
143extern void ospf_route_copy_nexthops_from_vertex (struct ospf_route *,
144 struct vertex *);
145
146extern void ospf_route_subst (struct route_node *, struct ospf_route *,
147 struct ospf_route *);
148extern void ospf_route_add (struct route_table *, struct prefix_ipv4 *,
149 struct ospf_route *, struct ospf_route *);
150
151extern void ospf_route_subst_nexthops (struct ospf_route *, struct list *);
152extern void ospf_prune_unreachable_networks (struct route_table *);
153extern void ospf_prune_unreachable_routers (struct route_table *);
154extern int ospf_add_discard_route (struct route_table *, struct ospf_area *,
155 struct prefix_ipv4 *);
8fc9e007 156extern void ospf_delete_discard_route (struct route_table *, struct prefix_ipv4 *);
4dadc291 157extern int ospf_route_match_same (struct route_table *, struct prefix_ipv4 *,
158 struct ospf_route *);
718e3744 159
160#endif /* _ZEBRA_OSPF_ROUTE_H */