// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- // Copyright (c) 2001-2007 International Computer Science Institute // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software") // to deal in the Software without restriction, subject to the conditions // listed in the XORP LICENSE file. These conditions include: you must // preserve this copyright notice, and you cannot mention the copyright // holders in advertising related to the Software without their permission. // The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This // notice is a summary of the XORP LICENSE file; the license in that file is // legally binding. // $XORP: xorp/libxorp/nexthop.hh,v 1.6 2007/02/16 22:46:21 pavlin Exp $ #ifndef __LIBXORP_NEXTHOP_HH__ #define __LIBXORP_NEXTHOP_HH__ #include "xorp.h" #include "ipv4.hh" #include "ipv6.hh" #include "ipvx.hh" // NextHop is a generic next hop object. // PeerNextHop is for next hops that are local peers. // EncapsNextHop is for "next hops" that are non-local, and require // encapsulation to reach. Eg. PIM Register Encaps. // ExternalNextHop An IP nexthop that is not an intermediate neighbor. // DiscardNextHop is a discard interface. // // there will probably be more needed at some point #define GENERIC_NEXTHOP 0 #define PEER_NEXTHOP 1 #define ENCAPS_NEXTHOP 2 #define EXTERNAL_NEXTHOP 3 #define DISCARD_NEXTHOP 4 /** * @short Generic class for next-hop information. * * NextHop is the generic class for holding information about routing * next hops. NextHops can be of many types, including immediate * neighbors, remote routers (with IBGP), discard interfaces, * encapsulation endpoints, etc. NextHop itself doesn't really do * anything useful, except to provide a generic handle for the * specialized subclasses. */ class NextHop { public: /** * Default constructor */ NextHop() {} /** * Destructor */ virtual ~NextHop() {} /** * Get the nexthop type. * * @return the type of the nexthop. One of:
GENERIC_NEXTHOP 0 PEER_NEXTHOP 1 ENCAPS_NEXTHOP 2 EXTERNAL_NEXTHOP 3 DISCARD_NEXTHOP 4*/ virtual int type() = 0; /** * Convert this nexthop from binary form to presentation format. * * @return C++ string with the human-readable ASCII representation * of the nexthop. */ virtual string str() const = 0; }; /** * @short Template class for nexthop information. * * The information contained is the nexthop address. */ template