an EUI-48 address More...
#include "mac48-address.h"
Public Types | |
typedef void(* | TracedCallback) (Mac48Address value) |
TracedCallback signature for Mac48Address. More... | |
Public Member Functions | |
Mac48Address () | |
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. More... | |
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. More... | |
static Mac48Address | GetMulticast6Prefix () |
Get the multicast prefix for IPv6 (33:33:00:00:00:00). More... | |
static Mac48Address | GetMulticastPrefix () |
static bool | IsMatchingType (const Address &address) |
static void | ResetAllocationIndex () |
Reset the Mac48Address allocation index. More... | |
Static Private Member Functions | |
static uint8_t | GetType () |
Return the Type of address. More... | |
Private Attributes | |
uint8_t | m_address [6] |
address value More... | |
Static Private Attributes | |
static uint64_t | m_allocationIndex = 0 |
Address allocation index. More... | |
Friends | |
bool | operator!= (const Mac48Address &a, const Mac48Address &b) |
Not equal to operator. More... | |
bool | operator< (const Mac48Address &a, const Mac48Address &b) |
Less than operator. More... | |
std::ostream & | operator<< (std::ostream &os, const Mac48Address &address) |
Stream insertion operator. More... | |
bool | operator== (const Mac48Address &a, const Mac48Address &b) |
Equal to operator. More... | |
std::istream & | operator>> (std::istream &is, Mac48Address &address) |
Stream extraction operator. More... | |
an EUI-48 address
This class can contain 48 bit IEEE addresses.
Definition at line 45 of file mac48-address.h.
typedef void(* ns3::Mac48Address::TracedCallback) (Mac48Address value) |
TracedCallback signature for Mac48Address.
[in] | value | Current value of the Mac48Address |
Definition at line 161 of file mac48-address.h.
ns3::Mac48Address::Mac48Address | ( | ) |
Definition at line 69 of file mac48-address.cc.
References m_address, and NS_LOG_FUNCTION.
Referenced by GetBroadcast(), GetMulticast6Prefix(), and GetMulticastPrefix().
ns3::Mac48Address::Mac48Address | ( | const char * | str | ) |
str | a string representing the new Mac48Address |
The format of the string is "xx:xx:xx:xx:xx:xx"
Definition at line 75 of file mac48-address.cc.
References ASCII_a, ASCII_COLON, ASCII_ZERO, ns3::AsciiToLowCase(), m_address, NS_ASSERT, and NS_LOG_FUNCTION.
|
static |
Allocate a new Mac48Address.
Definition at line 151 of file mac48-address.cc.
References first::address, m_allocationIndex, NS_LOG_FUNCTION_NOARGS, ResetAllocationIndex(), and ns3::Simulator::ScheduleDestroy().
Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper(), AddSimpleNetDevice(), BuildSimpleTopology(), ns3::WifiMacHelper::Create(), ns3::MeshHelper::CreateInterface(), ns3::WaveHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::WimaxHelper::Install(), ns3::PointToPointHelper::Install(), ns3::FdNetDeviceHelper::InstallPriv(), ns3::CsmaHelper::InstallPriv(), ns3::SimpleNetDeviceHelper::InstallPriv(), ns3::LteSimpleHelper::InstallSingleEnbDevice(), and ns3::LteSimpleHelper::InstallSingleUeDevice().
|
static |
address | a 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 141 of file mac48-address.cc.
References first::address, GetType(), m_address, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::MeshPointDevice::AddInterface(), AddSimpleNetDevice(), ContextToMac(), ns3::TapBridge::CreateTap(), ns3::TapBridge::ForwardToBridgedDevice(), 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::Ipv6AddressHelper::NewAddress(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::WifiMac::Receive(), ns3::StaWifiMac::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::BridgeNetDevice::ReceiveFromDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::GtpTunnelApp::RecvFromTunnelSocket(), ns3::MeshHelper::Report(), ns3::LoopbackNetDevice::Send(), ns3::MeshPointDevice::Send(), ns3::WaveNetDevice::Send(), ns3::WifiNetDevice::Send(), ns3::WimaxNetDevice::Send(), ns3::BridgeNetDevice::SendFrom(), ns3::CsmaNetDevice::SendFrom(), ns3::FdNetDevice::SendFrom(), ns3::LoopbackNetDevice::SendFrom(), ns3::MeshPointDevice::SendFrom(), ns3::SimpleNetDevice::SendFrom(), ns3::AlohaNoackNetDevice::SendFrom(), ns3::WifiNetDevice::SendFrom(), ns3::WimaxNetDevice::SendFrom(), ns3::WaveNetDevice::SendX(), ns3::MeshPointDevice::SetAddress(), ns3::BridgeNetDevice::SetAddress(), ns3::CsmaNetDevice::SetAddress(), ns3::FdNetDevice::SetAddress(), ns3::LoopbackNetDevice::SetAddress(), ns3::LrWpanNetDevice::SetAddress(), ns3::SimpleNetDevice::SetAddress(), ns3::PointToPointNetDevice::SetAddress(), ns3::AlohaNoackNetDevice::SetAddress(), ns3::TapBridge::SetAddress(), ns3::WaveNetDevice::SetAddress(), ns3::WifiNetDevice::SetAddress(), and ns3::WimaxNetDevice::SetAddress().
Address ns3::Mac48Address::ConvertTo | ( | ) | const |
Convert an instance of this class to a polymorphic Address instance.
Definition at line 134 of file mac48-address.cc.
References GetType(), m_address, and NS_LOG_FUNCTION.
void ns3::Mac48Address::CopyFrom | ( | const uint8_t | buffer[6] | ) |
buffer | address in network order |
Copy the input address to our internal buffer.
Definition at line 108 of file mac48-address.cc.
References m_address, and NS_LOG_FUNCTION.
Referenced by ns3::LrWpanNetDevice::BuildPseudoMacAddress(), ns3::TapBridge::CreateTap(), ns3::dot11s::HwmpTag::Deserialize(), ns3::flame::FlameTag::Deserialize(), ns3::SimpleTag::Deserialize(), GetMulticast(), ns3::TunnelController::HandleArpPacketIn(), QosController::HandleArpPacketIn(), QosController::HandleConnectionRequest(), and ns3::ReadFrom().
void ns3::Mac48Address::CopyTo | ( | uint8_t | buffer[6] | ) | const |
buffer | address in network order |
Copy the internal address to the input buffer.
Definition at line 115 of file mac48-address.cc.
References m_address, and NS_LOG_FUNCTION.
Referenced by SwitchFlowTableTestCase::DoRun(), GetMulticast(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::dot11s::HwmpTag::Serialize(), ns3::flame::FlameTag::Serialize(), ns3::SimpleTag::Serialize(), ns3::LrWpanNetDevice::SetAddress(), and ns3::WriteTo().
|
static |
Definition at line 201 of file mac48-address.cc.
References Mac48Address(), and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::NoBackhaulEpcHelper::AddEnb(), ns3::dot11s::PeerLink::ConfirmAccept(), ns3::dot11s::PeerLink::ConfirmReject(), ns3::MeshWifiBeacon::CreateHeader(), ns3::dot11s::HwmpRtable::DeleteProactivePath(), ns3::dot11s::HwmpProtocolMac::ForwardPerr(), ns3::dot11s::HwmpProtocol::ForwardUnicast(), ns3::LteNetDevice::GetBroadcast(), ns3::MockNetDevice::GetBroadcast(), ns3::WaveNetDevice::GetBroadcast(), ns3::WifiNetDevice::GetBroadcast(), ns3::WimaxNetDevice::GetBroadcast(), ns3::dot11s::HwmpProtocol::GetBroadcastReceivers(), 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::MeshWifiInterfaceMac::Receive(), ns3::flame::FlameProtocolMac::Receive(), ns3::dot11s::PeerManagementProtocol::ReceiveBeacon(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), 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::QosFrameExchangeManager::SendCfEndIfNeeded(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), ns3::HeFrameExchangeManager::SendMuRts(), ns3::ApWifiMac::SendOneBeacon(), WaveNetDeviceExample::SendOneWsmpPacket(), ns3::dot11s::HwmpProtocol::SendProactivePreq(), ns3::StaWifiMac::SendProbeRequest(), WaveNetDeviceExample::SendWsaExample(), ns3::dot11s::PeerLink::StateMachine(), and ns3::flame::FlameProtocolMac::UpdateOutcomingFrame().
|
static |
address | base IPv4 address |
Definition at line 225 of file mac48-address.cc.
References CopyFrom(), CopyTo(), GetMulticastPrefix(), NS_LOG_FUNCTION, and ns3::Ipv4Address::Serialize().
Referenced by ns3::LteNetDevice::GetMulticast(), ns3::AlohaNoackNetDevice::GetMulticast(), ns3::BridgeNetDevice::GetMulticast(), ns3::CsmaNetDevice::GetMulticast(), ns3::FdNetDevice::GetMulticast(), ns3::LoopbackNetDevice::GetMulticast(), ns3::MeshPointDevice::GetMulticast(), ns3::SimpleNetDevice::GetMulticast(), ns3::MockNetDevice::GetMulticast(), ns3::TapBridge::GetMulticast(), ns3::WaveNetDevice::GetMulticast(), ns3::WifiNetDevice::GetMulticast(), and ns3::WimaxNetDevice::GetMulticast().
|
static |
Get multicast address from IPv6 address.
address | base IPv6 address |
Definition at line 263 of file mac48-address.cc.
References CopyFrom(), CopyTo(), GetMulticast6Prefix(), NS_LOG_FUNCTION, and ns3::Ipv6Address::Serialize().
|
static |
Get the multicast prefix for IPv6 (33:33:00:00:00:00).
Definition at line 217 of file mac48-address.cc.
References Mac48Address(), and NS_LOG_FUNCTION_NOARGS.
Referenced by GetMulticast().
|
static |
Definition at line 209 of file mac48-address.cc.
References Mac48Address(), and NS_LOG_FUNCTION_NOARGS.
Referenced by GetMulticast().
|
staticprivate |
Return the Type of address.
Definition at line 179 of file mac48-address.cc.
References NS_LOG_FUNCTION_NOARGS, ns3::Address::Register(), and check-style-clang-format::type.
Referenced by ConvertFrom(), ConvertTo(), and IsMatchingType().
bool ns3::Mac48Address::IsBroadcast | ( | ) | const |
Definition at line 187 of file mac48-address.cc.
References GetBroadcast(), and NS_LOG_FUNCTION.
Referenced by MeshTest::CreateNodes(), ns3::TapBridge::CreateTap(), ns3::MeshPointDevice::DoSend(), ns3::FdNetDevice::ForwardUp(), ns3::WaveNetDevice::ForwardUp(), ns3::WifiNetDevice::ForwardUp(), ns3::MpduAggregator::GetNextAmpdu(), ns3::QosTxop::GetNextMpdu(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::QosTxop::PeekNextMpdu(), ns3::ApWifiMac::Receive(), ns3::CsmaNetDevice::Receive(), ns3::LoopbackNetDevice::Receive(), ns3::SimpleNetDevice::Receive(), ns3::HeFrameExchangeManager::ReceiveMpdu(), and ns3::LoopbackNetDevice::SendFrom().
bool ns3::Mac48Address::IsGroup | ( | ) | const |
Definition at line 194 of file mac48-address.cc.
References m_address, and NS_LOG_FUNCTION.
Referenced by ns3::dot11s::AirtimeLinkMetricCalculator::CalculateMetric(), ns3::ApWifiMac::CanForwardPacketsTo(), MultiLinkOperationsTestBase::CheckAddresses(), ns3::ApWifiMac::ForwardDown(), ns3::FdNetDevice::ForwardUp(), ns3::WaveNetDevice::ForwardUp(), ns3::WifiNetDevice::ForwardUp(), ns3::WifiRemoteStationManager::GetAckTxVector(), ns3::WifiRemoteStationManager::GetAssociationId(), ns3::WifiRemoteStationManager::GetBlockAckTxVector(), ns3::WifiRemoteStationManager::GetCtsTxVector(), ns3::WifiRemoteStationManager::GetDataTxVector(), ns3::MacTxMiddle::GetNextSequenceNumberFor(), ns3::WifiMacQueueContainer::GetQueueId(), ns3::MacRxMiddle::Lookup(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::WifiMacQueue::PeekByTidAndAddress(), ns3::MacTxMiddle::PeekNextSequenceNumberFor(), ns3::MacRxMiddle::Receive(), ns3::OcbWifiMac::Receive(), ns3::ApWifiMac::Receive(), ns3::StaWifiMac::Receive(), ns3::FrameExchangeManager::Receive(), ns3::CsmaNetDevice::Receive(), ns3::LoopbackNetDevice::Receive(), ns3::SimpleNetDevice::Receive(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::WifiRemoteStationManager::ReportDataOk(), ns3::WifiRemoteStationManager::ReportFinalRtsFailed(), ns3::WifiRemoteStationManager::ReportRtsFailed(), ns3::WifiRemoteStationManager::ReportRtsOk(), ns3::BridgeNetDevice::SendFrom(), ns3::VsaManager::SendVsa(), ns3::MacTxMiddle::SetSequenceNumberFor(), ns3::HtFrameExchangeManager::StartFrameExchange(), ns3::WifiDefaultAckManager::TryAddMpdu(), and ns3::dot11s::PeerManagementProtocolMac::UpdateOutcomingFrame().
|
static |
address | address to test |
Definition at line 122 of file mac48-address.cc.
References first::address, GetType(), and NS_LOG_FUNCTION.
Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::MeshPointDevice::AddInterface(), ns3::SixLowPanNetDevice::DoSend(), ns3::SixLowPanNetDevice::Get16MacFrom48Mac(), ns3::MockNetDevice::GetBroadcast(), ns3::MockNetDevice::GetMulticast(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::Ipv6AddressHelper::NewAddress(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::LrWpanNetDevice::Send(), ns3::WifiNetDevice::Send(), ns3::WifiNetDevice::SendFrom(), ns3::LrWpanNetDevice::SetAddress(), and ns3::TapBridge::SetBridgedNetDevice().
ns3::Mac48Address::operator Address | ( | ) | const |
Convert an instance of this class to a polymorphic Address instance.
Definition at line 128 of file mac48-address.cc.
|
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
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 172 of file mac48-address.cc.
References m_allocationIndex, and NS_LOG_FUNCTION_NOARGS.
Referenced by Allocate().
|
friend |
Not equal to operator.
a | the first operand |
b | the first operand |
Definition at line 228 of file mac48-address.h.
|
friend |
Less than operator.
a | the first operand |
b | the first operand |
Definition at line 233 of file mac48-address.h.
|
friend |
Stream insertion operator.
os | the stream |
address | the address |
Definition at line 285 of file mac48-address.cc.
|
friend |
Equal to operator.
a | the first operand |
b | the first operand |
Definition at line 222 of file mac48-address.h.
|
friend |
Stream extraction operator.
is | the stream |
address | the address |
Definition at line 305 of file mac48-address.cc.
|
private |
address value
Definition at line 216 of file mac48-address.h.
Referenced by Mac48Address(), ConvertFrom(), ConvertTo(), CopyFrom(), CopyTo(), and IsGroup().
|
staticprivate |
Address allocation index.
Definition at line 215 of file mac48-address.h.
Referenced by Allocate(), and ResetAllocationIndex().