A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::UanAddress Class Reference

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

#include <uan-address.h>

Public Member Functions

 UanAddress ()
 Constructor. More...
 
 UanAddress (uint8_t addr)
 Create UanAddress object with address addr. More...
 
virtual ~UanAddress ()
 Destructor. More...
 
void CopyFrom (const uint8_t *pBuffer)
 Sets address to address stored in parameter. More...
 
void CopyTo (uint8_t *pBuffer)
 Writes address to buffer parameter. More...
 
uint8_t GetAsInt (void) const
 Convert to integer. More...
 
 operator Address () const
 Create a generic Address. More...
 

Static Public Member Functions

static UanAddress Allocate ()
 Allocates UanAddress from 0-254. More...
 
static UanAddress ConvertFrom (const Address &address)
 Convert a generic address to a UanAddress. More...
 
static UanAddress GetBroadcast (void)
 Get the broadcast address (255). More...
 
static bool IsMatchingType (const Address &address)
 Check that a generic Address is compatible with UanAddress. 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 UanAddress type. More...
 

Private Attributes

uint8_t m_address
 The address. More...
 

Friends

bool operator!= (const UanAddress &a, const UanAddress &b)
 Address comparison, unequal. More...
 
bool operator< (const UanAddress &a, const UanAddress &b)
 Address comparison, less than. More...
 
std::ostream & operator<< (std::ostream &os, const UanAddress &address)
 Write address to stream os as 8 bit integer. More...
 
bool operator== (const UanAddress &a, const UanAddress &b)
 Address comparison, equalit. More...
 
std::istream & operator>> (std::istream &is, UanAddress &address)
 Read address from stream is as 8 bit integer. More...
 

Detailed Description

A class used for addressing UAN 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

  • the ocean is big), so this should provide adequate addressing for most applications.

Definition at line 40 of file uan-address.h.

Constructor & Destructor Documentation

ns3::UanAddress::UanAddress ( )

Constructor.

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

References m_address.

Referenced by Allocate(), and GetBroadcast().

+ Here is the caller graph for this function:

ns3::UanAddress::UanAddress ( uint8_t  addr)

Create UanAddress object with address addr.

Parameters
addrByte address to assign to this address.

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

ns3::UanAddress::~UanAddress ( )
virtual

Destructor.

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

Member Function Documentation

UanAddress ns3::UanAddress::Allocate ( void  )
static

Allocates UanAddress from 0-254.

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

Returns
The next sequential UanAddress.

Definition at line 97 of file uan-address.cc.

References first::address, and UanAddress().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Convert a generic address to a UanAddress.

Parameters
addressAddress to convert to UAN address.
Returns
UanAddress from Address.

Definition at line 54 of file uan-address.cc.

References ns3::Address::CopyTo(), IsMatchingType(), m_address, and NS_ASSERT.

Referenced by ns3::UanMacAloha::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::UanMacRc::Enqueue(), ns3::UanMacAloha::RxPacketError(), and ns3::UanNetDevice::SetAddress().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Convert to a generic Address.

Returns
The Address value.

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

References GetType(), and m_address.

+ Here is the call graph for this function:

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

Sets address to address stored in parameter.

Parameters
pBufferBuffer to extract address from.

Definition at line 79 of file uan-address.cc.

References m_address.

void ns3::UanAddress::CopyTo ( uint8_t *  pBuffer)

Writes address to buffer parameter.

Parameters
pBuffer

Definition at line 85 of file uan-address.cc.

References m_address.

uint8_t ns3::UanAddress::GetAsInt ( void  ) const

Convert to integer.

Returns
8 bit integer version of address.

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

References m_address.

Referenced by ns3::UanHeaderCommon::Serialize(), and ns3::UanHeaderRcCts::Serialize().

+ Here is the caller graph for this function:

UanAddress ns3::UanAddress::GetBroadcast ( void  )
static
uint8_t ns3::UanAddress::GetType ( void  )
staticprivate

Get the UanAddress type.

Returns
The type value.

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

References ns3::Address::Register().

Referenced by ConvertTo(), and IsMatchingType().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Check that a generic Address is compatible with UanAddress.

Parameters
addressAddress to test.
Returns
True if address given is consistant with UanAddress.

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

References ns3::Address::CheckCompatible(), and GetType().

Referenced by ConvertFrom().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ns3::UanAddress::operator Address ( ) const

Create a generic Address.

Returns
The Address.

Definition at line 73 of file uan-address.cc.

Friends And Related Function Documentation

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

Address comparison, unequal.

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

Definition at line 123 of file uan-address.cc.

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

Address comparison, less than.

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

Definition at line 111 of file uan-address.cc.

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

Write address to stream os as 8 bit integer.

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

Definition at line 129 of file uan-address.cc.

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

Address comparison, equalit.

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

Definition at line 117 of file uan-address.cc.

std::istream& operator>> ( std::istream &  is,
UanAddress 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 135 of file uan-address.cc.

Member Data Documentation

uint8_t ns3::UanAddress::m_address
private

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