10#include "ns3/address.h"
11#include "ns3/assert.h"
13#include "ns3/simulator.h"
33 unsigned int bytes[6];
37 "%02x:%02x:%02x:%02x:%02x:%02x%n",
47 std::copy(std::begin(bytes), std::end(bytes), std::begin(
m_address));
68 return address.CheckCompatible(
GetType(), 6);
89 address.CopyTo(
retval.m_address);
234 os.setf(std::ios::hex, std::ios::basefield);
236 for (uint8_t
i = 0;
i < 5;
i++)
242 os.setf(std::ios::dec, std::ios::basefield);
253 std::string::size_type
col = 0;
254 for (uint8_t
i = 0;
i < 6; ++
i)
257 std::string::size_type next;
258 next = v.find(
':',
col);
259 if (next == std::string::npos)
262 address.m_address[
i] = std::stoul(
tmp,
nullptr, 16);
268 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.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.
static Mac48Address GetMulticast(Ipv4Address address)
static void ResetAllocationIndex()
Reset the Mac48Address allocation index.
static bool IsMatchingType(const Address &address)
void CopyFrom(const uint8_t buffer[6])
static uint8_t GetType()
Return the Type of address.
static Mac48Address ConvertFrom(const Address &address)
uint8_t m_address[6]
Address value.
static Mac48Address GetBroadcast()
static Mac48Address Allocate()
Allocate a new Mac48Address.
static Mac48Address GetMulticast6Prefix()
Get the multicast prefix for IPv6 (33:33:00:00:00:00).
void CopyTo(uint8_t buffer[6]) const
static Mac48Address GetMulticastPrefix()
static uint64_t m_allocationIndex
Address allocation index.
Address ConvertTo() const
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_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
#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 ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::istream & operator>>(std::istream &is, Angles &a)