19 #include <basictypes.h> 20 #include <nbprintfinternal.h> 31 void Compactformat(
char *cp)
const;
55 bool IsEmbeddedIPV4()
const {
return ((val[2] == 0xFFFF) && (val[0] == 0) && (val[1] == 0)); }
71 IPADDR6 &operator=(
const IPADDR4 v4)
91 bool IsNull()
const {
return ((val[0] | val[1] | val[3] | ((val[2] != 0xFFFF) && (val[2] != 0))) == 0); }
109 inline bool IsLoopBack()
const {
return ((val[3] == 1) && (val[2] == 0) && (val[1] == 0) && (val[0] == 0)); };
118 inline bool IsMultiCast()
const {
return ((val[0] & 0xff000000) == 0xff000000); };
128 inline bool IsLinkLocal()
const {
return ((val[0] & 0xffc00000) == 0xfe800000); };
152 void print(
bool bCompact =
true,
bool bShowV4Raw =
false)
const;
165 void fdprint(
int fd,
bool bCompact =
true,
bool bShowV4Raw =
false)
const;
180 int sprintf(
char *cp,
int maxl,
bool bCompact =
true,
bool bShowV4Raw =
false)
const;
199 static IPADDR6 FromIPMask(MACADR &ma,
const IPADDR6 &g_root,
int mask_len);
225 void SetFromAscii(
const char *cp,
bool bembed_v4addreses =
true);
227 void SetGlobal(MACADR &ma,
const IPADDR6 &g_root);
228 void SetSolicitedNodeIP6(
const IPADDR6 &ip6);
231 void SetFromIPMask(MACADR &ma,
const IPADDR6 &g_root,
int mask_len);
287 int GetPrintLen(
bool compact);
288 int PrintHelper(PutCharsFunction *pf,
void *data,
bool compact);
291 beuint32_t
inline GetInternalValue(
int i)
const {
return val[i]; };
302 } __attribute__((packed));
310 return ((i.val[3] == j.val[3]) && (i.val[2] == j.val[2]) && (i.val[1] == j.val[1]) && (i.val[0] == j.val[0]));
315 return !((i.val[3] == j.val[3]) && (i.val[2] == j.val[2]) && (i.val[1] == j.val[1]) && (i.val[0] == j.val[0]));
320 if (i.val[0] > j.val[0])
return true;
322 if (i.val[0] == j.val[0])
324 if (i.val[1] > j.val[1])
return true;
326 if (i.val[1] == j.val[1])
328 if (i.val[2] > j.val[2])
return true;
330 if (i.val[2] == j.val[2])
332 if (i.val[3] > j.val[3])
return true;
341 if (i.val[0] < j.val[0])
return true;
343 if (i.val[0] == j.val[0])
345 if (i.val[1] < j.val[1])
return true;
346 if (i.val[1] == j.val[1])
348 if (i.val[2] < j.val[2])
return true;
349 if (i.val[2] == j.val[2])
351 if (i.val[3] < j.val[3])
return true;
static IPADDR6 AsciiToIp6(const char *cp, bool bembed_v4addreses=true)
Return an IPADDR6 object created from an ASCII value IPv4 or IPv6 address.
Definition: ipv6_addr.cpp:322
static IPADDR6 NullIP()
Return a null IPADDR6 object.
Definition: ipv6_addr.cpp:334
void SetFromIP4(IPADDR4 ip)
Set the IP address value of an IPADDR6 object from an IPADD4 object.
Definition: ipv6_addr.cpp:441
bool IsEmbeddedIPV4() const
An IPADDR6 object can store a IPv4 or IPv6 address. This function returns true if the instance contai...
Definition: ipv6_addr.h:55
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition: ipv6_addr.h:28
void fdprint(int fd, bool bCompact=true, bool bShowV4Raw=false) const
Print the IP address to the specified file descriptor.
Definition: ipv6_addr.cpp:120
void SetFromUint32Shortcut(uint32_t w0, uint32_t w1, uint32_t w2, uint32_t w3)
Set the IP address value of an IPADDR6 object from 4 discrete uint32_t values.
Definition: ipv6_addr.h:252
bool IsMultiCast() const
Check if the IPADDR6 object contains a Multicast IP address the interface.
Definition: ipv6_addr.h:118
void print(bool bCompact=true, bool bShowV4Raw=false) const
Print the IP address value to stdout.
Definition: ipv6_addr.cpp:101
void SetNull()
Set the IP address value of an IPADDR6 object to null.
Definition: ipv6_addr.h:265
int sprintf(char *cp, int maxl, bool bCompact=true, bool bShowV4Raw=false) const
Print the IP address to the specified buffer.
Definition: ipv6_addr.cpp:138
IPADDR4 Extract4() const
Extracts an IPv4 address from the object.
Definition: ipv6_addr.h:63
MACADR McastMac() const
Return the MAC address used for Multicasts for the interface.
Definition: ipv6_addr.cpp:19
bool IsLinkLocal() const
Check if the IP address is the link-local address for the interface.
Definition: ipv6_addr.h:128
bool IsLoopBack() const
Check if the IP address is the loopback address for the interface.
Definition: ipv6_addr.h:109
bool IsNull() const
Check if the IP address is null.
Definition: ipv6_addr.h:91
bool NotNull() const
Check if the IP address is not null.
Definition: ipv6_addr.h:100
void SetFromAscii(const char *cp, bool bembed_v4addreses=true)
Set the IP address value of an IPADDR6 object.
Definition: ipv6_addr.cpp:186