Public Member Functions | Static Public Member Functions | Protected Member Functions

ns3::Ipv4StaticRouting Class Reference
[Ipv4StaticRouting]

Static routing protocol for IP version 4 stacks. More...

#include <ipv4-static-routing.h>

Inheritance diagram for ns3::Ipv4StaticRouting:
Inheritance graph
[legend]
Collaboration diagram for ns3::Ipv4StaticRouting:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual Ptr< Ipv4RouteRouteOutput (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)
void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
 Add a network route to the static routing table.
void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0)
 Add a network route to the static routing table.
void AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
 Add a host route to the static routing table.
void AddHostRouteTo (Ipv4Address dest, uint32_t interface, uint32_t metric=0)
 Add a host route to the static routing table.
void SetDefaultRoute (Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
 Add a default route to the static routing table.
uint32_t GetNRoutes (void)
 Get the number of individual unicast routes that have been added to the routing table.
Ipv4RoutingTableEntry GetDefaultRoute (void)
 Get the default route with lowest metric from the static routing table.
Ipv4RoutingTableEntry GetRoute (uint32_t i)
 Get a route from the static unicast routing table.
uint32_t GetMetric (uint32_t index)
 Get a metric for route from the static unicast routing table.
void RemoveRoute (uint32_t i)
 Remove a route from the static unicast routing table.
void AddMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)
 Add a multicast route to the static routing table.
void SetDefaultMulticastRoute (uint32_t outputInterface)
 Add a default multicast route to the static routing table.
uint32_t GetNMulticastRoutes (void) const
 Get the number of individual multicast routes that have been added to the routing table.
Ipv4MulticastRoutingTableEntry GetMulticastRoute (uint32_t i) const
 Get a route from the static multicast routing table.
bool RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface)
 Remove a route from the static multicast routing table.
void RemoveMulticastRoute (uint32_t index)
 Remove a route from the static multicast routing table.

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::Ipv4StaticRouting.

Protected Member Functions

virtual void DoDispose (void)

Detailed Description

Static routing protocol for IP version 4 stacks.

This class provides a basic set of methods for inserting static unicast and multicast routes into the Ipv4 routing system. This particular protocol is designed to be inserted into an Ipv4ListRouting protocol but can be used also as a standalone protocol.

The Ipv4StaticRouting class inherits from the abstract base class Ipv4RoutingProtocol that defines the interface methods that a routing protocol must support.

See also:
Ipv4RoutingProtocol
Ipv4ListRouting
Ipv4ListRouting::AddRoutingProtocol

Member Function Documentation

void ns3::Ipv4StaticRouting::AddHostRouteTo ( Ipv4Address  dest,
Ipv4Address  nextHop,
uint32_t  interface,
uint32_t  metric = 0 
)

Add a host route to the static routing table.

Parameters:
dest The Ipv4Address destination for this route.
nextHop The Ipv4Address of the next hop in the route.
interface The network interface index used to send packets to the destination.
metric Metric of route in case of multiple routes to same destination
See also:
Ipv4Address
void ns3::Ipv4StaticRouting::AddHostRouteTo ( Ipv4Address  dest,
uint32_t  interface,
uint32_t  metric = 0 
)

Add a host route to the static routing table.

Parameters:
dest The Ipv4Address destination for this route.
interface The network interface index used to send packets to the destination.
metric Metric of route in case of multiple routes to same destination
See also:
Ipv4Address
void ns3::Ipv4StaticRouting::AddMulticastRoute ( Ipv4Address  origin,
Ipv4Address  group,
uint32_t  inputInterface,
std::vector< uint32_t >  outputInterfaces 
)

Add a multicast route to the static routing table.

A multicast route must specify an origin IP address, a multicast group and an input network interface index as conditions and provide a vector of output network interface indices over which packets matching the conditions are sent.

Typically there are two main types of multicast routes: routes of the first kind are used during forwarding. All of the conditions must be explicitly provided. The second kind of routes are used to get packets off of a local node. The difference is in the input interface. Routes for forwarding will always have an explicit input interface specified. Routes off of a node will always set the input interface to a wildcard specified by the index Ipv4RoutingProtocol::INTERFACE_ANY.

For routes off of a local node wildcards may be used in the origin and multicast group addresses. The wildcard used for Ipv4Adresses is that address returned by Ipv4Address::GetAny () -- typically "0.0.0.0". Usage of a wildcard allows one to specify default behavior to varying degrees.

For example, making the origin address a wildcard, but leaving the multicast group specific allows one (in the case of a node with multiple interfaces) to create different routes using different output interfaces for each multicast group.

If the origin and multicast addresses are made wildcards, you have created essentially a default multicast address that can forward to multiple interfaces. Compare this to the actual default multicast address that is limited to specifying a single output interface for compatibility with existing functionality in other systems.

