A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Mac48Address Class Reference

an EUI-48 address More...

#include "mac48-address.h"

+ Collaboration diagram for ns3::Mac48Address:

Public Types

typedef void(* TracedCallback) (Mac48Address value)
 TracedCallback signature for Mac48Address.
 

Public Member Functions

 Mac48Address ()=default
 
 Mac48Address (const char *str)
 
Address ConvertTo () const
 
void CopyFrom (const uint8_t buffer[6])
 
void CopyTo (uint8_t buffer[6]) const
 
bool IsBroadcast () const
 
bool IsGroup () const
 
 operator Address () const
 

Static Public Member Functions

static Mac48Address Allocate ()
 Allocate a new Mac48Address.
 
static Mac48Address ConvertFrom (const Address &address)
 
static Mac48Address GetBroadcast ()
 
static Mac48Address GetMulticast (Ipv4Address address)
 
static Mac48Address GetMulticast (Ipv6Address address)
 Get multicast address from IPv6 address.
 
static Mac48Address GetMulticast6Prefix ()
 Get the multicast prefix for IPv6 (33:33:00:00:00:00).
 
static Mac48Address GetMulticastPrefix ()
 
static bool IsMatchingType (const Address &address)
 
static void ResetAllocationIndex ()
 Reset the Mac48Address allocation index.
 

Static Private Member Functions

static uint8_t GetType ()
 Return the Type of address.
 

Private Attributes

uint8_t m_address [6] {0}
 Address value.
 

Static Private Attributes

static uint64_t m_allocationIndex = 0
 Address allocation index.
 

Friends

bool operator!= (const Mac48Address &a, const Mac48Address &b)
 Not equal to operator.
 
bool operator< (const Mac48Address &a, const Mac48Address &b)
 Less than operator.
 
std::ostream & operator<< (std::ostream &os, const Mac48Address &address)
 Stream insertion operator.
 
bool operator== (const Mac48Address &a, const Mac48Address &b)
 Equal to operator.
 
std::istream & operator>> (std::istream &is, Mac48Address &address)
 Stream extraction operator.
 

Detailed Description

an EUI-48 address

This class can contain 48 bit IEEE addresses.

See also
Mac48Address Attribute

Definition at line 34 of file mac48-address.h.

Member Typedef Documentation

◆ TracedCallback

typedef void(* ns3::Mac48Address::TracedCallback) (Mac48Address value)

TracedCallback signature for Mac48Address.

Parameters
[in]valueCurrent value of the Mac48Address

Definition at line 150 of file mac48-address.h.

Constructor & Destructor Documentation

◆ Mac48Address() [1/2]

ns3::Mac48Address::Mac48Address ( )
default

◆ Mac48Address() [2/2]

ns3::Mac48Address::Mac48Address ( const char * str)
Parameters
stra string representing the new Mac48Address

The format of the string is "xx:xx:xx:xx:xx:xx"

Definition at line 28 of file mac48-address.cc.

References m_address, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Member Function Documentation

◆ Allocate()

Mac48Address ns3::Mac48Address::Allocate ( )
static

Allocate a new Mac48Address.

Returns
newly allocated mac48Address

Definition at line 94 of file mac48-address.cc.

