1
1
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
2
2
// vim:set sts=4 ts=8:
4
// Copyright (c) 2001-2007 International Computer Science Institute
4
// Copyright (c) 2001-2008 International Computer Science Institute
6
6
// Permission is hereby granted, free of charge, to any person obtaining a
7
7
// copy of this software and associated documentation files (the "Software")
13
13
// notice is a summary of the XORP LICENSE file; the license in that file is
14
14
// legally binding.
16
// $XORP: xorp/ospf/external.hh,v 1.19 2007/08/22 01:36:16 atanu Exp $
16
// $XORP: xorp/ospf/external.hh,v 1.22 2008/01/04 03:16:55 pavlin Exp $
18
18
#ifndef __OSPF_EXTERNAL_HH__
19
19
#define __OSPF_EXTERNAL_HH__
21
#include <libxorp/trie.hh>
22
* Storage for AS-External-LSAs with efficient access.
24
* Storage for AS-external-LSAs with efficient access.
24
26
class ASExternalDatabase {
40
42
iterator end() { return _lsas.end(); }
41
43
void erase(iterator i) { _lsas.erase(i); }
42
44
void insert(Lsa::LsaRef lsar) { _lsas.insert(lsar); }
43
void clear() { _lsas.clear(); }
45
47
iterator find(Lsa::LsaRef lsar);
48
set <Lsa::LsaRef, compare> _lsas; // Stored AS-External-LSAs.
50
set <Lsa::LsaRef, compare> _lsas; // Stored AS-external-LSAs.
52
* Handle AS-External-LSAs.
54
* Handle AS-external-LSAs.
54
56
template <typename A>
61
63
* future replay into other areas. Also arrange for the MaxAge
62
64
* timer to start running.
64
* @param area the AS-External-LSA came from.
66
* @param area the AS-external-LSA came from.
66
68
* @return true if this LSA should be propogated to other areas.
89
91
bool withdraw(const IPNet<A>& net);
92
* Clear the AS-External-LSA database.
94
* Clear the AS-external-LSA database.
94
96
bool clear_database();
99
* Suppress or remove AS-external-LSAs that are originated by
100
* this router that should yield to externally generated
101
* AS-external-LSAs as described in RFC 2328 Section 12.4.4. By
102
* time this method is called the routing table should have been
103
* updated so it should be clear if the other router is reachable.
105
void suppress_lsas(OspfTypes::AreaID area);
108
* A route has just been added to the routing table.
110
void suppress_route_announce(OspfTypes::AreaID area, IPNet<A> net,
114
* A route has just been withdrawn from the routing table.
116
void suppress_route_withdraw(OspfTypes::AreaID area, IPNet<A> net,
97
120
* Is this an AS boundary router?
99
122
bool as_boundary_router_p() const {
109
132
Ospf<A>& _ospf; // Reference to the controlling class.
110
133
map<OspfTypes::AreaID, AreaRouter<A> *>& _areas; // All the areas
112
ASExternalDatabase _lsas; // Stored AS-External-LSAs.
113
uint32_t _originating; // Number of AS-External-LSAs
135
ASExternalDatabase _lsas; // Stored AS-external-LSAs.
136
uint32_t _originating; // Number of AS-external-LSAs
114
137
// that are currently being originated.
115
138
uint32_t _lsid; // OSPFv3 only next Link State ID.
116
139
map<IPNet<IPv6>, uint32_t> _lsmap; // OSPFv3 only
140
list<Lsa::LsaRef> _suppress_temp; // LSAs that could possibly
141
// suppress self originated LSAs
143
Trie<A, Lsa::LsaRef> _suppress_db; // Database of suppressed self
164
193
void set_net_nexthop_lsid(ASExternalLsa *aselsa, IPNet<A> net, A nexthop);
197
* Send this self originated LSA out.
199
void announce_lsa(Lsa::LsaRef lsar);
202
* Pass this outbound AS-external-LSA through the policy filter.
204
bool do_filtering(IPNet<A>& network, A& nexthop, uint32_t& metric,
205
bool& e_bit, uint32_t& tag, bool& tag_set,
206
const PolicyTags& policytags);
167
209
* Start the refresh timer.
174
216
void refresh(Lsa::LsaRef lsar);
177
* Pass this outbound AS-External-LSA through the policy filter.
179
bool do_filtering(IPNet<A>& network, A& nexthop, uint32_t& metric,
180
bool& e_bit, uint32_t& tag, bool& tag_set,
181
const PolicyTags& policytags);
219
* Clone a self orignated LSA that is about to be removed for
220
* possible later introduction.
222
Lsa::LsaRef clone_lsa(Lsa::LsaRef lsar);
225
* Is this a self originated AS-external-LSA a candidate for suppression?
227
bool suppress_candidate(Lsa::LsaRef lsar, IPNet<A> net, A nexthop,
232
* Store a self originated AS-external-LSA that has been
233
* suppressed for possible future revival.
235
void suppress_database_add(Lsa::LsaRef lsar, const IPNet<A>& net);
238
* Delete a self originated AS-external-LSA that is no longer
239
* being redistributed.
241
void suppress_database_delete(const IPNet<A>& net, bool invalidate);
245
* Should this AS-external-LSA cause a self originated LSA to be
248
void suppress_self(Lsa::LsaRef lsar);
251
* Should this AS-external-LSA cause a self originated LSA to be
254
bool suppress_self_check(Lsa::LsaRef lsar);
257
* Find a self originated AS-external-LSA by network.
259
Lsa::LsaRef find_lsa_by_net(IPNet<A> net);
262
* This LSA if its advertising router is reachable matches a self
263
* origniated LSA that will be suppressed. Store until the routing
264
* computation has completed and the routing table can be checked.
266
void suppress_queue_lsa(Lsa::LsaRef lsar);
269
* An AS-external-LSA has reached MaxAge and is being withdrawn.
270
* check to see if it was suppressing a self originated LSA.
272
void suppress_maxage(Lsa::LsaRef lsar);
275
* If this is an AS-external-LSA that is suppressing a self
276
* originated route, then release it.
278
void suppress_release_lsa(Lsa::LsaRef lsar);
184
281
#endif // __OSPF_EXTERNAL_HH__