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::Mac16Address Class Reference

This class can contain 16 bit addresses. More...

#include "mac16-address.h"

Public Member Functions

 Mac16Address ()
 
 Mac16Address (const char *str)
 
void CopyFrom (const uint8_t buffer[2])
 
void CopyTo (uint8_t buffer[2]) const
 
 operator Address () const
 

Static Public Member Functions

static Mac16Address Allocate (void)
 Allocate a new Mac16Address. More...
 
static Mac16Address ConvertFrom (const Address &address)
 
static bool IsMatchingType (const Address &address)
 

Private Member Functions

Address ConvertTo (void) const
 

Static Private Member Functions

static uint8_t GetType (void)
 Return the Type of address. More...
 

Private Attributes

uint8_t m_address [2]
 address value More...
 

Friends

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

Detailed Description

This class can contain 16 bit addresses.

See also
Mac16Address Attribute

Definition at line 41 of file mac16-address.h.

Constructor & Destructor Documentation

◆ Mac16Address() [1/2]

ns3::Mac16Address::Mac16Address ( )

Definition at line 60 of file mac16-address.cc.

References m_address, and NS_LOG_FUNCTION.

◆ Mac16Address() [2/2]

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

Definition at line 66 of file mac16-address.cc.

References ASCII_a, ASCII_COLON, ASCII_ZERO, ns3::AsciiToLowCase(), m_address, NS_ASSERT, and NS_LOG_FUNCTION.

Member Function Documentation

◆ Allocate()

Mac16Address ns3::Mac16Address::Allocate ( void  )
static

Allocate a new Mac16Address.

Returns
newly allocated mac16Address

Definition at line 140 of file mac16-address.cc.

References first::address, and NS_LOG_FUNCTION_NOARGS.

◆ ConvertFrom()

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

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

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

References first::address, GetType(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::Ipv6Interface::DoSetup(), ns3::SixLowPanNetDevice::MakeGlobalAddressFromMac(), ns3::SixLowPanNetDevice::MakeLinkLocalAddressFromMac(), ns3::Ipv6AddressHelper::NewAddress(), ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress(), ns3::LrWpanNetDevice::Send(), and ns3::LrWpanNetDevice::SetAddress().

◆ ConvertTo()

Address ns3::Mac16Address::ConvertTo ( void  ) const
private
Returns
a new Address instance

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

Definition at line 133 of file mac16-address.cc.

References GetType(), m_address, and NS_LOG_FUNCTION.

◆ CopyFrom()

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

Copy the input address to our internal buffer.

Definition at line 99 of file mac16-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::ReadFrom().

◆ CopyTo()

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

Copy the internal address to the input buffer.

Definition at line 105 of file mac16-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), and ns3::WriteTo().

◆ GetType()

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

Return the Type of address.

Returns
type of address

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

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

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

◆ IsMatchingType()

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

◆ operator Address()

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

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

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

Friends And Related Function Documentation

◆ operator!=

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

Not equal to operator.

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

Definition at line 157 of file mac16-address.h.

◆ operator<

bool operator< ( const Mac16Address a,
const Mac16Address 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 161 of file mac16-address.h.

◆ operator<<

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

Stream insertion operator.

Parameters
osthe stream
addressthe address
Returns
a reference to the stream

Definition at line 159 of file mac16-address.cc.

◆ operator==

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

Equal to operator.

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

Definition at line 153 of file mac16-address.h.

◆ operator>>

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

Stream extraction operator.

Parameters
isthe stream
addressthe address
Returns
a reference to the stream

Definition at line 177 of file mac16-address.cc.

Member Data Documentation

◆ m_address

uint8_t ns3::Mac16Address::m_address[2]
private

address value

Definition at line 148 of file mac16-address.h.

Referenced by ConvertTo(), CopyFrom(), CopyTo(), Mac16Address(), ns3::operator!=(), ns3::operator<(), and ns3::operator==().


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