]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Add missing definitions for supporting Ruby
authorCostin Lupu <costin.lupu@cs.pub.ro>
Fri, 6 Dec 2019 13:23:44 +0000 (15:23 +0200)
committerCostin Lupu <costin.lup@gmail.com>
Tue, 10 Dec 2019 10:51:24 +0000 (12:51 +0200)
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
include/net/if.h
include/netinet/in.h
include/sys/socket.h

index 9bb3c877af1aff85cf62a6c15ddadc2158fa5faf..1eb11d81b3908230964d0ca0ac8f7bd1d1ee728e 100644 (file)
@@ -1,3 +1,39 @@
 #include <compat/posix/net/if.h>
 
 char *if_indextoname (unsigned int, char *);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define IFF_UP 0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifconf {
+       int ifc_len;
+       union {
+               char *ifcu_buf;
+               struct ifreq *ifcu_req;
+       } ifc_ifcu;
+};
+#define ifc_buf         ifc_ifcu.ifcu_buf
+#define ifc_req         ifc_ifcu.ifcu_req
+
+#endif /* defined(_GNU_SOURCE) || defined(_BSD_SOURCE) */
index 505a20a5312864d63c38e7f1101aa9d0d417401b..18ee0758a8f09393b4a1d6389f02ffb515f02802 100644 (file)
 #include_next <netinet/in.h>
 #endif
 
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+struct ip_mreqn {
+       struct in_addr imr_multiaddr;
+       struct in_addr imr_address;
+       int imr_ifindex;
+};
+#endif /* defined(_GNU_SOURCE) || defined(_BSD_SOURCE) */
+
 #endif /* _NETINET_IN_H_ */
index f23ad32ed1ccb0383b8169888df4386787311940..3024e171a6edc3c0457603788d855611fab1360f 100644 (file)
 #define SOMAXCONN 128
 #endif
 
+#ifndef PF_LOCAL
+#define PF_LOCAL 1
+#endif
+
+#ifndef PF_UNIX
+#define PF_UNIX PF_LOCAL
+#endif
+
 #ifndef AF_LOCAL
-#define AF_LOCAL 1 /* Not supported/stub */
+#define AF_LOCAL PF_LOCAL /* Not supported/stub */
 #endif
 
 #ifndef AF_UNIX