21 #include "ns3/address.h"
22 #include "ns3/assert.h"
34 #define ASCII_a (0x41)
35 #define ASCII_z (0x5a)
36 #define ASCII_A (0x61)
37 #define ASCII_Z (0x7a)
38 #define ASCII_COLON (0x3a)
39 #define ASCII_ZERO (0x30)
69 while (*str != 0 && i < 8)
140 static uint64_t
id = 0;
143 address.m_address[0] = (
id >> 56) & 0xff;
144 address.m_address[1] = (
id >> 48) & 0xff;
145 address.m_address[2] = (
id >> 40) & 0xff;
146 address.m_address[3] = (
id >> 32) & 0xff;
147 address.m_address[4] = (
id >> 24) & 0xff;
148 address.m_address[5] = (
id >> 16) & 0xff;
149 address.m_address[6] = (
id >> 8) & 0xff;
150 address.m_address[7] = (
id >> 0) & 0xff;
166 os.setf (std::ios::hex, std::ios::basefield);
168 for (uint8_t i=0; i < 7; i++)
170 os << std::setw (2) << (uint32_t)ad[i] <<
":";
173 os << std::setw (2) << (uint32_t)ad[7];
174 os.setf (std::ios::dec, std::ios::basefield);
184 std::string::size_type col = 0;
185 for (uint8_t i = 0; i < 8; ++i)
188 std::string::size_type next;
189 next = v.find (
":", col);
190 if (next == std::string::npos)
192 tmp = v.substr (col, v.size ()-col);
193 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
198 tmp = v.substr (col, next-col);
199 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
a polymophic address class
static uint8_t Register(void)
Allocate a new type id for a new type of address.
uint8_t m_address[8]
address value
Address ConvertTo(void) const
static bool IsMatchingType(const Address &address)
void CopyFrom(const uint8_t buffer[8])
static Mac64Address Allocate(void)
Allocate a new Mac64Address.
void CopyTo(uint8_t buffer[8]) const
static Mac64Address ConvertFrom(const Address &address)
static uint8_t GetType(void)
Return the Type of address.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ATTRIBUTE_HELPER_CPP(Length)
std::istream & operator>>(std::istream &is, Angles &a)
std::ostream & operator<<(std::ostream &os, const Angles &a)
static char AsciiToLowCase(char c)
Converts a char to lower case.