22 #include "ns3/address.h" 23 #include "ns3/assert.h" 35 #define ASCII_a (0x41) 36 #define ASCII_z (0x5a) 37 #define ASCII_A (0x61) 38 #define ASCII_Z (0x7a) 39 #define ASCII_COLON (0x3a) 40 #define ASCII_ZERO (0x30) 70 while (*str != 0 && i < 2)
129 address.CopyTo (retval.m_address);
143 static uint64_t
id = 0;
146 address.m_address[0] = (
id >> 8) & 0xff;
147 address.m_address[1] = (
id >> 0) & 0xff;
164 os.setf (std::ios::hex, std::ios::basefield);
166 for (uint8_t i = 0; i < 1; i++)
168 os << std::setw (2) << (uint32_t)ad[i] <<
":";
171 os << std::setw (2) << (uint32_t)ad[1];
172 os.setf (std::ios::dec, std::ios::basefield);
182 std::string::size_type col = 0;
183 for (uint8_t i = 0; i < 2; ++i)
186 std::string::size_type next;
187 next = v.find (
":", col);
188 if (next == std::string::npos)
190 tmp = v.substr (col, v.size ()-col);
191 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
196 tmp = v.substr (col, next-col);
197 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t m_address[2]
address value
static Mac16Address ConvertFrom(const Address &address)
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
Address ConvertTo(void) const
void CopyFrom(const uint8_t buffer[2])
#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.
void CopyTo(uint8_t buffer[2]) const
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
a polymophic address class
static char AsciiToLowCase(char c)
Converts a char to lower case.
static uint8_t GetType(void)
Return the Type of address.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class can contain 16 bit addresses.
static bool IsMatchingType(const Address &address)
static Mac16Address Allocate(void)
Allocate a new Mac16Address.
static uint8_t Register(void)
Allocate a new type id for a new type of address.