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