A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-address.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2008 Louis Pasteur University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#ifndef IPV6_ADDRESS_H
10#define IPV6_ADDRESS_H
11
12#include "ipv4-address.h"
13#include "mac8-address.h"
14
15#include "ns3/address.h"
16#include "ns3/attribute-helper.h"
17#include "ns3/deprecated.h"
18
19#include <array>
20#include <compare>
21#include <cstring>
22#include <optional>
23#include <ostream>
24#include <stdint.h>
25
26namespace ns3
27{
28
29class Ipv6Prefix;
30class Mac16Address;
31class Mac48Address;
32class Mac64Address;
33
34/**
35 * @ingroup address
36 * @class Ipv6Address
37 * @brief Describes an IPv6 address.
38 * @see Ipv6Prefix
39 * @see attribute_Ipv6Address
40 */
42{
43 public:
44 /// Address length when converted to an Address [bytes].
45 static constexpr uint8_t ADDRESS_LENGTH = 16;
46
47 /**
48 * @brief Default constructor.
49 */
50 Ipv6Address() = default;
51
52 /**
53 * @brief Constructs an Ipv6Address by parsing the input C-string.
54 * @param address the C-string containing the IPv6 address (e.g. 2001:db8:f00d:cafe::1).
55 */
56 Ipv6Address(const char* address);
57
58 /**
59 * @brief Checks if the string contains an Ipv6Address
60 *
61 * Input address is in format:
62 * \c 2001:db8:f00d:cafe::1
63 *
64 * Note: the function uses ``inet_pton`` internally.
65 *
66 * @see Address::CheckCompatible which has a similar name but which
67 * instead checks the underlying type and length embedded in the Address.
68 *
69 * @param addressStr string containing the address as described above
70 * @return true if the string can be parsed as an IPv6 address
71 */
72 static bool CheckCompatible(const std::string& addressStr);
73
74 /**
75 * @brief Constructs an Ipv6Address by using the input 16 bytes.
76 * @param address the 128-bit address
77 * @warning the parameter must point on a 16 bytes integer array!
78 */
79 Ipv6Address(uint8_t address[ADDRESS_LENGTH]);
80
81 /**
82 * @brief Sets an Ipv6Address by parsing the input C-string.
83 * @param address the C-string containing the IPv6 address (e.g. 2001:db8:f00d:cafe::1).
84 */
85 void Set(const char* address);
86
87 /**
88 * @brief Set an Ipv6Address by using the input 16 bytes.
89 *
90 * @param address the 128-bit address
91 * @warning the parameter must point on a 16 bytes integer array!
92 */
93 void Set(uint8_t address[ADDRESS_LENGTH]);
94
95 /**
96 * @brief Serialize this address to a 16-byte buffer.
97 * @param buf the output buffer to which this address gets overwritten with this
98 * Ipv6Address
99 */
100 void Serialize(uint8_t buf[ADDRESS_LENGTH]) const;
101
102 /**
103 * @brief Deserialize this address.
104 * @param buf buffer to read address from
105 * @return an Ipv6Address
106 */
107 static Ipv6Address Deserialize(const uint8_t buf[ADDRESS_LENGTH]);
108
109 /**
110 * @brief Make the solicited IPv6 address.
111 * @param addr the IPv6 address
112 * @return Solicited IPv6 address
113 */
115
116 /**
117 * @brief Make the Ipv4-mapped IPv6 address.
118 * @param addr the IPv4 address
119 * @return Ipv4-mapped IPv6 address
120 */
122
123 /**
124 * @brief Return the Ipv4 address.
125 * @return Ipv4 address
126 */
128
129 /**
130 * @brief Make the autoconfigured IPv6 address from a Mac address.
131 *
132 * Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.
133 *
134 * @param addr the MAC address.
135 * @param prefix the IPv6 prefix
136 * @return autoconfigured IPv6 address
137 */
139
140 /**
141 * @brief Make the autoconfigured IPv6 address from a Mac address.
142 *
143 * Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.
144 *
145 * @param addr the MAC address.
146 * @param prefix the IPv6 prefix
147 * @return autoconfigured IPv6 address
148 */
149
151
152 /**
153 * @brief Make the autoconfigured IPv6 address with Mac16Address.
154 *
155 * The EUI-64 scheme used is based on the \RFC{4944}.
156 *
157 * @param addr the MAC address (16 bits).
158 * @param prefix the IPv6 prefix
159 * @return autoconfigured IPv6 address
160 */
162
163 /**
164 * @brief Make the autoconfigured IPv6 address with Mac48Address.
165 *
166 * The EUI-64 scheme used is based on \RFC{2464}.
167 *
168 * @param addr the MAC address (48 bits).
169 * @param prefix the IPv6 prefix
170 * @return autoconfigured IPv6 address
171 */
173
174 /**
175 * @brief Make the autoconfigured IPv6 address with Mac64Address.
176 * @param addr the MAC address (64 bits).
177 * @param prefix the IPv6 prefix
178 * @return autoconfigured IPv6 address
179 */
181
182 /**
183 * @brief Make the autoconfigured IPv6 address with Mac8Address.
184 *
185 * The EUI-64 scheme used is loosely based on the \RFC{2464}.
186 *
187 * @param addr the Mac8Address address (8 bits).
188 * @param prefix the IPv6 prefix
189 * @return autoconfigured IPv6 address
190 */
192
193 /**
194 * @brief Make the autoconfigured link-local IPv6 address from a Mac address.
195 *
196 * Actually the MAC supported are: Mac8, Mac16, Mac48, and Mac64.
197 *
198 * @param mac the MAC address.
199 * @return autoconfigured link-local IPv6 address
200 */
202
203 /**
204 * @brief Make the autoconfigured link-local IPv6 address with Mac16Address.
205 *
206 * The EUI-64 scheme used is based on the \RFC{4944}.
207 *
208 * @param mac the MAC address (16 bits).
209 * @return autoconfigured link-local IPv6 address
210 */
212
213 /**
214 * @brief Make the autoconfigured link-local IPv6 address with Mac48Address.
215 *
216 * The EUI-64 scheme used is based on \RFC{2464}.
217 *
218 * @param mac the MAC address (48 bits).
219 * @return autoconfigured link-local IPv6 address
220 */
222
223 /**
224 * @brief Make the autoconfigured link-local IPv6 address with Mac64Address.
225 * @param mac the MAC address (64 bits).
226 * @return autoconfigured link-local IPv6 address
227 */
229
230 /**
231 * @brief Make the autoconfigured link-local IPv6 address with Mac8Address.
232 *
233 * The EUI-64 scheme used is loosely based on the \RFC{2464}.
234 *
235 * @param mac the MAC address (8 bits).
236 * @return autoconfigured link-local IPv6 address
237 */
239
240 /**
241 * @brief Print this address to the given output stream.
242 *
243 * The print format is in the typical "2001:660:4701::1".
244 * @param os the output stream to which this Ipv6Address is printed
245 */
246 void Print(std::ostream& os) const;
247
248 /**
249 * @brief If the IPv6 address is localhost (::1).
250 * @return true if localhost, false otherwise
251 */
252 bool IsLocalhost() const;
253
254 /**
255 * @brief If the IPv6 address is multicast (ff00::/8).
256 * @return true if multicast, false otherwise
257 */
258 bool IsMulticast() const;
259
260 /**
261 * @brief If the IPv6 address is link-local multicast (ff02::/16).
262 * @return true if link-local multicast, false otherwise
263 */
264 bool IsLinkLocalMulticast() const;
265
266 /**
267 * @brief If the IPv6 address is "all nodes multicast" (ff02::1/8).
268 * @return true if "all nodes multicast", false otherwise
269 */
270 bool IsAllNodesMulticast() const;
271
272 /**
273 * @brief If the IPv6 address is "all routers multicast" (ff02::2/8).
274 * @return true if "all routers multicast", false otherwise
275 */
276 bool IsAllRoutersMulticast() const;
277
278 /**
279 * @brief If the IPv6 address is a link-local address (fe80::/64).
280 * @return true if the address is link-local, false otherwise
281 */
282 bool IsLinkLocal() const;
283
284 /**
285 * @brief If the IPv6 address is a Solicited multicast address.
286 * @return true if it is, false otherwise
287 */
288 bool IsSolicitedMulticast() const;
289
290 /**
291 * @brief If the IPv6 address is the "Any" address.
292 * @return true if it is, false otherwise
293 */
294 bool IsAny() const;
295
296 /**
297 * @brief If the IPv6 address is a documentation address (2001:DB8::/32).
298 * @return true if the address is documentation, false otherwise
299 */
300 bool IsDocumentation() const;
301
302 /**
303 * @brief Compares an address and a prefix.
304 * @param prefix the prefix to compare with
305 * @return true if the address has the given prefix
306 */
307 bool HasPrefix(const Ipv6Prefix& prefix) const;
308
309 /**
310 * @brief Combine this address with a prefix.
311 * @param prefix a IPv6 prefix
312 * @return an IPv6 address that is this address combined
313 * (bitwise AND) with a prefix, yielding an IPv6 network address.
314 */
315 Ipv6Address CombinePrefix(const Ipv6Prefix& prefix) const;
316
317 /**
318 * @brief If the Address matches the type.
319 * @param address other address
320 * @return true if the type matches, false otherwise
321 */
322 static bool IsMatchingType(const Address& address);
323
324 /**
325 * @brief If the address is an IPv4-mapped address
326 * @return true if address is an IPv4-mapped address, otherwise false.
327 */
328 bool IsIpv4MappedAddress() const;
329
330 /**
331 * @brief Convert to Address object
332 */
333 operator Address() const;
334
335 /**
336 * @brief Convert the Address object into an Ipv6Address ones.
337 * @param address address to convert
338 * @return an Ipv6Address
339 */
340 static Ipv6Address ConvertFrom(const Address& address);
341
342 /**
343 * @brief convert the IPv6Address object to an Address object.
344 * @return the Address object corresponding to this object.
345 */
346 Address ConvertTo() const;
347
348 /**
349 * @return true if address is initialized (i.e., set to something), false otherwise
350 */
351 NS_DEPRECATED_3_47("Use IsAny or std::optional")
352 bool IsInitialized() const;
353
354 /**
355 * @brief Get the 0 (::) Ipv6Address.
356 * @return the :: Ipv6Address representation
357 */
358 static Ipv6Address GetZero();
359
360 /**
361 * @brief Get the "any" (::) Ipv6Address.
362 * @return the "any" (::) Ipv6Address
363 */
364 static Ipv6Address GetAny();
365
366 /**
367 * @brief Get the "all nodes multicast" address.
368 * @return the "ff02::2/8" Ipv6Address representation
369 */
371
372 /**
373 * @brief Get the "all routers multicast" address.
374 * @return the "ff02::2/8" Ipv6Address representation
375 */
377
378 /**
379 * @brief Get the "all hosts multicast" address.
380 * @return the "ff02::3/8" Ipv6Address representation
381 */
383
384 /**
385 * @brief Get the loopback address.
386 * @return the "::1/128" Ipv6Address representation.
387 */
388 static Ipv6Address GetLoopback();
389
390 /**
391 * @brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
392 * @return all-1 Ipv6Address representation
393 */
394 static Ipv6Address GetOnes();
395
396 /**
397 * @brief Get the bytes corresponding to the address.
398 * @param buf buffer to store the data
399 */
400 void GetBytes(uint8_t buf[ADDRESS_LENGTH]) const;
401
402 /**
403 * @brief Get the address hash.
404 * @return the address hash
405 */
406 uint32_t GetHash() const;
407
408 /**
409 * @brief Three-way comparison operator.
410 *
411 * @param other the other address to compare with
412 * @returns comparison result
413 */
414 inline constexpr std::strong_ordering operator<=>(const Ipv6Address& other) const
415 {
416 return m_address <=> other.m_address;
417 }
418
419 /**
420 * @brief Equal to operator.
421 *
422 * @param other the other address to compare with
423 * @returns true if the operands are equal.
424 */
425 inline constexpr bool operator==(const Ipv6Address& other) const
426 {
427 return m_address == other.m_address;
428 }
429
430 private:
431 /**
432 * @brief Mix hash keys in-place for lookuphash
433 *
434 * @param a first word of the hash key
435 * @param b second word of the hash key
436 * @param c third word of the hash key
437 */
438 static void MixHashKey(uint32_t& a, uint32_t& b, uint32_t& c);
439
440 /**
441 * @brief Generate and return a hash key.
442 * @return hash
443 * @note Adapted from Jens Jakobsen implementation (chillispot).
444 */
445 uint32_t GenerateHash() const;
446
447 /**
448 * @brief Return the Type of address.
449 * @return type of address
450 */
451 static uint8_t GetType();
452
453 /**
454 * @brief The address representation on 128 bits (16 bytes).
455 */
456 std::array<uint8_t, ADDRESS_LENGTH> m_address{};
457
458 /**
459 * @brief address hash.
460 */
461 mutable std::optional<uint32_t> m_hash;
462};
463
464/**
465 * @ingroup address
466 * @class Ipv6Prefix
467 * @brief Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
468 * @see Ipv6Address
469 * @see attribute_Ipv6Prefix
470 */
472{
473 public:
474 /**
475 * @brief Default constructor.
476 *
477 * The default prefix is empty, corresponding to /0
478 */
479 Ipv6Prefix() = default;
480
481 /**
482 * @brief Constructs an Ipv6Prefix by using the input 16 bytes.
483 *
484 * The prefix length is calculated as the minimum prefix length, i.e.,
485 * 2001:db8:cafe:: will have a 47 bit prefix length (0xE is 0b1110).
486 *
487 * @param prefix the 128-bit prefix
488 */
489 Ipv6Prefix(uint8_t prefix[16]);
490
491 /**
492 * @brief Constructs an Ipv6Prefix by using the input string.
493 *
494 * The prefix length is calculated as the minimum prefix length, i.e.,
495 * 2001:db8:cafe:: will have a 47 bit prefix length.
496 *
497 * @param prefix the 128-bit prefix
498 */
499 Ipv6Prefix(const char* prefix);
500
501 /**
502 * @brief Constructs an Ipv6Prefix by using the input 16 bytes.
503 * @param prefix the 128-bit prefix
504 * @param prefixLength the prefix length
505 */
506 Ipv6Prefix(uint8_t prefix[16], uint8_t prefixLength);
507
508 /**
509 * @brief Constructs an Ipv6Prefix by using the input string.
510 * @param prefix the 128-bit prefix
511 * @param prefixLength the prefix length
512 */
513 Ipv6Prefix(const char* prefix, uint8_t prefixLength);
514
515 /**
516 * @brief Constructs an Ipv6Prefix by using the input number of bits.
517 * @param prefix number of bits of the prefix (0 - 128)
518 * @note A valid number of bits is between 0 and 128).
519 */
520 Ipv6Prefix(uint8_t prefix);
521
522 /**
523 * @brief Check whether two addresses have the same bits in the prefix
524 * portion of their addresses.
525 *
526 * If the prefix length is 0, this method will return true regardless
527 * of the two address argument values. If the prefix length is 128,
528 * this method will require that the two address arguments are the same.
529 *
530 * @param a first address to compare
531 * @param b second address to compare
532 * @return true if both addresses are equal in their masked bits,
533 * corresponding to the prefix length.
534 */
535 bool IsMatch(Ipv6Address a, Ipv6Address b) const;
536
537 /**
538 * @brief Get the bytes corresponding to the prefix.
539 * @param buf buffer to store the data
540 */
541 void GetBytes(uint8_t buf[16]) const;
542
543 /**
544 * @brief Convert the Prefix into an IPv6 Address.
545 * @return an IPv6 address representing the prefix
546 */
548
549 /**
550 * @brief Get prefix length.
551 * @return prefix length
552 */
553 uint8_t GetPrefixLength() const;
554
555 /**
556 * @brief Set prefix length.
557 * @param prefixLength the prefix length
558 */
559 void SetPrefixLength(uint8_t prefixLength);
560
561 /**
562 * @brief Get the minimum prefix length, i.e., 128 - the length of the largest sequence
563 * trailing zeroes.
564 * @return minimum prefix length
565 */
566 uint8_t GetMinimumPrefixLength() const;
567
568 /**
569 * @brief Print this address to the given output stream.
570 *
571 * The print format is in the typical "2001:660:4701::1".
572 * @param os the output stream to which this Ipv6Address is printed
573 */
574 void Print(std::ostream& os) const;
575
576 /**
577 * @brief Get the loopback prefix ( /128).
578 * @return a Ipv6Prefix corresponding to loopback prefix
579 */
580 static Ipv6Prefix GetLoopback();
581
582 /**
583 * @brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
584 * @return /128 Ipv6Prefix representation
585 */
586 static Ipv6Prefix GetOnes();
587
588 /**
589 * @brief Get the zero prefix ( /0).
590 * @return an Ipv6Prefix
591 */
592 static Ipv6Prefix GetZero();
593
594 /**
595 * @brief Three-way comparison operator.
596 *
597 * @param other the other prefix to compare with
598 * @returns comparison result
599 */
600 constexpr std::strong_ordering operator<=>(const Ipv6Prefix& other) const = default;
601
602 private:
603 /**
604 * @brief The prefix representation.
605 */
606 std::array<uint8_t, 16> m_prefix{};
607
608 /**
609 * @brief The prefix length.
610 */
611 uint8_t m_prefixLength{0};
612};
613
616
617/**
618 * @brief Stream insertion operator.
619 *
620 * @param os the reference to the output stream
621 * @param address the Ipv6Address
622 * @returns the reference to the output stream
623 */
624std::ostream& operator<<(std::ostream& os, const Ipv6Address& address);
625
626/**
627 * @brief Stream insertion operator.
628 *
629 * @param os the reference to the output stream
630 * @param prefix the Ipv6Prefix
631 * @returns the reference to the output stream
632 */
633std::ostream& operator<<(std::ostream& os, const Ipv6Prefix& prefix);
634
635/**
636 * @brief Stream extraction operator.
637 *
638 * @param is the reference to the input stream
639 * @param address the Ipv6Address
640 * @returns the reference to the input stream
641 */
642std::istream& operator>>(std::istream& is, Ipv6Address& address);
643
644/**
645 * @brief Stream extraction operator.
646 *
647 * @param is the reference to the input stream
648 * @param prefix the Ipv6Prefix
649 * @returns the reference to the input stream
650 */
651std::istream& operator>>(std::istream& is, Ipv6Prefix& prefix);
652
653/**
654 * @class Ipv6AddressHash
655 * @brief Hash function class for IPv6 addresses.
656 */
657class NS_DEPRECATED_3_47("Unnecessary thanks to std::hash specialization, remove") Ipv6AddressHash
658{
659 public:
660 /**
661 * @brief Returns the hash of an IPv6 address.
662 * @param x IPv6 address to hash
663 * @returns the hash of the address
664 */
665 size_t operator()(const Ipv6Address& x) const;
666};
667
668} /* namespace ns3 */
669
670namespace std
671{
672
673/**
674 * @brief Hash function class for IPv6 addresses.
675 */
676template <>
677struct hash<ns3::Ipv6Address>
678{
679 /**
680 * @brief Returns the hash of an IPv6 address.
681 * @param addr IPv6 address to hash
682 * @returns the hash of the address
683 */
684 size_t operator()(const ns3::Ipv6Address& addr) const
685 {
686 return addr.GetHash();
687 }
688};
689} // namespace std
690
691#endif /* IPV6_ADDRESS_H */
cairo_uint64_t x
_cairo_uint_96by64_32x64_divrem:
a polymophic address class
Definition address.h:114
Ipv4 addresses are stored in host order in this class.
Hash function class for IPv6 addresses.
size_t operator()(const Ipv6Address &x) const
Returns the hash of an IPv6 address.
Describes an IPv6 address.
static uint8_t GetType()
Return the Type of address.
uint32_t GetHash() const
Get the address hash.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
bool HasPrefix(const Ipv6Prefix &prefix) const
Compares an address and a prefix.
bool IsSolicitedMulticast() const
If the IPv6 address is a Solicited multicast address.
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
void Print(std::ostream &os) const
Print this address to the given output stream.
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address.
static void MixHashKey(uint32_t &a, uint32_t &b, uint32_t &c)
Mix hash keys in-place for lookuphash.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
bool IsDocumentation() const
If the IPv6 address is a documentation address (2001:DB8::/32).
static Ipv6Address GetAllHostsMulticast()
Get the "all hosts multicast" address.
constexpr bool operator==(const Ipv6Address &other) const
Equal to operator.
void Serialize(uint8_t buf[ADDRESS_LENGTH]) const
Serialize this address to a 16-byte buffer.
Ipv6Address()=default
Default constructor.
bool IsAllNodesMulticast() const
If the IPv6 address is "all nodes multicast" (ff02::1/8).
static bool CheckCompatible(const std::string &addressStr)
Checks if the string contains an Ipv6Address.
bool IsLinkLocalMulticast() const
If the IPv6 address is link-local multicast (ff02::/16).
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
static Ipv6Address MakeAutoconfiguredAddress(Address addr, Ipv6Address prefix)
Make the autoconfigured IPv6 address from a Mac address.
void GetBytes(uint8_t buf[ADDRESS_LENGTH]) const
Get the bytes corresponding to the address.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
bool IsIpv4MappedAddress() const
If the address is an IPv4-mapped address.
static Ipv6Address Deserialize(const uint8_t buf[ADDRESS_LENGTH])
Deserialize this address.
std::array< uint8_t, ADDRESS_LENGTH > m_address
The address representation on 128 bits (16 bytes).
void Set(const char *address)
Sets an Ipv6Address by parsing the input C-string.
std::optional< uint32_t > m_hash
address hash.
Address ConvertTo() const
convert the IPv6Address object to an Address object.
bool IsAny() const
If the IPv6 address is the "Any" address.
static Ipv6Address GetAllRoutersMulticast()
Get the "all routers multicast" address.
bool IsLocalhost() const
If the IPv6 address is localhost (::1).
static Ipv6Address ConvertFrom(const Address &address)
Convert the Address object into an Ipv6Address ones.
bool IsInitialized() const
static Ipv6Address GetOnes()
Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Address mac)
Make the autoconfigured link-local IPv6 address from a Mac address.
Ipv4Address GetIpv4MappedAddress() const
Return the Ipv4 address.
static bool IsMatchingType(const Address &address)
If the Address matches the type.
static Ipv6Address MakeIpv4MappedAddress(Ipv4Address addr)
Make the Ipv4-mapped IPv6 address.
uint32_t GenerateHash() const
Generate and return a hash key.
static constexpr uint8_t ADDRESS_LENGTH
Address length when converted to an Address [bytes].
static Ipv6Address GetLoopback()
Get the loopback address.
Ipv6Address CombinePrefix(const Ipv6Prefix &prefix) const
Combine this address with a prefix.
bool IsAllRoutersMulticast() const
If the IPv6 address is "all routers multicast" (ff02::2/8).
Describes an IPv6 prefix.
uint8_t m_prefixLength
The prefix length.
std::array< uint8_t, 16 > m_prefix
The prefix representation.
static Ipv6Prefix GetLoopback()
Get the loopback prefix ( /128).
void Print(std::ostream &os) const
Print this address to the given output stream.
uint8_t GetPrefixLength() const
Get prefix length.
Ipv6Address ConvertToIpv6Address() const
Convert the Prefix into an IPv6 Address.
Ipv6Prefix()=default
Default constructor.
static Ipv6Prefix GetZero()
Get the zero prefix ( /0).
bool IsMatch(Ipv6Address a, Ipv6Address b) const
Check whether two addresses have the same bits in the prefix portion of their addresses.
static Ipv6Prefix GetOnes()
Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
void SetPrefixLength(uint8_t prefixLength)
Set prefix length.
constexpr std::strong_ordering operator<=>(const Ipv6Prefix &other) const =default
Three-way comparison operator.
uint8_t GetMinimumPrefixLength() const
Get the minimum prefix length, i.e., 128 - the length of the largest sequence trailing zeroes.
void GetBytes(uint8_t buf[16]) const
Get the bytes corresponding to the prefix.
This class can contain 16 bit addresses.
an EUI-48 address
an EUI-64 address
A class used for addressing MAC8 MAC's.
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type.
#define NS_DEPRECATED_3_47(msg)
Tag for things deprecated in version ns-3.47.
Definition deprecated.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::istream & operator>>(std::istream &is, Angles &a)
Definition angles.cc:172
STL namespace.
size_t operator()(const ns3::Ipv6Address &addr) const
Returns the hash of an IPv6 address.