References m_allocationIndex, NS_LOG_FUNCTION_NOARGS, ResetAllocationIndex(), and ns3::Simulator::ScheduleDestroy().

Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper(), AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), BuildSimpleTopology(), PowerRateAdaptationTest::ConfigureNode(), ns3::WifiMacHelper::Create(), ns3::MeshHelper::CreateInterface(), InterferenceHelperSequenceTest::CreateOne(), WifiTest::CreateOne(), ThreeGppHttpObjectTestCase::CreateSimpleInternetNode(), BlockAckRecipientBufferTest::DoRun(), Bug2831TestCase::DoRun(), DcfImmediateAccessBroadcastTestCase::DoRun(), IpAddressHelperTestCasev6::DoRun(), Ipv4ForwardingTest::DoRun(), Ipv4GlobalRoutingSlash32TestCase::DoRun(), Ipv4HeaderTest::DoRun(), Ipv4StaticRoutingSlash32TestCase::DoRun(), Ipv6FragmentationTest::DoRun(), PointToPointTest::DoRun(), SixlowpanFragmentationTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), WifiExtractExpiredMpdusTest::DoRun(), WifiMacQueueDropOldestTest::DoRun(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::PointToPointHelper::Install(), ns3::WimaxHelper::Install(), ns3::WimaxHelper::Install(), ns3::WimaxHelper::Install(), ns3::WimaxHelper::Install(), ns3::CsmaHelper::InstallPriv(), ns3::FdNetDeviceHelper::InstallPriv(), ns3::SimpleNetDeviceHelper::InstallPriv(), ns3::LteSimpleHelper::InstallSingleEnbDevice(), ns3::LteSimpleHelper::InstallSingleUeDevice(), PowerRateAdaptationTest::TestAparf(), PowerRateAdaptationTest::TestParf(), and PowerRateAdaptationTest::TestRrpaa().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertFrom()

Mac48Address ns3::Mac48Address::ConvertFrom ( const Address & address)
static
Parameters
addressa polymorphic address
Returns
a new Mac48Address from the polymorphic address

This function performs a type check and asserts if the type of the input address is not compatible with an Mac48Address.

Definition at line 84 of file mac48-address.cc.

References GetType(), m_address, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::MeshPointDevice::AddInterface(), AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), ns3::OpenFlowSwitchNetDevice::AddSwitchPort(), WifiRetransmitTest::CheckValues(), ContextToMac(), ns3::TapBridge::CreateTap(), Ipv4ForwardingTest::DoRun(), Ipv4HeaderTest::DoRun(), Ipv6FragmentationTest::DoRun(), SixlowpanFragmentationTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), ns3::WifiNetDevice::DoSend(), ns3::TapBridge::ForwardToBridgedDevice(), ns3::Ipv4ClickRouting::GetMacAddressFromInterfaceId(), ns3::dot11s::HwmpProtocol::Install(), ns3::dot11s::PeerManagementProtocol::Install(), ns3::flame::FlameProtocol::Install(), ns3::aodv::Neighbors::LookupMacAddress(), ns3::dsr::DsrRouteCache::LookupMacAddress(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::WifiPhyRxTraceHelper::MapMacAddressesToNodeIds(), ns3::Ipv6AddressHelper::NewAddress(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::Ipv4ClickRouting::Receive(), ns3::Ipv4L3ClickProtocol::Receive(), ns3::StaWifiMac::Receive(), ns3::WifiMac::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::BridgeNetDevice::ReceiveFromDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::OpenFlowSwitchNetDevice::ReceiveFromDevice(), ns3::MeshHelper::Report(), ns3::LoopbackNetDevice::Send(), ns3::MeshPointDevice::Send(), ns3::WimaxNetDevice::Send(), ns3::AlohaNoackNetDevice::SendFrom(), ns3::BridgeNetDevice::SendFrom(), ns3::CsmaNetDevice::SendFrom(), ns3::FdNetDevice::SendFrom(), ns3::LoopbackNetDevice::SendFrom(), ns3::MeshPointDevice::SendFrom(), ns3::SimpleNetDevice::SendFrom(), ns3::WimaxNetDevice::SendFrom(), TestUlOfdmaPowerControl::SendMuBar(), ns3::AlohaNoackNetDevice::SetAddress(), ns3::BridgeNetDevice::SetAddress(), ns3::CsmaNetDevice::SetAddress(), ns3::FdNetDevice::SetAddress(), ns3::LoopbackNetDevice::SetAddress(), ns3::lrwpan::LrWpanNetDevice::SetAddress(), ns3::MeshPointDevice::SetAddress(), ns3::OpenFlowSwitchNetDevice::SetAddress(), ns3::PointToPointNetDevice::SetAddress(), ns3::SimpleNetDevice::SetAddress(), ns3::TapBridge::SetAddress(), ns3::WifiNetDevice::SetAddress(), and ns3::WimaxNetDevice::SetAddress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertTo()

Address ns3::Mac48Address::ConvertTo ( ) const
Returns
a new Address instance

Convert an instance of this class to a polymorphic Address instance.

Definition at line 77 of file mac48-address.cc.

References GetType(), m_address, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ CopyFrom()

void ns3::Mac48Address::CopyFrom ( const uint8_t buffer[6])
Parameters
bufferaddress in network order

Copy the input address to our internal buffer.

Definition at line 51 of file mac48-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::lrwpan::LrWpanNetDevice::BuildPseudoMacAddress(), ns3::TapBridge::CreateTap(), ns3::dot11s::HwmpTag::Deserialize(), ns3::flame::FlameTag::Deserialize(), ns3::SimpleTag::Deserialize(), GetMulticast(), GetMulticast(), ns3::ReadFrom(), ns3::ofi::LearningController::ReceiveFromSwitch(), and ns3::OpenFlowSwitchNetDevice::ReceivePortMod().

+ Here is the caller graph for this function:

◆ CopyTo()

void ns3::Mac48Address::CopyTo ( uint8_t buffer[6]) const
Parameters
bufferaddress in network order

Copy the internal address to the input buffer.

Definition at line 58 of file mac48-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by CreateTap(), SwitchFlowTableTestCase::DoRun(), GetMulticast(), GetMulticast(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::ofi::LearningController::ReceiveFromSwitch(), ns3::dot11s::HwmpTag::Serialize(), ns3::flame::FlameTag::Serialize(), ns3::SimpleTag::Serialize(), ns3::lrwpan::LrWpanNetDevice::SetAddress(), SetMacAddress(), and ns3::WriteTo().

+ Here is the caller graph for this function:

◆ GetBroadcast()

Mac48Address ns3::Mac48Address::GetBroadcast ( )
static
Returns
the broadcast address

Definition at line 144 of file mac48-address.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::NoBackhaulEpcHelper::AddEnb(), ns3::StaWifiMac::BlockTxOnLink(), EmlsrDlTxopTest::CheckBlockAck(), EmlsrDlTxopTest::CheckStaEmlNotificationFrame(), ns3::dot11s::PeerLink::ConfirmAccept(), ns3::dot11s::PeerLink::ConfirmReject(), ns3::MeshWifiBeacon::CreateHeader(), ns3::dot11s::HwmpRtable::DeleteProactivePath(), ns3::BaseStationNetDevice::DoReceive(), EpcS1uUlTestCase::DoRun(), AmpduAggregationTest::DoSetup(), WifiPrimaryChannelsTest::DoSetup(), ns3::dot11s::HwmpProtocolMac::ForwardPerr(), ns3::TapBridge::ForwardToBridgedDevice(), ns3::dot11s::HwmpProtocol::ForwardUnicast(), ns3::AlohaNoackNetDevice::GetBroadcast(), ns3::BridgeNetDevice::GetBroadcast(), ns3::CsmaNetDevice::GetBroadcast(), ns3::FdNetDevice::GetBroadcast(), ns3::LteNetDevice::GetBroadcast(), ns3::MeshPointDevice::GetBroadcast(), ns3::MockNetDevice::GetBroadcast(), ns3::OpenFlowSwitchNetDevice::GetBroadcast(), ns3::PointToPointNetDevice::GetBroadcast(), ns3::SimpleNetDevice::GetBroadcast(), ns3::TapBridge::GetBroadcast(), ns3::VirtualNetDevice::GetBroadcast(), ns3::WifiNetDevice::GetBroadcast(), ns3::WimaxNetDevice::GetBroadcast(), ns3::dot11s::HwmpProtocol::GetBroadcastReceivers(), ns3::ApWifiMac::GetFilsDiscovery(), ns3::VirtualNetDevice::GetMulticast(), ns3::VirtualNetDevice::GetMulticast(), ns3::dot11s::HwmpProtocol::GetPreqReceivers(), ns3::MultiUserScheduler::GetTriggerFrame(), ns3::flame::FlameProtocol::HandleDataFrame(), IsBroadcast(), ns3::dot11s::HwmpRtable::LookupResult::IsValid(), ns3::flame::FlameRtable::LookupResult::IsValid(), ns3::dot11s::IePreq::MayAddAddress(), ns3::dot11s::PeerLink::OpenAccept(), ns3::dot11s::PeerLink::OpenReject(), ns3::dot11s::HwmpProtocol::ProactivePathResolved(), ns3::dot11s::HwmpProtocol::ReactivePathResolved(), ns3::flame::FlameProtocolMac::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::dot11s::PeerManagementProtocol::ReceiveBeacon(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), WifiPrimaryChannelsTest::ReceiveDl(), ns3::dot11s::HwmpProtocol::ReceivePrep(), ns3::dot11s::HwmpProtocol::ReceivePreq(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::dot11s::HwmpProtocol::RetryPathDiscovery(), ns3::ApWifiMac::ScheduleFilsDiscOrUnsolProbeRespFrames(), TestMultiUserScheduler::SelectTxFormat(), ns3::QosFrameExchangeManager::SendCfEndIfNeeded(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), TestUlOfdmaPowerControl::SendMuBar(), ns3::HeFrameExchangeManager::SendMuRts(), ns3::ApWifiMac::SendOneBeacon(), ns3::dot11s::HwmpProtocol::SendProactivePreq(), ns3::StaWifiMac::SendProbeRequest(), TestUlOfdmaPpduUid::SendSuPpdu(), MultiLinkTxTest::StartTraffic(), ns3::dot11s::PeerLink::StateMachine(), ns3::StaWifiMac::UnblockTxOnLink(), and ns3::flame::FlameProtocolMac::UpdateOutcomingFrame().

+ Here is the caller graph for this function:

◆ GetMulticast() [1/2]

Mac48Address ns3::Mac48Address::GetMulticast ( Ipv4Address address)
static

◆ GetMulticast() [2/2]

Mac48Address ns3::Mac48Address::GetMulticast ( Ipv6Address address)
static

Get multicast address from IPv6 address.

Parameters
addressbase IPv6 address
Returns
a multicast address

Definition at line 206 of file mac48-address.cc.

References CopyFrom(), CopyTo(), GetMulticast6Prefix(), NS_LOG_FUNCTION, and ns3::Ipv6Address::Serialize().

+ Here is the call graph for this function:

◆ GetMulticast6Prefix()

Mac48Address ns3::Mac48Address::GetMulticast6Prefix ( )
static

Get the multicast prefix for IPv6 (33:33:00:00:00:00).

Returns
a multicast address.

Definition at line 160 of file mac48-address.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by GetMulticast().

+ Here is the caller graph for this function:

◆ GetMulticastPrefix()

Mac48Address ns3::Mac48Address::GetMulticastPrefix ( )
static
Returns
the multicast prefix (01:00:5e:00:00:00).

Definition at line 152 of file mac48-address.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by GetMulticast().

+ Here is the caller graph for this function:

◆ GetType()

uint8_t ns3::Mac48Address::GetType ( )
staticprivate

Return the Type of address.

Returns
type of address

Definition at line 122 of file mac48-address.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().

Referenced by ConvertFrom(), ConvertTo(), and IsMatchingType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBroadcast()

bool ns3::Mac48Address::IsBroadcast ( ) const

◆ IsGroup()

bool ns3::Mac48Address::IsGroup ( ) const
Returns
true if the group bit is set, false otherwise.

Definition at line 137 of file mac48-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::dot11s::AirtimeLinkMetricCalculator::CalculateMetric(), ns3::ApWifiMac::CanForwardPacketsTo(), ns3::ApWifiMac::Enqueue(), ns3::FdNetDevice::ForwardUp(), ns3::WifiNetDevice::ForwardUp(), ns3::WifiRemoteStationManager::GetAckTxVector(), ns3::WifiRemoteStationManager::GetBlockAckTxVector(), ns3::WifiRemoteStationManager::GetCtsTxVector(), ns3::WifiRemoteStationManager::GetDataTxVector(), ns3::MacTxMiddle::GetNextSequenceNumberFor(), ns3::WifiMacQueueContainer::GetQueueId(), ns3::IsGroupcast(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::WifiMacQueue::PeekByTidAndAddress(), ns3::MacTxMiddle::PeekNextSequenceNumberFor(), ns3::ApWifiMac::Receive(), ns3::CsmaNetDevice::Receive(), ns3::FrameExchangeManager::Receive(), ns3::LoopbackNetDevice::Receive(), ns3::SimpleNetDevice::Receive(), ns3::StaWifiMac::Receive(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::WifiRemoteStationManager::ReportDataOk(), ns3::WifiRemoteStationManager::ReportFinalRtsFailed(), ns3::WifiRemoteStationManager::ReportRtsFailed(), ns3::WifiRemoteStationManager::ReportRtsOk(), ns3::BridgeNetDevice::SendFrom(), ns3::MacTxMiddle::SetSequenceNumberFor(), ns3::HtFrameExchangeManager::StartFrameExchange(), ns3::WifiDefaultAckManager::TryAddMpdu(), and ns3::dot11s::PeerManagementProtocolMac::UpdateOutcomingFrame().

+ Here is the caller graph for this function:

◆ IsMatchingType()

bool ns3::Mac48Address::IsMatchingType ( const Address & address)
static
Parameters
addressaddress to test
Returns
true if the address matches, false otherwise.

Definition at line 65 of file mac48-address.cc.

References GetType(), and NS_LOG_FUNCTION.

Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::MeshPointDevice::AddInterface(), ns3::OpenFlowSwitchNetDevice::AddSwitchPort(), ns3::SixLowPanNetDevice::DoSend(), ns3::WifiNetDevice::DoSend(), ns3::SixLowPanNetDevice::Get16MacFrom48Mac(), ns3::MockNetDevice::GetBroadcast(), ns3::MockNetDevice::GetMulticast(), ns3::MockNetDevice::GetMulticast(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::Ipv6AddressHelper::NewAddress(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::lrwpan::LrWpanNetDevice::Send(), ns3::lrwpan::LrWpanNetDevice::SetAddress(), and ns3::TapBridge::SetBridgedNetDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator Address()

ns3::Mac48Address::operator Address ( ) const
Returns
a new Address instance

Convert an instance of this class to a polymorphic Address instance.

Definition at line 71 of file mac48-address.cc.

◆ ResetAllocationIndex()

void ns3::Mac48Address::ResetAllocationIndex ( )
static

Reset the Mac48Address allocation index.

This function resets (to zero) the global integer that is used for unique address allocation. It is automatically called whenever

SimulatorDestroy ();

is called. It may also be optionally called by user code if there is a need to force a reset of this allocation index.

Definition at line 115 of file mac48-address.cc.

References m_allocationIndex, and NS_LOG_FUNCTION_NOARGS.

Referenced by Allocate().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

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

Not equal to operator.

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

Definition at line 217 of file mac48-address.h.

◆ operator<

bool operator< ( const Mac48Address & a,
const Mac48Address & b )
friend

Less than operator.

Parameters
athe first operand
bthe first operand
Returns
true if the operand a is less than operand b

Definition at line 222 of file mac48-address.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Mac48Address & address )
friend

Stream insertion operator.

Parameters
osthe stream
addressthe address
Returns
a reference to the stream

Definition at line 228 of file mac48-address.cc.

◆ operator==

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

Equal to operator.

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

Definition at line 211 of file mac48-address.h.

◆ operator>>

std::istream & operator>> ( std::istream & is,
Mac48Address & address )
friend

Stream extraction operator.

Parameters
isthe stream
addressthe address
Returns
a reference to the stream

Definition at line 248 of file mac48-address.cc.

Member Data Documentation

◆ m_address

uint8_t ns3::Mac48Address::m_address[6] {0}
private

Address value.

Definition at line 205 of file mac48-address.h.

Referenced by Mac48Address(), ConvertFrom(), ConvertTo(), CopyFrom(), CopyTo(), and IsGroup().

◆ m_allocationIndex

uint64_t ns3::Mac48Address::m_allocationIndex = 0
staticprivate

Address allocation index.

Definition at line 204 of file mac48-address.h.

Referenced by Allocate(), and ResetAllocationIndex().


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