21 #include "ns3/abort.h"
22 #include "ns3/assert.h"
24 #include "ns3/simulation-singleton.h"
95 uint8_t prefix[16] = { 0};
97 for (uint32_t i = 0; i <
N_BITS; ++i)
99 for (uint32_t j = 0; j < 16; ++j)
103 for (uint32_t j = 0; j < 15; ++j)
105 prefix[15 - j] >>= 1;
106 prefix[15 - j] |= (prefix[15 - j - 1] & 1);
109 for (uint32_t j = 0; j < 15; ++j)
114 for (uint32_t j = 0; j < 15; ++j)
119 for (uint32_t j = 0; j < 16; ++j)
148 uint8_t prefixBits[16];
152 uint8_t interfaceIdBits[16];
153 interfaceId.
GetBytes (interfaceIdBits);
166 for (int32_t j = 15 - a; j >= 0; j--)
170 for (uint32_t j = 0; j < a; j++)
174 for (uint32_t j = 15; j >= a; j--)
179 for (int32_t j = 0; j < 16; j++)
195 for (uint32_t j = 0; j < 16 - a; ++j)
199 for (uint32_t j = 16 - a; j < 16; ++j)
203 for (uint32_t j = 0; j < 15; j++)
206 nw[j] |= nw[j + 1] >> (8 - b);
208 nw[15] = nw[15] << b;
221 uint8_t interfaceIdBits[16];
223 for (int32_t j = 0; j < 16; j++)
228 for (int32_t j = 15; j >= 0; j--)
244 for (uint32_t j = 0; j < 16 - a; ++j)
248 for (uint32_t j = 16 - a; j < 16; ++j)
252 for (uint32_t j = 0; j < 15; j++)
255 nw[j] |= nw[j + 1] >> (8 - b);
257 nw[15] = nw[15] << b;
271 uint8_t interfaceIdBits[16];
272 interfaceId.
GetBytes (interfaceIdBits);
274 for (uint32_t j = 0; j < 16; ++j)
290 for (uint32_t j = 0; j < 16 - a; ++j)
294 for (uint32_t j = 16 - a; j < 16; ++j)
298 for (uint32_t j = 0; j < 15; j++)
301 nw[j] |= nw[j + 1] >> (8 - b);
303 nw[15] = nw[15] << b;
304 for (uint32_t j = 0; j < 16; j++)
322 for (uint32_t j = 0; j < 16 - a; ++j)
326 for (uint32_t j = 16 - a; j < 16; ++j)
330 for (uint32_t j = 0; j < 15; j++)
333 ad[j] |= ad[j + 1] >> (8 - b);
335 ad[15] = ad[15] << b;
336 for (uint32_t j = 0; j < 16; j++)
342 for (int32_t j = 15; j >= 0; j--)
371 std::list<Entry>::iterator i;
398 for (uint32_t j = 0; j < 16; j++)
400 taddr[j] = (*i).addrLow[j];
414 for (uint32_t j = 0; j < 16; j++)
416 taddr[j] = (*i).addrLow[j];
421 std::list<Entry>::iterator j = i;
439 for (uint32_t j = 0; j < 16; j++)
441 (*i).addrHigh[j] = addr[j];
452 for (uint32_t j = 0; j < 16; j++)
454 taddr[j] = (*i).addrLow[j];
460 for (uint32_t j = 0; j < 16; j++)
462 (*i).addrLow[j] = addr[j];
469 for (uint32_t j = 0; j < 16; j++)
498 uint8_t prefixBits[16];
501 for (int32_t i = 15; i >= 0; --i)
503 for (uint32_t j = 0; j < 8; ++j)
505 if (prefixBits[i] & 1)
507 uint32_t index =
N_BITS - (15 - i) * 8 - j;
514 NS_ASSERT_MSG (
false,
"Ipv6AddressGenerator::PrefixToIndex(): Impossible");
527 ->Init (net, prefix, interfaceId);
536 ->NextNetwork (prefix);
545 ->GetNetwork (prefix);
556 ->InitAddress (interfaceId, prefix);
565 ->GetAddress (prefix);
574 ->NextAddress (prefix);
592 ->AddAllocated (addr);