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

« back to all changes in this revision

Viewing changes to rib/route.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/rib/route.hh,v 1.23 2007/05/23 12:12:47 pavlin Exp $
 
16
// $XORP: xorp/rib/route.hh,v 1.26 2008/01/04 22:03:28 pavlin Exp $
17
17
 
18
18
#ifndef __RIB_ROUTE_HH__
19
19
#define __RIB_ROUTE_HH__
31
31
 
32
32
#include "protocol.hh"
33
33
 
 
34
class RibVif;
34
35
 
35
36
/**
36
37
 * @short Base class for RIB routing table entries.
50
51
     * @param protocol the routing protocol that originated this route.
51
52
     * @param metric the routing protocol metric for this route.
52
53
     */
53
 
    RouteEntry(Vif* vif, NextHop* nexthop, const Protocol& protocol,
54
 
               uint16_t metric)
55
 
        : _vif(vif), _nexthop(nexthop), _protocol(protocol),
56
 
          _admin_distance(UNKNOWN_ADMIN_DISTANCE), _metric(metric)
57
 
    {
58
 
    }
59
 
 
 
54
    RouteEntry(RibVif* vif, NextHop* nexthop, const Protocol& protocol,
 
55
               uint32_t metric);
60
56
 
61
57
    /**
62
58
     * Destructor
63
59
     */
64
 
    virtual ~RouteEntry() {}
 
60
    virtual ~RouteEntry();
65
61
 
66
62
    /**
67
63
     * Get the VIF.
69
65
     * @return the Virtual Interface on which packets matching this
70
66
     * routing table entry should be forwarded.
71
67
     */
72
 
    Vif* vif() const { return _vif; }
 
68
    RibVif* vif() const { return _vif; }
73
69
 
74
70
    /**
75
71
     * Get the NextHop router.
122
118
     *
123
119
     * @param metric the routing protocol metric to be set on this route.
124
120
     */
125
 
    void set_metric(uint16_t metric) { _metric = metric; }
 
121
    void set_metric(uint32_t metric) { _metric = metric; }
126
122
 
127
123
    /**
128
124
     * Get the routing protocol metric.
129
125
     *
130
126
     * @return the routing protocol metric for this route.
131
127
     */
132
 
    uint16_t metric() const { return _metric; }
 
128
    uint32_t metric() const { return _metric; }
133
129
 
134
130
protected:
135
 
    Vif*                _vif;
 
131
    RibVif*             _vif;
136
132
    NextHop*            _nexthop;               // The next-hop router
137
133
    // The routing protocol that instantiated this route
138
134
    const Protocol&     _protocol;
139
135
    uint16_t            _admin_distance;        // Lower is better
140
 
    uint16_t            _metric;                // Lower is better
 
136
    uint32_t            _metric;                // Lower is better
141
137
};
142
138
 
143
139
/**
161
157
     * @param protocol the routing protocol that originated this route.
162
158
     * @param metric the routing protocol metric for this route.
163
159
     */
164
 
    IPRouteEntry(const IPNet<A>& net, Vif* vif, NextHop* nexthop,
165
 
                 const Protocol& protocol, uint16_t metric)
 
160
    IPRouteEntry(const IPNet<A>& net, RibVif* vif, NextHop* nexthop,
 
161
                 const Protocol& protocol, uint32_t metric)
166
162
        : RouteEntry(vif, nexthop, protocol, metric), _net(net) {}
167
163
 
168
164
    /**
177
173
     * @param metric the routing protocol metric for this route.
178
174
     * @param policytags the policy-tags for this route.
179
175
     */
180
 
    IPRouteEntry(const IPNet<A>& net, Vif* vif, NextHop* nexthop,
181
 
                 const Protocol& protocol, uint16_t metric,
 
176
    IPRouteEntry(const IPNet<A>& net, RibVif* vif, NextHop* nexthop,
 
177
                 const Protocol& protocol, uint32_t metric,
182
178
                 const PolicyTags& policytags)
183
179
        : RouteEntry(vif, nexthop, protocol, metric), _net(net),
184
180
          _policytags(policytags) {}
236
232
     *
237
233
     * @return a human readable representation of the route entry.
238
234
     */
239
 
    string str() const {
240
 
        string dst = (_net.is_valid()) ? _net.str() : string("NULL");
241
 
        string vif = (_vif) ? string(_vif->name()) : string("NULL");
242
 
        return string("Dst: ") + dst + string(" Vif: ") + vif +
243
 
            string(" NextHop: ") + _nexthop->str() +
244
 
            string(" Metric: ") + c_format("%d", _metric) +
245
 
            string(" Protocol: ") + _protocol.name() +
246
 
            string(" PolicyTags: ") + _policytags.str();
247
 
    }
 
235
    string str() const;
248
236
 
249
237
protected:
250
238
    IPNet<A> _net;              // The route entry's subnet address
288
276
     * nexthop in the egp_parent into a local nexthop.
289
277
     * @param egp_parent the orginal route entry with a non-local nexthop.
290
278
     */
291
 
    ResolvedIPRouteEntry(const IPNet<A>& net, Vif* vif, NextHop* nexthop,
292
 
                         const Protocol& protocol, uint16_t metric,
 
279
    ResolvedIPRouteEntry(const IPNet<A>& net, RibVif* vif, NextHop* nexthop,
 
280
                         const Protocol& protocol, uint32_t metric,
293
281
                         const IPRouteEntry<A>* igp_parent,
294
282
                         const IPRouteEntry<A>* egp_parent)
295
283
        : IPRouteEntry<A>(net, vif, nexthop, protocol, metric, PolicyTags()),