commit 0f81e50733845b5b67156bff6392c5e8db3c169d
parent 4f53303d8dd06e6c34491275e0d80b43082d247f
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Wed, 18 Aug 2021 07:21:13 +0000
Add some ip46 macros
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/headers/ip46-with b/src/headers/ip46-with
@@ -13,8 +13,21 @@ typedef ip46full ip46, *ip46_ref ;
#define socket_connect46(s, i, port) ((i)->is6 ? socket_connect6(s, (i)->ip, port) : socket_connect4(s, (i)->ip, port))
#define socket_bind46(s, i, port) ((i)->is6 ? socket_bind6(s, (i)->ip, port) : socket_bind4(s, (i)->ip, port))
#define socket_bind46_reuse(s, i, port) ((i)->is6 ? socket_bind6_reuse(s, (i)->ip, port) : socket_bind4_reuse(s, (i)->ip, port))
+
#define socket_tcp46(h) ((h) ? socket_tcp6() : socket_tcp4())
+#define socket_tcp46_b(h) ((h) ? socket_tcp6_b() : socket_tcp4_b())
+#define socket_tcp46_nb(h) ((h) ? socket_tcp6_nb() : socket_tcp4_nb())
+#define socket_tcp46_coe(h) ((h) ? socket_tcp6_coe() : socket_tcp4_coe())
+#define socket_tcp46_nbcoe(h) ((h) ? socket_tcp6_nbcoe() : socket_tcp4_nbcoe())
+#define socket_tcp46_internal(h, flags) ((h) ? socket_tcp6_internal(flags) : socket_tcp4_internal(flags))
+
#define socket_udp46(h) ((h) ? socket_udp6() : socket_udp4())
+#define socket_udp46_b(h) ((h) ? socket_udp6_b() : socket_udp4_b())
+#define socket_udp46_nb(h) ((h) ? socket_udp6_nb() : socket_udp4_nb())
+#define socket_udp46_coe(h) ((h) ? socket_udp6_coe() : socket_udp4_coe())
+#define socket_udp46_nbcoe(h) ((h) ? socket_udp6_nbcoe() : socket_udp4_nbcoe())
+#define socket_udp46_internal(h, flags) ((h) ? socket_udp6_internal(flags) : socket_udp4_internal(flags))
+
#define socket_recv46(fd, s, len, i, port) ((i)->is6 ? socket_recv6(fd, s, len, (i)->ip, port) : socket_recv4(fd, s, len, (i)->ip, port))
#define socket_send46(fd, s, len, i, port) ((i)->is6 ? socket_send6(fd, s, len, (i)->ip, port) : socket_send4(fd, s, len, (i)->ip, port))
extern int socket_local46 (int, ip46 *, uint16_t *) ;
diff --git a/src/headers/ip46-without b/src/headers/ip46-without
@@ -17,8 +17,21 @@ struct ip46_s
#define socket_connect46(s, i, port) socket_connect4(s, (i)->ip, port)
#define socket_bind46(s, i, port) socket_bind4(s, (i)->ip, port)
#define socket_bind46_reuse(s, i, port) socket_bind4_reuse(s, (i)->ip, port)
+
#define socket_tcp46(h) socket_tcp4()
+#define socket_tcp46_b(h) socket_tcp4_b()
+#define socket_tcp46_nb(h) socket_tcp4_nb()
+#define socket_tcp46_coe(h) socket_tcp4_coe()
+#define socket_tcp46_nbcoe(h) socket_tcp4_nbcoe()
+#define socket_tcp46_internal(h, flags) socket_tcp4_internal(flags)
+
#define socket_udp46(h) socket_udp4()
+#define socket_udp46_b(h) socket_udp4_b()
+#define socket_udp46_nb(h) socket_udp4_nb()
+#define socket_udp46_coe(h) socket_udp4_coe()
+#define socket_udp46_nbcoe(h) socket_udp4_nbcoe()
+#define socket_udp46_internal(h, flags) socket_udp4_internal(flags)
+
#define socket_recv46(fd, s, len, i, port) socket_recv4(fd, s, len, (i)->ip, port)
#define socket_send46(fd, s, len, i, port) socket_send4(fd, s, len, (i)->ip, port)
#define socket_local46(fd, i, port) socket_local4(fd, (i)->ip, port)