A Discrete-Event Network Simulator
API
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
ns3::Mac8Address Class Reference

A class used for addressing MAC8 MAC's. More...

#include "mac8-address.h"

Public Member Functions

 Mac8Address ()
 Constructor. More...
 
 Mac8Address (uint8_t addr)
 Create Mac8Address object with address addr. More...
 
virtual ~Mac8Address ()
 Destructor. 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 (void)
 Get the broadcast address (255). More...
 
static bool IsMatchingType (const Address &address)
 Check that a generic Address is compatible with Mac8Address. More...
 

Private Member Functions

Address ConvertTo (void) const
 Convert to a generic Address. More...
 

Static Private Member Functions

static uint8_t GetType (void)
 Get the Mac8Address type. More...
 

Private Attributes

uint8_t m_address
 The address. 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, equalit. More...
 
std::istream & operator>> (std::istream &is, Mac8Address &address)
 Read address from stream is as 8 bit integer. More...
 

Detailed Description

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 42 of file mac8-address.h.

Constructor & Destructor Documentation

◆ Mac8Address() [1/2]

ns3::Mac8Address::Mac8Address ( )

Constructor.

Definition at line 26 of file mac8-address.cc.

References m_address.

Referenced by Allocate(), and GetBroadcast().

◆ Mac8Address() [2/2]

ns3::Mac8Address::Mac8Address ( uint8_t  addr)

Create Mac8Address object with address addr.

Parameters
addrByte address to assign to this address.

Definition at line 31 of file mac8-address.cc.

◆ ~Mac8Address()

ns3::Mac8Address::~Mac8Address ( )
virtual

Destructor.

Definition at line 36 of file mac8-address.cc.

Member Function Documentation

◆ Allocate()

Mac8Address ns3::Mac8Address::Allocate ( void  )
static

Allocates Mac8Address from 0-254.

Will wrap back to 0 if more than 254 are allocated. Excludes the broadcast address.

Returns
The next sequential Mac8Address.

Definition at line 92 of file mac8-address.cc.

References first::address, and Mac8Address().

Referenced by ns3::UanHelper::Install().

◆ ConvertFrom()

Mac8Address ns3::Mac8Address::ConvertFrom ( const Address address)
static

◆ ConvertTo()

Address ns3::Mac8Address::ConvertTo ( void  ) const
private

Convert to a generic Address.

Returns
The Address value.

Definition at line 48 of file mac8-address.cc.

References GetType(), and m_address.

◆ CopyFrom()

void ns3::Mac8Address::CopyFrom ( const uint8_t *  pBuffer)

Sets address to address stored in parameter.

Parameters
pBufferBuffer to extract address from.

Definition at line 74 of file mac8-address.cc.

References m_address.

◆ CopyTo()

void ns3::Mac8Address::CopyTo ( uint8_t *  pBuffer) const

◆ GetBroadcast()

Mac8Address ns3::Mac8Address::GetBroadcast ( void  )
static

◆ GetType()

uint8_t ns3::Mac8Address::GetType ( void  )
staticprivate

Get the Mac8Address type.

Returns
The type value.

Definition at line 41 of file mac8-address.cc.

References ns3::Address::Register().

Referenced by ConvertTo(), and IsMatchingType().

◆ IsMatchingType()

bool ns3::Mac8Address::IsMatchingType ( const Address address)
static

Check that a generic Address is compatible with Mac8Address.

Parameters
addressAddress to test.
Returns
True if address given is consistent with Mac8Address.

Definition at line 63 of file mac8-address.cc.

References first::address, and GetType().

Referenced by ConvertFrom(), ns3::Ipv6Interface::DoSetup(), ns3::SixLowPanNetDevice::MakeLinkLocalAddressFromMac(), and ns3::Ipv6AddressHelper::NewAddress().

◆ operator Address()

ns3::Mac8Address::operator Address ( ) const

Create a generic Address.

Returns
The Address.

Definition at line 68 of file mac8-address.cc.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Mac8Address a,
const Mac8Address b 
)
friend

Address comparison, unequal.

Parameters
aFirst address to compare.
bSecond address to compare.
Returns
True if a != b.

Definition at line 118 of file mac8-address.cc.

◆ operator<

bool operator< ( const Mac8Address a,
const Mac8Address b 
)
friend

Address comparison, less than.

Parameters
aFirst address to compare.
bSecond address to compare.
Returns
True if a < b.

Definition at line 106 of file mac8-address.cc.

◆ operator<<

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

Write address to stream os as 8 bit integer.

Parameters
osThe output stream.
addressThe address
Returns
The output stream.

Definition at line 124 of file mac8-address.cc.

◆ operator==

bool operator== ( const Mac8Address a,
const Mac8Address b 
)
friend

Address comparison, equalit.

Parameters
aFirst address to compare.
bSecond address to compare.
Returns
True if a == b.

Definition at line 112 of file mac8-address.cc.

◆ operator>>

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

Read address from stream is as 8 bit integer.

Parameters
isThe input stream.
addressThe address variable to set.
Returns
The input stream.

Definition at line 130 of file mac8-address.cc.

Member Data Documentation

◆ m_address

uint8_t ns3::Mac8Address::m_address
private

The address.

Definition at line 112 of file mac8-address.h.

Referenced by ConvertFrom(), ConvertTo(), CopyFrom(), CopyTo(), Mac8Address(), ns3::operator<(), and ns3::operator==().


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