22#include "ns3/address.h"
23#include "ns3/assert.h"
25#include "ns3/simulator.h"
42#define ASCII_COLON (0x3a)
43#define ASCII_ZERO (0x30)
79 while (*str != 0 && i < 2)
203 uint8_t ipv6AddrBuf[16];
208 addrBuf[0] = 0x80 | (ipv6AddrBuf[14] & 0x1F);
209 addrBuf[1] = ipv6AddrBuf[15];
214 return multicastAddr;
247 os.setf(std::ios::hex, std::ios::basefield);
249 for (uint8_t i = 0; i < 1; i++)
251 os << std::setw(2) << (
uint32_t)ad[i] <<
":";
254 os << std::setw(2) << (
uint32_t)ad[1];
255 os.setf(std::ios::dec, std::ios::basefield);
266 std::string::size_type col = 0;
267 for (uint8_t i = 0; i < 2; ++i)
270 std::string::size_type next;
271 next = v.find(
':', col);
272 if (next == std::string::npos)
274 tmp = v.substr(col, v.size() - col);
275 address.m_address[i] = std::stoul(tmp,
nullptr, 16);
280 tmp = v.substr(col, next - col);
281 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.
Describes an IPv6 address.
This class can contain 16 bit addresses.
static Mac16Address GetMulticast(Ipv6Address address)
Returns the multicast address associated with an IPv6 address according to RFC 4944 Section 9.
static bool IsMatchingType(const Address &address)
static uint64_t m_allocationIndex
Address allocation index.
static Mac16Address ConvertFrom(const Address &address)
void CopyTo(uint8_t buffer[2]) const
static Mac16Address Allocate()
Allocate a new Mac16Address.
Address ConvertTo() const
void CopyFrom(const uint8_t buffer[2])
bool IsMulticast() const
Checks if the address is a multicast address according to RFC 4944 Section 9 (i.e....
uint8_t m_address[2]
address value
static void ResetAllocationIndex()
Reset the Mac16Address allocation index.
static Mac16Address GetBroadcast()
bool IsBroadcast() const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
static uint8_t GetType()
Return the Type of address.
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.
std::ostream & operator<<(std::ostream &os, const Angles &a)
ATTRIBUTE_HELPER_CPP(Length)
std::istream & operator>>(std::istream &is, Angles &a)
static char AsciiToLowCase(char c)
Converts a char to lower case.