A Discrete-Event Network Simulator
API
ns3::Ipv4InterfaceAddress Class Reference

a class to store IPv4 address information on an interface More...

#include "ipv4-interface-address.h"

+ Collaboration diagram for ns3::Ipv4InterfaceAddress:

Public Types

enum  InterfaceAddressScope_e { HOST, LINK, GLOBAL }
 Address scope. More...
 

Public Member Functions

 Ipv4InterfaceAddress ()
 
 Ipv4InterfaceAddress (Ipv4Address local, Ipv4Mask mask)
 Configure local address, mask and broadcast address. More...
 
 Ipv4InterfaceAddress (const Ipv4InterfaceAddress &o)
 Copy constructor. More...
 
Ipv4Address GetBroadcast (void) const
 Get the broadcast address. More...
 
Ipv4Address GetLocal (void) const
 Get the local address. More...
 
Ipv4Mask GetMask (void) const
 Get the network mask. More...
 
Ipv4InterfaceAddress::InterfaceAddressScope_e GetScope (void) const
 Get address scope. More...
 
bool IsSecondary (void) const
 Check if the address is a secondary address. More...
 
void SetBroadcast (Ipv4Address broadcast)
 Set the broadcast address. More...
 
void SetLocal (Ipv4Address local)
 Set local address. More...
 
void SetMask (Ipv4Mask mask)
 Set the network mask. More...
 
void SetPrimary (void)
 Make the address primary. More...
 
void SetScope (Ipv4InterfaceAddress::InterfaceAddressScope_e scope)
 Set the scope. More...
 
void SetSecondary (void)
 Make the address secondary (used for multihoming) More...
 

Private Attributes

Ipv4Address m_broadcast
 Broadcast address. More...
 
Ipv4Address m_local
 Interface address. More...
 
Ipv4Mask m_mask
 Network mask. More...
 
InterfaceAddressScope_e m_scope
 Address scope. More...
 
bool m_secondary
 For use in multihoming. More...
 

Friends

bool operator!= (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b)
 Not equal to operator. More...
 
bool operator== (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b)
 Equal to operator. More...
 

Detailed Description

a class to store IPv4 address information on an interface

Corresponds to Linux struct in_ifaddr. A list of these addresses is stored in Ipv4Interface. This class is modelled after how current Linux handles IP aliasing for IPv4. Notably, aliasing of IPv4 interfaces (e.g., "eth0:1") is not used, and instead an interface is assigned possibly multiple addresses, with each address being classified as being primary and secondary. See the iproute2 documentation for this distinction.

Definition at line 43 of file ipv4-interface-address.h.

Member Enumeration Documentation

Address scope.

Enumerator
HOST 
LINK 
GLOBAL 

Definition at line 50 of file ipv4-interface-address.h.

Constructor & Destructor Documentation

ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress ( )

Definition at line 29 of file ipv4-interface-address.cc.

References NS_LOG_FUNCTION.

ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress ( Ipv4Address  local,
Ipv4Mask  mask 
)

Configure local address, mask and broadcast address.

Parameters
localthe local address
maskthe network mask

Definition at line 36 of file ipv4-interface-address.cc.

References ns3::Ipv4Address::Get(), ns3::Ipv4Mask::Get(), m_broadcast, m_local, m_mask, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress ( const Ipv4InterfaceAddress o)

Copy constructor.

Parameters
othe object to copy

Definition at line 46 of file ipv4-interface-address.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

Ipv4Address ns3::Ipv4InterfaceAddress::GetBroadcast ( void  ) const

Get the broadcast address.

Returns
the broadcast address

Definition at line 92 of file ipv4-interface-address.cc.

References m_broadcast, and NS_LOG_FUNCTION.

