network: Add Mac16Address constructor
This commit is contained in:
@@ -104,6 +104,12 @@ Mac16Address::Mac16Address(const char* str)
|
||||
NS_ASSERT(i == 2);
|
||||
}
|
||||
|
||||
Mac16Address::Mac16Address(uint16_t addr)
|
||||
{
|
||||
m_address[1] = addr & 0xFF;
|
||||
m_address[0] = (addr >> 8) & 0xFF;
|
||||
}
|
||||
|
||||
void
|
||||
Mac16Address::CopyFrom(const uint8_t buffer[2])
|
||||
{
|
||||
|
||||
@@ -50,24 +50,34 @@ class Mac16Address
|
||||
*/
|
||||
Mac16Address(const char* str);
|
||||
|
||||
/**
|
||||
* \param addr The 16 bit integer used to create a Mac16Address object.
|
||||
*
|
||||
* Create a Mac16Address from an 16 bit integer.
|
||||
*/
|
||||
Mac16Address(uint16_t addr);
|
||||
|
||||
/**
|
||||
* \param buffer address in network order
|
||||
*
|
||||
* Copy the input address to our internal buffer.
|
||||
*/
|
||||
void CopyFrom(const uint8_t buffer[2]);
|
||||
|
||||
/**
|
||||
* \param buffer address in network order
|
||||
*
|
||||
* Copy the internal address to the input buffer.
|
||||
*/
|
||||
void CopyTo(uint8_t buffer[2]) const;
|
||||
|
||||
/**
|
||||
* \returns a new Address instance
|
||||
*
|
||||
* Convert an instance of this class to a polymorphic Address instance.
|
||||
*/
|
||||
operator Address() const;
|
||||
|
||||
/**
|
||||
* \param address a polymorphic address
|
||||
* \returns a new Mac16Address from the polymorphic address
|
||||
@@ -77,6 +87,7 @@ class Mac16Address
|
||||
* Mac16Address.
|
||||
*/
|
||||
static Mac16Address ConvertFrom(const Address& address);
|
||||
|
||||
/**
|
||||
* \returns a new Address instance
|
||||
*
|
||||
@@ -89,6 +100,7 @@ class Mac16Address
|
||||
* \returns true if the address matches, false otherwise.
|
||||
*/
|
||||
static bool IsMatchingType(const Address& address);
|
||||
|
||||
/**
|
||||
* Allocate a new Mac16Address.
|
||||
* \returns newly allocated mac16Address
|
||||
|
||||
Reference in New Issue
Block a user