Parameters:
origin The Ipv4Address of the origin of packets for this route. May be Ipv4Address:GetAny for open groups.
group The Ipv4Address of the multicast group or this route.
inputInterface The input network interface index over which to expect packets destined for this route. May be Ipv4RoutingProtocol::INTERFACE_ANY for packets of local origin.
outputInterfaces A vector of network interface indices used to specify how to send packets to the destination(s).
See also:
Ipv4Address
void ns3::Ipv4StaticRouting::AddNetworkRouteTo ( Ipv4Address  network,
Ipv4Mask  networkMask,
Ipv4Address  nextHop,
uint32_t  interface,
uint32_t  metric = 0 
)

Add a network route to the static routing table.

Parameters:
network The Ipv4Address network for this route.
networkMask The Ipv4Mask to extract the network.
nextHop The next hop in the route to the destination network.
interface The network interface index used to send packets to the destination.
metric Metric of route in case of multiple routes to same destination
See also:
Ipv4Address
void ns3::Ipv4StaticRouting::AddNetworkRouteTo ( Ipv4Address  network,
Ipv4Mask  networkMask,
uint32_t  interface,
uint32_t  metric = 0 
)

Add a network route to the static routing table.

Parameters:
network The Ipv4Address network for this route.
networkMask The Ipv4Mask to extract the network.
interface The network interface index used to send packets to the destination.
metric Metric of route in case of multiple routes to same destination
See also:
Ipv4Address
virtual void ns3::Ipv4StaticRouting::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.

Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetDefaultRoute ( void   ) 

Get the default route with lowest metric from the static routing table.

Returns:
If the default route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise an empty routing table entry is returned. If multiple default routes exist, the one with lowest metric is returned.
See also:
Ipv4RoutingTableEntry
uint32_t ns3::Ipv4StaticRouting::GetMetric ( uint32_t  index  ) 

Get a metric for route from the static unicast routing table.

Parameters:
index The index (into the routing table) of the route to retrieve.
Returns:
If route is set, the metric is returned. If not, an infinity metric (0xffffffff) is returned
Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute ( uint32_t  i  )  const

Get a route from the static multicast routing table.

Externally, the multicast static routing table appears simply as a table with n entries.

Parameters:
i The index (into the routing table) of the multicast route to retrieve.
Returns:
If route i is set, a pointer to that Ipv4MulticastRoutingTableEntry is returned, otherwise a zero pointer is returned.
See also:
Ipv4MulticastRoutingTableEntry
Ipv4StaticRouting::RemoveRoute
uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes ( void   )  const

Get the number of individual multicast routes that have been added to the routing table.

Warning:
The default multicast route counts as one of the routes.
uint32_t ns3::Ipv4StaticRouting::GetNRoutes ( void   ) 

Get the number of individual unicast routes that have been added to the routing table.

Warning:
The default route counts as one of the routes.
Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute ( uint32_t  i  ) 

Get a route from the static unicast routing table.

Externally, the unicast static routing table appears simply as a table with n entries.

Parameters:
i The index (into the routing table) of the route to retrieve.
Returns:
If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise a zero pointer is returned.
See also:
Ipv4RoutingTableEntry
Ipv4StaticRouting::RemoveRoute
static TypeId ns3::Ipv4StaticRouting::GetTypeId ( void   )  [static]

This method returns the TypeId associated to ns3::Ipv4StaticRouting.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Phy/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Phy/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/BsIpcsPacketClassifier/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/BsIpcsPacketClassifier/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/LinkManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/LinkManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/SSManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/SSManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/ServiceFlowManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::BaseStationNetDevice/ServiceFlowManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::NonCommunicatingNetDevice/Phy/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::NonCommunicatingNetDevice/Phy/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/Classifier/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/Classifier/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/LinkManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/LinkManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/SSScheduler/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::SubscriberStationNetDevice/SSScheduler/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Channel/NoiseModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Channel/NoiseModel/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Channel/PropagationModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Channel/PropagationModel/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Mac/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Mac/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Phy/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Phy/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Transducer/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Transducer/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/BsIpcsPacketClassifier/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/BsIpcsPacketClassifier/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/LinkManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/LinkManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/SSManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/SSManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/ServiceFlowManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::BaseStationNetDevice/ServiceFlowManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/Classifier/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/Classifier/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/LinkManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/LinkManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/SSScheduler/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/$ns3::SubscriberStationNetDevice/SSScheduler/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/BandwidthManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/BandwidthManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/BurstProfileManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/BurstProfileManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Channel/$ns3::UanChannel/NoiseModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Channel/$ns3::UanChannel/NoiseModel/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Channel/$ns3::UanChannel/PropagationModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Channel/$ns3::UanChannel/PropagationModel/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/ConnectionManager/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/ConnectionManager/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Phy/Channel/$ns3::UanChannel/NoiseModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Phy/Channel/$ns3::UanChannel/NoiseModel/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Phy/Channel/$ns3::UanChannel/PropagationModel/$ns3::Ipv4RoutingProtocol/$ns3::Ipv4StaticRouting
  • /NodeList/[i]/DeviceList/[i]/$ns3::WimaxNetDevice/Phy/Channel/$ns3::UanChannel/PropagationModel/$ns3::Ipv4StaticRouting