Referenced by DsdvqTableTestCase::DoRun(), DsdvTableTestCase::DoRun(), ns3::VirtualUdpSocketImpl::DoSendTo(), ns3::UdpSocketImpl::DoSendTo(), ns3::Ipv4L3Protocol::IsDestinationAddress(), ns3::VirtualIpv4L3Protocol::IsDestinationAddress(), ns3::Ipv4L3Protocol::IsUnicast(), ns3::VirtualIpv4L3Protocol::IsUnicast(), ns3::aodv::RoutingProtocol::NotifyAddAddress(), ns3::aodvq::RoutingProtocol::NotifyAddAddress(), ns3::dsdvq::RoutingProtocol::NotifyAddAddress(), ns3::dsdv::RoutingProtocol::NotifyAddAddress(), ns3::aodvq::RoutingProtocol::NotifyInterfaceUp(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::aodv::RoutingProtocol::NotifyRemoveAddress(), ns3::aodvq::RoutingProtocol::NotifyRemoveAddress(), ns3::operator<<(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodvq::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodvq::RoutingProtocol::RouteInput(), ns3::dsdvq::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::SendHello(), ns3::aodvq::RoutingProtocol::SendHello(), ns3::dsdvq::RoutingProtocol::SendPeriodicUpdate(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::aodvq::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::aodvq::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::dsdvq::RoutingProtocol::SendTriggeredUpdate(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

Ipv4Address ns3::Ipv4InterfaceAddress::GetLocal ( void  ) const

Get the local address.

Returns
the local address

Definition at line 64 of file ipv4-interface-address.cc.

References m_local, and NS_LOG_FUNCTION.

Referenced by ns3::NscTcpL4Protocol::AddInterface(), ns3::Rip::DoInitialize(), DsdvqTableTestCase::DoRun(), DsdvTableTestCase::DoRun(), ns3::Rip::DoSendRouteUpdate(), ns3::VirtualUdpSocketImpl::DoSendTo(), ns3::UdpSocketImpl::DoSendTo(), ns3::AnimationInterface::GetIpv4Address(), ns3::AnimationInterface::GetIpv4Addresses(), ns3::QKDHelper::InstallOverlayQKD(), ns3::QKDHelper::InstallQKD(), ns3::Ipv4L3Protocol::IsDestinationAddress(), ns3::VirtualIpv4L3Protocol::IsDestinationAddress(), ns3::aodvq::RoutingProtocol::IsMyOwnAddress(), ns3::aodv::RoutingProtocol::IsMyOwnAddress(), ns3::olsr::RoutingProtocol::IsMyOwnAddress(), ns3::VirtualIpv4L3Protocol::LocalDeliver(), ns3::Ipv4L3Protocol::LocalDeliver(), ns3::Ipv4EndPointDemux::Lookup(), ns3::aodv::RoutingProtocol::NotifyAddAddress(), ns3::aodvq::RoutingProtocol::NotifyAddAddress(), ns3::dsdvq::RoutingProtocol::NotifyAddAddress(), ns3::Ipv4StaticRouting::NotifyAddAddress(), ns3::dsdv::RoutingProtocol::NotifyAddAddress(), ns3::Rip::NotifyAddAddress(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::aodvq::RoutingProtocol::NotifyInterfaceUp(), ns3::Rip::NotifyInterfaceUp(), ns3::aodvq::RoutingProtocol::NotifyRemoveAddress(), ns3::aodv::RoutingProtocol::NotifyRemoveAddress(), ns3::Ipv4StaticRouting::NotifyRemoveAddress(), ns3::Rip::NotifyRemoveAddress(), ns3::operator<<(), ns3::dsdvq::RoutingTableEntry::Print(), ns3::dsdv::RoutingTableEntry::Print(), ns3::aodvq::RoutingTableEntry::Print(), ns3::aodv::RoutingTableEntry::Print(), PrintPosition(), Ratio(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodvq::RoutingProtocol::RouteInput(), ns3::dsdvq::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::olsr::RoutingProtocol::RouteInput(), ns3::olsr::RoutingProtocol::RouteOutput(), ns3::dsdvq::RoutingTableEntry::RoutingTableEntry(), ns3::dsdv::RoutingTableEntry::RoutingTableEntry(), ns3::aodv::RoutingTableEntry::RoutingTableEntry(), ns3::aodvq::RoutingTableEntry::RoutingTableEntry(), ns3::Ipv4L3Protocol::SelectSourceAddress(), ns3::VirtualIpv4L3Protocol::SelectSourceAddress(), ns3::Ipv4L3Protocol::Send(), ns3::VirtualIpv4L3Protocol::Send(), ns3::aodv::RoutingProtocol::SendHello(), ns3::aodvq::RoutingProtocol::SendHello(), ns3::dsdvq::RoutingProtocol::SendPeriodicUpdate(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodvq::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrMessage(), ns3::aodvq::RoutingProtocol::SendRerrMessage(), ns3::aodvq::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::dsdvq::RoutingProtocol::SendTriggeredUpdate(), ns3::dsdv::RoutingProtocol::SendTriggeredUpdate(), ns3::Ipv4L3Protocol::SourceAddressSelection(), and ns3::VirtualIpv4L3Protocol::SourceAddressSelection().

Ipv4Mask ns3::Ipv4InterfaceAddress::GetMask ( void  ) const

Get the network mask.

Returns
the network mask

Definition at line 78 of file ipv4-interface-address.cc.

References m_mask, and NS_LOG_FUNCTION.

Referenced by ns3::NscTcpL4Protocol::AddInterface(), ns3::QKDManager::AddNewLink(), ns3::Rip::DoSendRouteUpdate(), ns3::VirtualIpv4L3Protocol::LocalDeliver(), ns3::Ipv4L3Protocol::LocalDeliver(), ns3::Ipv4EndPointDemux::Lookup(), ns3::Ipv4StaticRouting::NotifyAddAddress(), ns3::Rip::NotifyAddAddress(), ns3::Rip::NotifyInterfaceUp(), ns3::Ipv4StaticRouting::NotifyRemoveAddress(), ns3::Rip::NotifyRemoveAddress(), ns3::operator<<(), ns3::aodvq::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::Ipv4L3Protocol::SelectSourceAddress(), ns3::VirtualIpv4L3Protocol::SelectSourceAddress(), ns3::Ipv4L3Protocol::Send(), ns3::VirtualIpv4L3Protocol::Send(), ns3::aodv::RoutingProtocol::SendHello(), ns3::aodvq::RoutingProtocol::SendHello(), ns3::dsdvq::RoutingProtocol::SendPeriodicUpdate(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodvq::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::aodvq::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::dsdvq::RoutingProtocol::SendTriggeredUpdate(), ns3::dsdv::RoutingProtocol::SendTriggeredUpdate(), ns3::Ipv4L3Protocol::SourceAddressSelection(), and ns3::VirtualIpv4L3Protocol::SourceAddressSelection().

+ Here is the caller graph for this function:

bool ns3::Ipv4InterfaceAddress::IsSecondary ( void  ) const

Check if the address is a secondary address.

Secondary address is used for multihoming

Returns
true if the address is secondary

Definition at line 113 of file ipv4-interface-address.cc.

References m_secondary, and NS_LOG_FUNCTION.

Referenced by ns3::operator<<(), ns3::Ipv4L3Protocol::SelectSourceAddress(), ns3::VirtualIpv4L3Protocol::SelectSourceAddress(), ns3::Ipv4L3Protocol::SourceAddressSelection(), and ns3::VirtualIpv4L3Protocol::SourceAddressSelection().

+ Here is the caller graph for this function:

void ns3::Ipv4InterfaceAddress::SetBroadcast ( Ipv4Address  broadcast)

Set the broadcast address.

Parameters
broadcastthe broadcast address

Definition at line 85 of file ipv4-interface-address.cc.

References m_broadcast, and NS_LOG_FUNCTION.

void ns3::Ipv4InterfaceAddress::SetLocal ( Ipv4Address  local)

Set local address.

Parameters
localthe address

Definition at line 57 of file ipv4-interface-address.cc.

References m_local, and NS_LOG_FUNCTION.

void ns3::Ipv4InterfaceAddress::SetMask ( Ipv4Mask  mask)

Set the network mask.

Parameters
maskthe network mask

Definition at line 71 of file ipv4-interface-address.cc.

References m_mask, and NS_LOG_FUNCTION.

void ns3::Ipv4InterfaceAddress::SetPrimary ( void  )

Make the address primary.

Definition at line 127 of file ipv4-interface-address.cc.

References m_secondary, and NS_LOG_FUNCTION.

void ns3::Ipv4InterfaceAddress::SetScope ( Ipv4InterfaceAddress::InterfaceAddressScope_e  scope)

Set the scope.

Parameters
scopethe scope of address

Definition at line 99 of file ipv4-interface-address.cc.

References m_scope, and NS_LOG_FUNCTION.

void ns3::Ipv4InterfaceAddress::SetSecondary ( void  )

Make the address secondary (used for multihoming)

Definition at line 120 of file ipv4-interface-address.cc.

References m_secondary, and NS_LOG_FUNCTION.

Friends And Related Function Documentation

bool operator!= ( Ipv4InterfaceAddress const &  a,
Ipv4InterfaceAddress const &  b 
)
friend

Not equal to operator.

Parameters
athe first operand
bthe first operand
Returns
true if the operands are not equal

Definition at line 174 of file ipv4-interface-address.h.

bool operator== ( Ipv4InterfaceAddress const &  a,
Ipv4InterfaceAddress const &  b 
)
friend

Equal to operator.

Parameters
athe first operand
bthe first operand
Returns
true if the operands are equal

Definition at line 169 of file ipv4-interface-address.h.

Member Data Documentation

Ipv4Address ns3::Ipv4InterfaceAddress::m_broadcast
private

Broadcast address.

Definition at line 136 of file ipv4-interface-address.h.

Referenced by GetBroadcast(), Ipv4InterfaceAddress(), ns3::operator!=(), ns3::operator==(), and SetBroadcast().

Ipv4Address ns3::Ipv4InterfaceAddress::m_local
private

Interface address.

Definition at line 132 of file ipv4-interface-address.h.

Referenced by GetLocal(), Ipv4InterfaceAddress(), ns3::operator!=(), ns3::operator==(), and SetLocal().

Ipv4Mask ns3::Ipv4InterfaceAddress::m_mask
private

Network mask.

Definition at line 135 of file ipv4-interface-address.h.

Referenced by GetMask(), Ipv4InterfaceAddress(), ns3::operator!=(), ns3::operator==(), and SetMask().

InterfaceAddressScope_e ns3::Ipv4InterfaceAddress::m_scope
private

Address scope.

Definition at line 138 of file ipv4-interface-address.h.

Referenced by GetScope(), ns3::operator!=(), ns3::operator==(), and SetScope().

bool ns3::Ipv4InterfaceAddress::m_secondary
private

For use in multihoming.

Definition at line 139 of file ipv4-interface-address.h.

Referenced by IsSecondary(), ns3::operator!=(), ns3::operator==(), SetPrimary(), and SetSecondary().


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