A class used for addressing MAC8 MAC's. More...
#include "mac8-address.h"
Public Member Functions | |
Mac8Address ()=default | |
Mac8Address (uint8_t addr) | |
Create Mac8Address object with address addr. More... | |
virtual | ~Mac8Address () |
Destructor. More... | |
Address | ConvertTo () const |
Convert to a generic Address. More... | |
void | CopyFrom (const uint8_t *pBuffer) |
Sets address to address stored in parameter. More... | |
void | CopyTo (uint8_t *pBuffer) const |
Writes address to buffer parameter. More... | |
operator Address () const | |
Create a generic Address. More... | |
Static Public Member Functions | |
static Mac8Address | Allocate () |
Allocates Mac8Address from 0-254. More... | |
static Mac8Address | ConvertFrom (const Address &address) |
Convert a generic address to a Mac8Address. More... | |
static Mac8Address | GetBroadcast () |
Get the broadcast address (255). More... | |
static bool | IsMatchingType (const Address &address) |
Check that a generic Address is compatible with Mac8Address. More... | |
static void | ResetAllocationIndex () |
Reset the Mac8Address allocation index. More... | |
Static Private Member Functions | |
static uint8_t | GetType () |
Get the Mac8Address type. More... | |
Private Attributes | |
uint8_t | m_address {255} |
The address. More... | |
Static Private Attributes | |
static uint8_t | m_allocationIndex = 0 |
Address allocation index. More... | |
Friends | |
bool | operator!= (const Mac8Address &a, const Mac8Address &b) |
Address comparison, unequal. More... | |
bool | operator< (const Mac8Address &a, const Mac8Address &b) |
Address comparison, less than. More... | |
std::ostream & | operator<< (std::ostream &os, const Mac8Address &address) |
Write address to stream os as 8 bit integer. More... | |
bool | operator== (const Mac8Address &a, const Mac8Address &b) |
Address comparison, equality. More... | |
std::istream & | operator>> (std::istream &is, Mac8Address &address) |
Read address from stream is as 8 bit integer. More... | |
A class used for addressing MAC8 MAC's.
This implementation uses a simple 8 bit flat addressing scheme. It is unlikely that perceived underwater networks will soon exceed 200 nodes (or the overlapping of two underwater networks
Definition at line 43 of file mac8-address.h.
|
default |
ns3::Mac8Address::Mac8Address | ( | uint8_t | addr | ) |
Create Mac8Address object with address addr.
addr | Byte address to assign to this address. |
Definition at line 33 of file mac8-address.cc.
|
virtual |
Destructor.
Definition at line 38 of file mac8-address.cc.
|
static |
Allocates Mac8Address from 0-254.
Will wrap back to 0 if more than 254 are allocated. Excludes the broadcast address.
Definition at line 94 of file mac8-address.cc.
References Mac8Address(), first::address, m_allocationIndex, NS_LOG_FUNCTION_NOARGS, ResetAllocationIndex(), and ns3::Simulator::ScheduleDestroy().
Referenced by ns3::UanHelper::Install().
|
static |
Convert a generic address to a Mac8Address.
address | Address to convert to Mac8Address address. |
Definition at line 56 of file mac8-address.cc.
References first::address, IsMatchingType(), m_address, and NS_ASSERT.
Referenced by ns3::UanMacRc::Associate(), ns3::UanMacRc::AssociateTimeout(), ns3::UanMacRcGw::EndCycle(), ns3::UanMacAloha::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::UanMacRc::Enqueue(), ns3::UanMacRc::IsPhy1Ok(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::Ipv6AddressHelper::NewAddress(), ns3::UanMacCw::PhyRxPacketGood(), ns3::UanMacRc::ProcessAck(), ns3::UanMacRc::ReceiveOkFromPhy(), ns3::UanMacRcGw::ReceivePacket(), ns3::UanMacRc::RtsTimeout(), ns3::UanMacAloha::RxPacketError(), ns3::UanMacRc::ScheduleData(), ns3::UanMacRc::SendPacket(), ns3::UanMacRc::SendRts(), ns3::UanNetDevice::SetAddress(), and ns3::UanMacRcGw::StartCycle().
Address ns3::Mac8Address::ConvertTo | ( | ) | const |
void ns3::Mac8Address::CopyFrom | ( | const uint8_t * | pBuffer | ) |
Sets address to address stored in parameter.
pBuffer | Buffer to extract address from. |
Definition at line 76 of file mac8-address.cc.
References m_address.
void ns3::Mac8Address::CopyTo | ( | uint8_t * | pBuffer | ) | const |
Writes address to buffer parameter.
pBuffer |
Definition at line 82 of file mac8-address.cc.
References m_address.
Referenced by ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::UanHeaderCommon::Serialize(), and ns3::UanHeaderRcCts::Serialize().
|
static |
Get the broadcast address (255).
Definition at line 88 of file mac8-address.cc.
References Mac8Address().
Referenced by ns3::UanMacRc::Associate(), ns3::UanMacRc::AssociateTimeout(), ns3::UanMacCw::PhyRxPacketGood(), ns3::UanMacRc::ReceiveOkFromPhy(), ns3::UanMacRcGw::ReceivePacket(), ns3::UanMacRc::RtsTimeout(), ns3::UanMacAloha::RxPacketGood(), ns3::UanMacRc::SendRts(), and ns3::UanMacRcGw::StartCycle().
|
staticprivate |
Get the Mac8Address type.
Definition at line 43 of file mac8-address.cc.
References ns3::Address::Register(), and check-style-clang-format::type.
Referenced by ConvertTo(), and IsMatchingType().
|
static |
Check that a generic Address is compatible with Mac8Address.
address | Address to test. |
Definition at line 65 of file mac8-address.cc.
References first::address, and GetType().
Referenced by ConvertFrom(), ns3::MockNetDevice::IsBroadcast(), ns3::MockNetDevice::IsMulticast(), ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), and ns3::Ipv6AddressHelper::NewAddress().
ns3::Mac8Address::operator Address | ( | ) | const |
|
static |
Reset the Mac8Address 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 113 of file mac8-address.cc.
References m_allocationIndex, and NS_LOG_FUNCTION_NOARGS.
Referenced by Allocate().
|
friend |
Address comparison, unequal.
a | First address to compare. |
b | Second address to compare. |
Definition at line 133 of file mac8-address.cc.
|
friend |
Address comparison, less than.
a | First address to compare. |
b | Second address to compare. |
Definition at line 120 of file mac8-address.cc.
|
friend |
Write address to stream os as 8 bit integer.
os | The output stream. |
address | The address |
Definition at line 138 of file mac8-address.cc.
|
friend |
Address comparison, equality.
a | First address to compare. |
b | Second address to compare. |
Definition at line 127 of file mac8-address.cc.
|
friend |
Read address from stream is as 8 bit integer.
is | The input stream. |
address | The address variable to set. |
Definition at line 146 of file mac8-address.cc.
|
private |
The address.
Definition at line 134 of file mac8-address.h.
Referenced by ConvertFrom(), ConvertTo(), CopyFrom(), and CopyTo().
|
staticprivate |
Address allocation index.
Definition at line 133 of file mac8-address.h.
Referenced by Allocate(), and ResetAllocationIndex().