More IPv6 stuff.
authorraghu <raghu>
Thu, 21 Apr 2005 00:35:36 +0000 (00:35 +0000)
committerraghu <raghu>
Thu, 21 Apr 2005 00:35:36 +0000 (00:35 +0000)
src/include/missing.h

index 99f659a..cbfc5be 100644 (file)
@@ -117,6 +117,70 @@ struct in6_addr
 #ifndef IN6ADDR_LOOPBACK_INIT 
 #define IN6ADDR_LOOPBACK_INIT  {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
 #endif
+
+#ifndef IN6_IS_ADDR_UNSPECIFIED
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+       (((__const uint32_t *) (a))[0] == 0                                   \
+        && ((__const uint32_t *) (a))[1] == 0                                \
+        && ((__const uint32_t *) (a))[2] == 0                                \
+        && ((__const uint32_t *) (a))[3] == 0)
+#endif
+
+#ifndef IN6_IS_ADDR_LOOPBACK
+#define IN6_IS_ADDR_LOOPBACK(a) \
+       (((__const uint32_t *) (a))[0] == 0                                   \
+        && ((__const uint32_t *) (a))[1] == 0                                \
+        && ((__const uint32_t *) (a))[2] == 0                                \
+        && ((__const uint32_t *) (a))[3] == htonl (1))
+#endif
+
+#ifndef IN6_IS_ADDR_MULTICAST
+#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
+#endif
+
+#ifndef IN6_IS_ADDR_LINKLOCAL
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+       ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))                 \
+        == htonl (0xfe800000))
+#endif
+
+#ifndef IN6_IS_ADDR_SITELOCAL
+#define IN6_IS_ADDR_SITELOCAL(a) \
+       ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))                 \
+        == htonl (0xfec00000))
+#endif
+
+#ifndef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(a) \
+       ((((__const uint32_t *) (a))[0] == 0)                                 \
+        && (((__const uint32_t *) (a))[1] == 0)                              \
+        && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
+#endif
+
+#ifndef IN6_IS_ADDR_V4COMPAT
+#define IN6_IS_ADDR_V4COMPAT(a) \
+       ((((__const uint32_t *) (a))[0] == 0)                                 \
+        && (((__const uint32_t *) (a))[1] == 0)                              \
+        && (((__const uint32_t *) (a))[2] == 0)                              \
+        && (ntohl (((__const uint32_t *) (a))[3]) > 1))
+#endif
+
+#ifndef IN6_ARE_ADDR_EQUAL
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+       ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0])     \
+        && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1])  \
+        && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2])  \
+        && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+#endif
+
 #endif /* HAVE_STRUCT_IN6_ADDR */
 
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+struct sockaddr_storage
+{
+    uint16_t ss_family;        /* Address family, etc.  */
+    char ss_padding[128 - (sizeof(uint16_t))];
+};
+#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
+
 #endif /* _FR_MISSING_H */