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;
174 uint8_t ipv6AddrBuf[16];
179 addrBuf[0] = 0x80 | (ipv6AddrBuf[14] & 0x1F);
180 addrBuf[1] = ipv6AddrBuf[15];
185 return multicastAddr;
217 os.setf (std::ios::hex, std::ios::basefield);
219 for (uint8_t i = 0; i < 1; i++)
221 os << std::setw (2) << (uint32_t)ad[i] <<
":";
224 os << std::setw (2) << (uint32_t)ad[1];
225 os.setf (std::ios::dec, std::ios::basefield);
235 std::string::size_type col = 0;
236 for (uint8_t i = 0; i < 2; ++i)
239 std::string::size_type next;
240 next = v.find (
":", col);
241 if (next == std::string::npos)
243 tmp = v.substr (col, v.size ()-col);
244 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
249 tmp = v.substr (col, next-col);
250 address.m_address[i] = strtoul (tmp.c_str(), 0, 16);
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
bool IsBroadcast(void) const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
#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
static Mac16Address GetBroadcast(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class can contain 16 bit addresses.
bool IsMulticast(void) const
Checks if the address is a multicast address according to RFC 4944 Section 9 (i.e., if its first 3 bits are 100).
Describes an IPv6 address.
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 Mac16Address Allocate(void)
Allocate a new Mac16Address.
static uint8_t Register(void)
Allocate a new type id for a new type of address.