21 #include "ns3/address.h"
22 #include "ns3/assert.h"
34 #define ASCII_a (0x41)
35 #define ASCII_z (0x5a)
36 #define ASCII_A (0x61)
37 #define ASCII_Z (0x7a)
38 #define ASCII_COLON (0x3a)
39 #define ASCII_ZERO (0x30)
64 while (*str != 0 && i < 6)
126 address.
CopyTo (retval.m_address);
133 static uint64_t
id = 0;
136 address.
m_address[0] = (
id >> 40) & 0xff;
137 address.
m_address[1] = (
id >> 32) & 0xff;
138 address.
m_address[2] = (
id >> 24) & 0xff;
139 address.
m_address[3] = (
id >> 16) & 0xff;
195 uint8_t etherBuffer[6];
196 etherAddr.
CopyTo (etherBuffer);
210 etherBuffer[3] |= ipBuffer[1] & 0x7f;
211 etherBuffer[4] = ipBuffer[2];
212 etherBuffer[5] = ipBuffer[3];
226 uint8_t etherBuffer[6];
227 uint8_t ipBuffer[16];
231 etherAddr.
CopyTo (etherBuffer);
234 etherBuffer[2] = ipBuffer[12];
235 etherBuffer[3] = ipBuffer[13];
236 etherBuffer[4] = ipBuffer[14];
237 etherBuffer[5] = ipBuffer[15];
249 os.setf (std::ios::hex, std::ios::basefield);
251 for (uint8_t i=0; i < 5; i++)
253 os << std::setw (2) << (uint32_t)ad[i] <<
":";
256 os << std::setw (2) << (uint32_t)ad[5];
257 os.setf (std::ios::dec, std::ios::basefield);
266 std::istringstream iss;
269 iss >> std::hex >> retval >> std::dec;
278 std::string::size_type col = 0;
279 for (uint8_t i = 0; i < 6; ++i)
282 std::string::size_type next;
283 next = v.find (
":", col);
284 if (next == std::string::npos)
286 tmp = v.substr (col, v.size ()-col);
292 tmp = v.substr (col, next-col);
static bool IsMatchingType(const Address &address)
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
#define NS_LOG_FUNCTION(parameters)
static Mac48Address GetMulticastPrefix(void)
#define NS_ASSERT(condition)
bool IsBroadcast(void) const
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static uint8_t AsInt(std::string v)
a polymophic address class
bool CheckCompatible(uint8_t type, uint8_t len) const
static char AsciiToLowCase(char c)
void CopyTo(uint8_t buffer[6]) const
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
static Mac48Address GetMulticast(Ipv4Address address)
static Mac48Address GetBroadcast(void)
void Serialize(uint8_t buf[4]) const
Serialize this address to a 4-byte buffer.
static Mac48Address ConvertFrom(const Address &address)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
static uint8_t GetType(void)
void CopyFrom(const uint8_t buffer[6])
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
#define ASCII_a
Macro to make help make class an ns-3 attribute.
ATTRIBUTE_HELPER_CPP(ObjectFactory)
static Mac48Address GetMulticast6Prefix(void)
Get the multicast prefix for IPv6 (33:33:00:00:00:00).
Address ConvertTo(void) const
NS_LOG_COMPONENT_DEFINE("Mac48Address")
static uint8_t Register(void)
Allocate a new type id for a new type of address.
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.