#include <ipv4-list-routing.h>
Public Member Functions | |
virtual void | AddRoutingProtocol (Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority) |
Register a new routing protocol to be used in this IPv4 stack. | |
virtual uint32_t | GetNRoutingProtocols (void) const |
virtual Ptr< Ipv4RoutingProtocol > | GetRoutingProtocol (uint32_t index, int16_t &priority) const |
virtual Ptr< Ipv4Route > | RouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) |
Query routing cache for an existing route, for an outbound packet. | |
virtual bool | RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) |
Route an input packet (to be forwarded or locally delivered). | |
virtual void | NotifyInterfaceUp (uint32_t interface) |
virtual void | NotifyInterfaceDown (uint32_t interface) |
virtual void | NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | SetIpv4 (Ptr< Ipv4 > ipv4) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Ipv4ListRouting. | |
Protected Member Functions | |
void | DoDispose (void) |
void | DoStart (void) |
This class is a specialization of Ipv4RoutingProtocol that allows other instances of Ipv4RoutingProtocol to be inserted in a prioritized list. Routing protocols in the list are consulted one by one, from highest to lowest priority, until a routing protocol is found that will take the packet (this corresponds to a non-zero return value to RouteOutput, or a return value of true to RouteInput). The order by which routing protocols with the same priority value are consulted is undefined.
virtual void ns3::Ipv4ListRouting::AddRoutingProtocol | ( | Ptr< Ipv4RoutingProtocol > | routingProtocol, | |
int16_t | priority | |||
) | [virtual] |
Register a new routing protocol to be used in this IPv4 stack.
routingProtocol | new routing protocol implementation object | |
priority | priority to give to this routing protocol. Values may range between -32768 and +32767. |
void ns3::Ipv4ListRouting::DoDispose | ( | void | ) | [protected, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
void ns3::Ipv4ListRouting::DoStart | ( | void | ) | [protected, virtual] |
This method is called only once by Object::Start. If the user calls Object::Start multiple times, DoStart is called only the first time.
Subclasses are expected to override this method and _chain up_ to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.
Reimplemented from ns3::Object.
virtual uint32_t ns3::Ipv4ListRouting::GetNRoutingProtocols | ( | void | ) | const [virtual] |
virtual Ptr<Ipv4RoutingProtocol> ns3::Ipv4ListRouting::GetRoutingProtocol | ( | uint32_t | index, | |
int16_t & | priority | |||
) | const [virtual] |
Return pointer to routing protocol stored at index, with the first protocol (index 0) the highest priority, the next one (index 1) the second highest priority, and so on. The priority parameter is an output parameter and it returns the integer priority of the protocol.
index | index of protocol to return | |
priority | output parameter, set to the priority of the protocol being returned |
static TypeId ns3::Ipv4ListRouting::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Ipv4ListRouting.
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Ipv4RoutingProtocol.
virtual void ns3::Ipv4ListRouting::NotifyAddAddress | ( | uint32_t | interface, | |
Ipv4InterfaceAddress | address | |||
) | [virtual] |
interface | the index of the interface we are being notified about | |
address | a new address being added to an interface |
Protocols are expected to implement this method to be notified whenever a new address is added to an interface. Typically used to add a 'network route' on an interface. Can be invoked on an up or down interface.
Implements ns3::Ipv4RoutingProtocol.
virtual void ns3::Ipv4ListRouting::NotifyInterfaceDown | ( | uint32_t | interface | ) | [virtual] |
interface | the index of the interface we are being notified about |
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
Implements ns3::Ipv4RoutingProtocol.
virtual void ns3::Ipv4ListRouting::NotifyInterfaceUp | ( | uint32_t | interface | ) | [virtual] |
interface | the index of the interface we are being notified about |
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
Implements ns3::Ipv4RoutingProtocol.
virtual void ns3::Ipv4ListRouting::NotifyRemoveAddress | ( | uint32_t | interface, | |
Ipv4InterfaceAddress | address | |||
) | [virtual] |
interface | the index of the interface we are being notified about | |
address | a new address being added to an interface |
Protocols are expected to implement this method to be notified whenever a new address is removed from an interface. Typically used to remove the 'network route' of an interface. Can be invoked on an up or down interface.
Implements ns3::Ipv4RoutingProtocol.
virtual bool ns3::Ipv4ListRouting::RouteInput | ( | Ptr< const Packet > | p, | |
const Ipv4Header & | header, | |||
Ptr< const NetDevice > | idev, | |||
UnicastForwardCallback | ucb, | |||
MulticastForwardCallback | mcb, | |||
LocalDeliverCallback | lcb, | |||
ErrorCallback | ecb | |||
) | [virtual] |
Route an input packet (to be forwarded or locally delivered).
This lookup is used in the forwarding process. The packet is handed over to the Ipv4RoutingProtocol, and will get forwarded onward by one of the callbacks. The Linux equivalent is ip_route_input(). There are four valid outcomes, and a matching callbacks to handle each.
p | received packet | |
header | input parameter used to form a search key for a route | |
idev | Pointer to ingress network device | |
ucb | Callback for the case in which the packet is to be forwarded as unicast | |
mcb | Callback for the case in which the packet is to be forwarded as multicast | |
lcb | Callback for the case in which the packet is to be locally delivered | |
ecb | Callback to call if there is an error in forwarding |
Implements ns3::Ipv4RoutingProtocol.
virtual Ptr<Ipv4Route> ns3::Ipv4ListRouting::RouteOutput | ( | Ptr< Packet > | p, | |
const Ipv4Header & | header, | |||
Ptr< NetDevice > | oif, | |||
Socket::SocketErrno & | sockerr | |||
) | [virtual] |
Query routing cache for an existing route, for an outbound packet.
This lookup is used by transport protocols. It does not cause any packet to be forwarded, and is synchronous. Can be used for multicast or unicast. The Linux equivalent is ip_route_output()
p | packet to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer. | |
header | input parameter (used to form key to search for the route) | |
oif | Output interface Netdevice. May be zero, or may be bound via socket options to a particular output interface. | |
sockerr | Output parameter; socket errno |
Implements ns3::Ipv4RoutingProtocol.
ipv4 | the ipv4 object this routing protocol is being associated with |
Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
Implements ns3::Ipv4RoutingProtocol.