No Attributes defined for this type.
No TraceSources defined for this type.

Reimplemented from ns3::Ipv4RoutingProtocol.

virtual void ns3::Ipv4StaticRouting::NotifyAddAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
) [virtual]
Parameters:
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::Ipv4StaticRouting::NotifyInterfaceDown ( uint32_t  interface  )  [virtual]
Parameters:
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::Ipv4StaticRouting::NotifyInterfaceUp ( uint32_t  interface  )  [virtual]
Parameters:
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::Ipv4StaticRouting::NotifyRemoveAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
) [virtual]
Parameters:
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.

bool ns3::Ipv4StaticRouting::RemoveMulticastRoute ( Ipv4Address  origin,
Ipv4Address  group,
uint32_t  inputInterface 
)

Remove a route from the static multicast routing table.

Externally, the multicast static routing table appears simply as a table with n entries. This method causes the multicast routing table to be searched for the first route that matches the parameters and removes it.

Wildcards may be provided to this function, but the wildcards are used to exactly match wildcards in the routes (see AddMulticastRoute). That is, calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not remove routes with any address in the origin, but will only remove routes with "0.0.0.0" set as the the origin.

Parameters:
origin The IP address specified as the origin of packets for the route.
group The IP address specified as the multicast group address of the route.
inputInterface The network interface index specified as the expected input interface for the route.
Returns:
true if a route was found and removed, false otherwise.
See also:
Ipv4MulticastRoutingTableEntry
Ipv4StaticRouting::AddMulticastRoute
void ns3::Ipv4StaticRouting::RemoveMulticastRoute ( uint32_t  index  ) 

Remove a route from the static multicast routing table.

Externally, the multicast static routing table appears simply as a table with n entries.

Parameters:
index The index (into the multicast routing table) of the route to remove.
See also:
Ipv4RoutingTableEntry
Ipv4StaticRouting::GetRoute
Ipv4StaticRouting::AddRoute
void ns3::Ipv4StaticRouting::RemoveRoute ( uint32_t  i  ) 

Remove a route from the static unicast routing table.

Externally, the unicast static routing table appears simply as a table with n entries.

Parameters:
i The index (into the routing table) of the route to remove.
See also:
Ipv4RoutingTableEntry
Ipv4StaticRouting::GetRoute
Ipv4StaticRouting::AddRoute
virtual bool ns3::Ipv4StaticRouting::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.

Parameters:
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
Returns:
true if the Ipv4RoutingProtocol takes responsibility for forwarding or delivering the packet, false otherwise

Implements ns3::Ipv4RoutingProtocol.

virtual Ptr<Ipv4Route> ns3::Ipv4StaticRouting::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()

Parameters:
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
Returns:
a code that indicates what happened in the lookup

Implements ns3::Ipv4RoutingProtocol.

void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute ( uint32_t  outputInterface  ) 

Add a default multicast route to the static routing table.

This is the multicast equivalent of the unicast version SetDefaultRoute. We tell the routing system what to do in the case where a specific route to a destination multicast group is not found. The system forwards packets out the specified interface in the hope that "something out there" knows better how to route the packet. This method is only used in initially sending packets off of a host. The default multicast route is not consulted during forwarding -- exact routes must be specified using AddMulticastRoute for that case.

Since we're basically sending packets to some entity we think may know better what to do, we don't pay attention to "subtleties" like origin address, nor do we worry about forwarding out multiple interfaces. If the default multicast route is set, it is returned as the selected route from LookupStatic irrespective of origin or multicast group if another specific route is not found.

Parameters:
outputInterface The network interface index used to specify where to send packets in the case of unknown routes.
See also:
Ipv4Address
void ns3::Ipv4StaticRouting::SetDefaultRoute ( Ipv4Address  nextHop,
uint32_t  interface,
uint32_t  metric = 0 
)

Add a default route to the static routing table.

This method tells the routing system what to do in the case where a specific route to a destination is not found. The system forwards packets to the specified node in the hope that it knows better how to route the packet.

If the default route is set, it is returned as the selected route from LookupStatic irrespective of destination address if no specific route is found.

Parameters:
nextHop The Ipv4Address to send packets to in the hope that they will be forwarded correctly.
interface The network interface index used to send packets.
metric Metric of route in case of multiple routes to same destination
See also:
Ipv4Address
Ipv4StaticRouting::Lookup
virtual void ns3::Ipv4StaticRouting::SetIpv4 ( Ptr< Ipv4 ipv4  )  [virtual]
Parameters:
ipv4 the ipv4 object this routing protocol is being associated with

Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol

Implements ns3::Ipv4RoutingProtocol.


The documentation for this class was generated from the following files: