xorp: rib: Make lookup_next_by_igp_parent() more efficient

We now pass the iterator from where it should look for next route
instead of looping through all the routes to find it.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: NO_LAST_NET needs not to be specialized

Same code is valid for IPv6 and IPv4 class

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Pretify the usage of RedistNetCmp<A> operator()

Defined static member of RedistNetCmp<A> so the usage of operator() would
be more intuitive.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Enable compiling of rib tests

Tests are compiled to the {$builddir}/rib/tests
Files commands, test_rib_xrls.sh and
test_rib_direct.sh are copied to that directory also.

They are going to be compiled only if test building is enabled via
scons command line.

Added new enviroment 'builddir' to the SCons. It represents
string representation of build directory.
I needed it so the files could be copied to apropriate dir.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: tests: RIB should be initialized before it's used

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Print if command has succeded instead of printing integer

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Remove unneeded printf in Uint32ArgumentParser::parse

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: tests: Minor fixes to function test_route_range

Release RouteRange obtained with route_range_lookup,
and prevent memory leak.

Print that we expected error, when the expected error ocures.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Use const map when iterating through admin_distances

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Add function for finding vif by name

Added function find_vif(const string&) to avoid unnecessary
repetition in code

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Add const getters for uribs and mribs

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: libxorp: Added missing constructors to derived classes of Range

Constructors with two arguments, and one argument were missing
from derived classes.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: libxorp: Make printing of Nexthop strings simpler

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Use explicit inlining instead of explicit

This makes code more readable.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: _igp_parent and _egp_parent doesn't need to be mutable members

This members doesn't need to be mutable in ResolvedIPRouteEntry class.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Make RouteEntry more generic

Make RouteEntry more generic, by making it templetized.
Move _net and _policitags to this class, because all classes that inherit it are using those fields.

IPRouteEntry overides the nexthop function of RouteEntry with different NextHop type.
To be more specific it overides it with IPNextHop type.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Use operator* instead of payload() method for Trie class

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: templatize RibVif class

Make RibVif's class interface cleaner and easier to understand.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: IPRouteEntry directly return NextHop of appropriate type

IPRouteEntry has member of IPNextHop type. It now returns nexthop of
IPNextHop type, without dynamic_casting.
This alows us to avoid unecesary casting!

DiscardNextHop and UnreachableNextHop directly inherit from
IPNextHop.

Passed all rib tests.

Signed-off-by: Igor Maravic <igorm@etf.rs>
xorp: rib: Make helper functions be static RibManager members

Signed-off-by: Igor Maravic <igorm@etf.rs>