summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-02-25 08:26:40 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-02-25 08:26:40 -0600
commitaf6c065d45e090cd0476bcbabad5569ab2376707 (patch)
treef8f693a12aa1b54c5a353fad9d892df8f9e68a41
parent189bbe608173983aa2ceade3eed9b0ce98ea3d47 (diff)
downloadnuttx-af6c065d45e090cd0476bcbabad5569ab2376707.tar.gz
nuttx-af6c065d45e090cd0476bcbabad5569ab2376707.tar.bz2
nuttx-af6c065d45e090cd0476bcbabad5569ab2376707.zip
netinet/in.h: Add some IPv6 macros
-rw-r--r--nuttx/include/netinet/in.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/nuttx/include/netinet/in.h b/nuttx/include/netinet/in.h
index 565ffbeb1..219f15119 100644
--- a/nuttx/include/netinet/in.h
+++ b/nuttx/include/netinet/in.h
@@ -110,6 +110,28 @@
#define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32
+/* Checks for special IPv6 addresses */
+
+#define IN6_IS_ADDR_MULTICAST(a) \
+ ((a)->s6_addr[0] == 0xff)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ ((a)->s6_addr32[0] == 0 && \
+ (a)->s6_addr32[1] == 0 && \
+ (a)->s6_addr32[2] == 0 && \
+ (a)->s6_addr32[3] == HTONL(1))
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ ((a)->s6_addr32[0] == 0 && \
+ (a)->s6_addr32[1] == 0 && \
+ (a)->s6_addr32[2] == 0 && \
+ (a)->s6_addr32[3] == 0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((a)->s6_addr32[0] == 0 && \
+ (a)->s6_addr32[1] == 0 && \
+ (a)->s6_addr32[2] == HTONL(0xffff))
+
/****************************************************************************
* Public Type Definitions
****************************************************************************/