21 #include "ns3/address.h"
22 #include "ns3/assert.h"
24 #include "ns3/simulator.h"
37 #define ASCII_a (0x41)
38 #define ASCII_z (0x5a)
39 #define ASCII_A (0x61)
40 #define ASCII_Z (0x7a)
41 #define ASCII_COLON (0x3a)
42 #define ASCII_ZERO (0x30)
79 while (*str != 0 && i < 8)
194 os.setf(std::ios::hex, std::ios::basefield);
196 for (uint8_t i = 0; i < 7; i++)
198 os << std::setw(2) << (uint32_t)ad[i] <<
":";
201 os << std::setw(2) << (uint32_t)ad[7];
202 os.setf(std::ios::dec, std::ios::basefield);
213 std::string::size_type col = 0;
214 for (uint8_t i = 0; i < 8; ++i)
217 std::string::size_type next;
218 next = v.find(
':', col);
219 if (next == std::string::npos)
221 tmp = v.substr(col, v.size() - col);
222 address.m_address[i] = std::stoul(tmp,
nullptr, 16);
227 tmp = v.substr(col, next - col);
228 address.m_address[i] = std::stoul(tmp,
nullptr, 16);
a polymophic address class
static uint8_t Register()
Allocate a new type id for a new type of address.
uint8_t m_address[8]
address value
Address ConvertTo() const
static bool IsMatchingType(const Address &address)
static Mac64Address Allocate()
Allocate a new Mac64Address.
void CopyFrom(const uint8_t buffer[8])
void CopyTo(uint8_t buffer[8]) const
static Mac64Address ConvertFrom(const Address &address)
static void ResetAllocationIndex()
Reset the Mac64Address allocation index.
static uint8_t GetType()
Return the Type of address.
static uint64_t m_allocationIndex
Address allocation index.
static EventId ScheduleDestroy(FUNC f, Ts &&... args)
Schedule an event to run at the end of the simulation, when Simulator::Destroy() is called.
#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.