Access to the Ipv4 forwarding table and to the ipv4 interfaces. More...
#include <ipv4.h>
Public Member Functions | |
virtual void | AddRoutingProtocol (Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority)=0 |
Register a new routing protocol to be used in this IPv4 stack. | |
virtual void | AddHostRouteTo (Ipv4Address dest, Ipv4Address nextHop, uint32_t interface)=0 |
virtual void | AddHostRouteTo (Ipv4Address dest, uint32_t interface)=0 |
virtual void | AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)=0 |
virtual void | AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkMask, uint32_t interface)=0 |
virtual void | SetDefaultRoute (Ipv4Address nextHop, uint32_t interface)=0 |
virtual uint32_t | GetNRoutes (void)=0 |
virtual Ipv4Route | GetRoute (uint32_t i)=0 |
virtual void | RemoveRoute (uint32_t i)=0 |
virtual void | AddMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)=0 |
Add a static multicast route for a given multicast source and group. | |
virtual void | RemoveMulticastRoute (Ipv4Address origin, Ipv4Address group, uint32_t inputInterface)=0 |
Remove a static multicast route for a given multicast source and group. | |
virtual void | SetDefaultMulticastRoute (uint32_t outputInterface)=0 |
Set the default static multicast route. | |
virtual uint32_t | GetNMulticastRoutes (void) const =0 |
virtual Ipv4MulticastRoute | GetMulticastRoute (uint32_t i) const =0 |
virtual void | RemoveMulticastRoute (uint32_t i)=0 |
virtual uint32_t | AddInterface (Ptr< NetDevice > device)=0 |
virtual uint32_t | GetNInterfaces (void)=0 |
virtual uint32_t | FindInterfaceForAddr (Ipv4Address addr) const =0 |
Find and return the interface ID of the interface that has been assigned the specified IP address. | |
virtual uint32_t | FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const =0 |
Find and return the interface ID of the interface that has been assigned the specified (masked) IP address. | |
virtual int32_t | FindInterfaceForDevice (Ptr< NetDevice > nd) const =0 |
Find and return the interface ID of the interface that has been associated with the specified (masked) NetDevice. | |
virtual Ptr< NetDevice > | GetNetDevice (uint32_t i)=0 |
virtual void | JoinMulticastGroup (Ipv4Address origin, Ipv4Address group)=0 |
Join a multicast group for a given multicast source and group. | |
virtual void | LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group)=0 |
Leave a multicast group for a given multicast source and group. | |
virtual void | SetAddress (uint32_t i, Ipv4Address address)=0 |
virtual void | SetNetworkMask (uint32_t i, Ipv4Mask mask)=0 |
virtual Ipv4Mask | GetNetworkMask (uint32_t i) const =0 |
virtual void | SetMetric (uint32_t i, uint16_t metric)=0 |
virtual uint16_t | GetMetric (uint32_t i) const =0 |
virtual Ipv4Address | GetAddress (uint32_t i) const =0 |
virtual Ipv4Address | GetSourceAddress (Ipv4Address destination) const =0 |
virtual bool | GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const =0 |
virtual uint16_t | GetMtu (uint32_t i) const =0 |
virtual bool | IsUp (uint32_t i) const =0 |
virtual void | SetUp (uint32_t i)=0 |
virtual void | SetDown (uint32_t i)=0 |
virtual uint32_t | GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask=Ipv4Mask("255.255.255.255")) |
Convenience function to return the ifIndex corresponding to the Ipv4Address provided. | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Ipv4. |
Access to the Ipv4 forwarding table and to the ipv4 interfaces.
This class allows you to create ipv4 interfaces based on a NetDevice. Multiple interfaces can be created for a single NetDevice, hence achieving multihoming.
This class also allows you to control the content of the ipv4 forwarding table.
virtual void ns3::Ipv4::AddHostRouteTo | ( | Ipv4Address | dest, | |
Ipv4Address | nextHop, | |||
uint32_t | interface | |||
) | [pure virtual] |
dest | destination address | |
nextHop | address of next hop. | |
interface | interface of next hop. |
Add route to host dest through host nextHop on interface.
virtual void ns3::Ipv4::AddHostRouteTo | ( | Ipv4Address | dest, | |
uint32_t | interface | |||
) | [pure virtual] |
dest | destination address | |
interface | of next hop |
add route to host dest on interface.
device | device to add to the list of ipv4 interfaces which can be used as output interfaces during packet forwarding. |
Once a device has been added, it can never be removed: if you want to disable it, you can invoke Ipv4::SetDown which will make sure that it is never used during packet forwarding.
virtual void ns3::Ipv4::AddMulticastRoute | ( | Ipv4Address | origin, | |
Ipv4Address | group, | |||
uint32_t | inputInterface, | |||
std::vector< uint32_t > | outputInterfaces | |||
) | [pure virtual] |
Add a static multicast route for a given multicast source and group.
origin | The Ipv4 address of the multicast source. | |
group | The multicast group address. | |
inputInterface | The interface index over which the packet arrived. | |
outputInterfaces | The list of output interface indices over which the packet should be sent (excluding the inputInterface). |
virtual void ns3::Ipv4::AddNetworkRouteTo | ( | Ipv4Address | network, | |
Ipv4Mask | networkMask, | |||
Ipv4Address | nextHop, | |||
uint32_t | interface | |||
) | [pure virtual] |
network | destination network | |
networkMask | netmask of destination network | |
nextHop | address of next hop | |
interface | interface of next hop |
add route to network dest with netmask through host nextHop on interface
virtual void ns3::Ipv4::AddNetworkRouteTo | ( | Ipv4Address | network, | |
Ipv4Mask | networkMask, | |||
uint32_t | interface | |||
) | [pure virtual] |
network | destination network | |
networkMask | netmask of destination network | |
interface | interface of next hop |
add route to network dest with netmask on interface
virtual void ns3::Ipv4::AddRoutingProtocol | ( | Ptr< Ipv4RoutingProtocol > | routingProtocol, | |
int16_t | priority | |||
) | [pure 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. The priority 0 corresponds to static routing table lookups, higher values have more priority. The order by which routing protocols with the same priority value are consulted is undefined. |
virtual uint32_t ns3::Ipv4::FindInterfaceForAddr | ( | Ipv4Address | addr | ) | const [pure virtual] |
Find and return the interface ID of the interface that has been assigned the specified IP address.
addr | The IP address assigned to the interface of interest. |
Each IP interface has an IP address associated with it. It is often useful to search the list of interfaces for one that corresponds to a known IP Address. This call takes an IP address as a parameter and returns the interface index of the first interface that has been assigned that address. If the address is not found, this function asserts.
virtual uint32_t ns3::Ipv4::FindInterfaceForAddr | ( | Ipv4Address | addr, | |
Ipv4Mask | mask | |||
) | const [pure virtual] |
Find and return the interface ID of the interface that has been assigned the specified (masked) IP address.
addr | The IP address assigned to the interface of interest. | |
mask | The address mask to be used in address matching. |
Each IP interface has an IP address associated with it. It is often useful to search the list of interfaces for one that corresponds to a known IP Address. This call takes an IP address and an IP address mask as parameters and returns the interface index of the first interface that matches the masked IP address.
Find and return the interface ID of the interface that has been associated with the specified (masked) NetDevice.
nd | The net device of the interface of interest. |
Each IP interface is associated with a net device. It is often useful to search the list of interfaces for one that corresponds to a known net device. This call takes an smart pointer to a net device and returns the interface index of the first interface that matches the net device.
virtual Ipv4Address ns3::Ipv4::GetAddress | ( | uint32_t | i | ) | const [pure virtual] |
i | index of ipv4 interface |
Note that the broadcast address for this interface may be fetched from the Ipv4Address object returned here using Ipv4Address::GetSubnetDirectedBroadcast(mask), where the mask for the interface may be retrived using Ipv4::GetNetworkMask(i).
virtual uint32_t ns3::Ipv4::GetIfIndexByAddress | ( | Ipv4Address | addr, | |
Ipv4Mask | mask = Ipv4Mask("255.255.255.255") | |||
) | [virtual] |
Convenience function to return the ifIndex corresponding to the Ipv4Address provided.
addr | Ipv4Address | |
mask | corresponding Ipv4Mask |
virtual bool ns3::Ipv4::GetIfIndexForDestination | ( | Ipv4Address | dest, | |
uint32_t & | ifIndex | |||
) | const [pure virtual] |
dest | The IP address of a hypothetical destination. | |
ifIndex | filled in with the interface index that will be used to send a packet to the hypothetical destination. |
virtual uint16_t ns3::Ipv4::GetMetric | ( | uint32_t | i | ) | const [pure virtual] |
i | index of ipv4 interface |
virtual uint16_t ns3::Ipv4::GetMtu | ( | uint32_t | i | ) | const [pure virtual] |
i | index of ipv4 interface |
virtual Ipv4MulticastRoute ns3::Ipv4::GetMulticastRoute | ( | uint32_t | i | ) | const [pure virtual] |
i | index of route to return |
i | index of ipv4 interface |
virtual Ipv4Mask ns3::Ipv4::GetNetworkMask | ( | uint32_t | i | ) | const [pure virtual] |
i | index of ipv4 interface |
virtual uint32_t ns3::Ipv4::GetNInterfaces | ( | void | ) | [pure virtual] |
virtual uint32_t ns3::Ipv4::GetNMulticastRoutes | ( | void | ) | const [pure virtual] |
virtual uint32_t ns3::Ipv4::GetNRoutes | ( | void | ) | [pure virtual] |
virtual Ipv4Route ns3::Ipv4::GetRoute | ( | uint32_t | i | ) | [pure virtual] |
i | index of route to return |
virtual Ipv4Address ns3::Ipv4::GetSourceAddress | ( | Ipv4Address | destination | ) | const [pure virtual] |
destination | The IP address of a hypothetical destination. |
Note that the broadcast address for this interface may be fetched from the Ipv4Address object returned here using Ipv4Address::GetSubnetDirectedBroadcast(mask), where the mask for the interface may be retrived using Ipv4::GetNetworkMask(i).
static TypeId ns3::Ipv4::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Ipv4.
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Object.
virtual bool ns3::Ipv4::IsUp | ( | uint32_t | i | ) | const [pure virtual] |
i | index of ipv4 interface |
virtual void ns3::Ipv4::JoinMulticastGroup | ( | Ipv4Address | origin, | |
Ipv4Address | group | |||
) | [pure virtual] |
Join a multicast group for a given multicast source and group.
origin | The Ipv4 address of the multicast source. | |
group | The multicast group address. |
virtual void ns3::Ipv4::LeaveMulticastGroup | ( | Ipv4Address | origin, | |
Ipv4Address | group | |||
) | [pure virtual] |
Leave a multicast group for a given multicast source and group.
origin | The Ipv4 address of the multicast source. | |
group | The multicast group address. |
virtual void ns3::Ipv4::RemoveMulticastRoute | ( | Ipv4Address | origin, | |
Ipv4Address | group, | |||
uint32_t | inputInterface | |||
) | [pure virtual] |
Remove a static multicast route for a given multicast source and group.
origin | The Ipv4 address of the multicast source. | |
group | The multicast group address. | |
inputInterface | The interface index over which the packet arrived. |
virtual void ns3::Ipv4::RemoveMulticastRoute | ( | uint32_t | i | ) | [pure virtual] |
i | index of route to remove from routing table. |
virtual void ns3::Ipv4::RemoveRoute | ( | uint32_t | i | ) | [pure virtual] |
i | index of route to remove from routing table. |
virtual void ns3::Ipv4::SetAddress | ( | uint32_t | i, | |
Ipv4Address | address | |||
) | [pure virtual] |
i | index of ipv4 interface | |
address | address to associate to the underlying ipv4 interface |
virtual void ns3::Ipv4::SetDefaultMulticastRoute | ( | uint32_t | outputInterface | ) | [pure virtual] |
Set the default static multicast route.
outputInterface | The network output interface index over which packets without specific routes should be sent. |
virtual void ns3::Ipv4::SetDefaultRoute | ( | Ipv4Address | nextHop, | |
uint32_t | interface | |||
) | [pure virtual] |
nextHop | address of default next hop | |
interface | interface of default next hop. |
set the default route to host nextHop on interface.
virtual void ns3::Ipv4::SetDown | ( | uint32_t | i | ) | [pure virtual] |
i | index of ipv4 interface |
Set the interface into the "down" state. In this state, it is ignored during ipv4 forwarding.
virtual void ns3::Ipv4::SetMetric | ( | uint32_t | i, | |
uint16_t | metric | |||
) | [pure virtual] |
i | index of ipv4 interface | |
metric | routing metric (cost) associated to the underlying ipv4 interface |
virtual void ns3::Ipv4::SetNetworkMask | ( | uint32_t | i, | |
Ipv4Mask | mask | |||
) | [pure virtual] |
i | index of ipv4 interface | |
mask | mask to associate to the underlying ipv4 interface |
virtual void ns3::Ipv4::SetUp | ( | uint32_t | i | ) | [pure virtual] |
i | index of ipv4 interface |
Set the interface into the "up" state. In this state, it is considered valid during ipv4 forwarding.