~ubuntu-branches/ubuntu/jaunty/xorp/jaunty

« back to all changes in this revision

Viewing changes to ospf/external.hh

  • Committer: Bazaar Package Importer
  • Author(s): Jose Calhariz, Javier Fernandez-Sanguino, Jose Calhariz
  • Date: 2008-01-23 01:24:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123012437-7l2u9r0k8e7op8st
Tags: 1.5~cvs.20080128-1
[ Javier Fernandez-Sanguino ]
* Update to latest CVS contents
* Modify debian/rules to prevent autobuilders from building 
  the binary-independent components: (Closes: #441121)
  - Create a new Build-Depends-Indep with all the TeX
  components used to build documentation
  - Since autobuilders call build, which in turns calls build-indep, hack
    the debian rules file so that the documentation is only built if ps2pdf,
    dvips and pslatex are available. 
* Modify the init.d script:
  - restart action: Do not attempt to stop xorp if not running
  - stop function: fix errors in the script
  - add a try-restart action
  - restructure the init.d script, move the restart code to a function
  - review the use of echo calls and exit values
* Use, as examples, the new boot files at rtrmgr/config/

[ Jose Calhariz ]
* Add depends on ncurses-dev, I don't know why xorp use tigetstr
  function from curses.  This way the depends field change less between
  build environments.
* Removed pushd and popd commands from Makefile and replaced with cd
  commands, was a bashism and FTBFS (closes: #453637)
* debian/control converted to utf-8 (closes: #454026) (closes: #453485)
* init.d/xorp now returns 0 if disabled.
* Added Vcs-Browser and Vcs-Svn fields pointing to the repository of the
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
2
2
// vim:set sts=4 ts=8:
3
3
 
4
 
// Copyright (c) 2001-2007 International Computer Science Institute
 
4
// Copyright (c) 2001-2008 International Computer Science Institute
5
5
//
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.
15
15
 
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 $
17
17
 
18
18
#ifndef __OSPF_EXTERNAL_HH__
19
19
#define __OSPF_EXTERNAL_HH__
20
20
 
 
21
#include <libxorp/trie.hh>
 
22
 
21
23
/**
22
 
 * Storage for AS-External-LSAs with efficient access.
 
24
 * Storage for AS-external-LSAs with efficient access.
23
25
 */
24
26
class ASExternalDatabase {
25
27
 public:
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
    void clear();
44
46
 
45
47
    iterator find(Lsa::LsaRef lsar);
46
48
 
47
49
 private:
48
 
    set <Lsa::LsaRef, compare> _lsas;           // Stored AS-External-LSAs.
 
50
    set <Lsa::LsaRef, compare> _lsas;           // Stored AS-external-LSAs.
49
51
};
50
52
 
51
53
/**
52
 
 * Handle AS-External-LSAs.
 
54
 * Handle AS-external-LSAs.
53
55
 */
54
56
template <typename A>
55
57
class External {
61
63
     * future replay into other areas. Also arrange for the MaxAge
62
64
     * timer to start running.
63
65
     *
64
 
     * @param area the AS-External-LSA came from.
 
66
     * @param area the AS-external-LSA came from.
65
67
     *
66
68
     * @return true if this LSA should be propogated to other areas.
67
69
     */
73
75
    bool announce_complete(OspfTypes::AreaID area);
74
76
 
75
77
    /**
76
 
     * Provide this area with the stored AS-External-LSAs.
 
78
     * Provide this area with the stored AS-external-LSAs.
77
79
     */
78
80
    void push(AreaRouter<A> *area_router);
79
81
 
89
91
    bool withdraw(const IPNet<A>& net);
90
92
 
91
93
    /**
92
 
     * Clear the AS-External-LSA database.
 
94
     * Clear the AS-external-LSA database.
93
95
     */
94
96
    bool clear_database();
95
97
 
96
98
    /**
 
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.
 
104
     */
 
105
    void suppress_lsas(OspfTypes::AreaID area);
 
106
 
 
107
    /**
 
108
     * A route has just been added to the routing table.
 
109
     */
 
110
    void suppress_route_announce(OspfTypes::AreaID area, IPNet<A> net,
 
111
                                 RouteEntry<A>& rt);
 
112
 
 
113
    /**
 
114
     * A route has just been withdrawn from the routing table.
 
115
     */
 
116
    void suppress_route_withdraw(OspfTypes::AreaID area, IPNet<A> net,
 
117
                                 RouteEntry<A>& rt);
 
118
 
 
119
    /**
97
120
     * Is this an AS boundary router?
98
121
     */
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
111
134
 
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
 
142
#ifdef SUPPRESS_DB
 
143
    Trie<A, Lsa::LsaRef> _suppress_db;  // Database of suppressed self
 
144
                                        // originated LSAs
 
145
#endif
117
146
 
118
147
    /**
119
148
     * Find this LSA
163
192
     */
164
193
    void set_net_nexthop_lsid(ASExternalLsa *aselsa, IPNet<A> net, A nexthop);
165
194
 
 
195
 
 
196
    /**
 
197
     * Send this self originated LSA out.
 
198
     */
 
199
    void announce_lsa(Lsa::LsaRef lsar);
 
200
 
 
201
    /**
 
202
     * Pass this outbound AS-external-LSA through the policy filter.
 
203
     */
 
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);
 
207
 
166
208
    /**
167
209
     * Start the refresh timer.
168
210
     */
174
216
    void refresh(Lsa::LsaRef lsar);
175
217
 
176
218
    /**
177
 
     * Pass this outbound AS-External-LSA through the policy filter.
178
 
     */
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.
 
221
     */
 
222
    Lsa::LsaRef clone_lsa(Lsa::LsaRef lsar);
 
223
 
 
224
    /**
 
225
     * Is this a self originated AS-external-LSA a candidate for suppression?
 
226
     */
 
227
    bool suppress_candidate(Lsa::LsaRef lsar, IPNet<A> net, A nexthop,
 
228
                            uint32_t metric);
 
229
      
 
230
#ifdef  SUPPRESS_DB
 
231
    /**
 
232
     * Store a self originated AS-external-LSA that has been
 
233
     * suppressed for possible future revival.
 
234
     */
 
235
    void suppress_database_add(Lsa::LsaRef lsar, const IPNet<A>& net);
 
236
    
 
237
    /**
 
238
     * Delete a self originated AS-external-LSA that is no longer
 
239
     * being redistributed.
 
240
     */
 
241
    void suppress_database_delete(const IPNet<A>& net, bool invalidate);
 
242
#endif
 
243
 
 
244
    /**
 
245
     * Should this AS-external-LSA cause a self originated LSA to be
 
246
     * suppressed.
 
247
     */
 
248
    void suppress_self(Lsa::LsaRef lsar);
 
249
 
 
250
    /**
 
251
     * Should this AS-external-LSA cause a self originated LSA to be
 
252
     * suppressed.
 
253
     */
 
254
    bool suppress_self_check(Lsa::LsaRef lsar);
 
255
 
 
256
    /**
 
257
     * Find a self originated AS-external-LSA by network.
 
258
     */
 
259
    Lsa::LsaRef find_lsa_by_net(IPNet<A> net);
 
260
 
 
261
    /**
 
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.
 
265
     */
 
266
    void suppress_queue_lsa(Lsa::LsaRef lsar);
 
267
 
 
268
    /**
 
269
     * An AS-external-LSA has reached MaxAge and is being withdrawn.
 
270
     * check to see if it was suppressing a self originated LSA.
 
271
     */
 
272
    void suppress_maxage(Lsa::LsaRef lsar);
 
273
 
 
274
    /**
 
275
     * If this is an AS-external-LSA that is suppressing a self
 
276
     * originated route, then release it.
 
277
     */
 
278
    void suppress_release_lsa(Lsa::LsaRef lsar);
182
279
};
183
280
 
184
281
#endif // __OSPF_EXTERNAL_HH__