summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/deps.mak2
-rw-r--r--src/headers/ip46-footer5
-rw-r--r--src/headers/ip46-header2
-rw-r--r--src/headers/ip46-with4
-rw-r--r--src/headers/ip46-without4
-rw-r--r--src/libstddjb/socket_recv46.c24
-rw-r--r--src/libstddjb/socket_recvnb46.c24
7 files changed, 55 insertions, 10 deletions
diff --git a/package/deps.mak b/package/deps.mak
index d23929d..5070eaa 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -532,7 +532,9 @@ src/libstddjb/socket_local4.o src/libstddjb/socket_local4.lo: src/libstddjb/sock
src/libstddjb/socket_local46.o src/libstddjb/socket_local46.lo: src/libstddjb/socket_local46.c src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/uint16.h
src/libstddjb/socket_local6.o src/libstddjb/socket_local6.lo: src/libstddjb/socket_local6.c src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/uint16.h
src/libstddjb/socket_recv4.o src/libstddjb/socket_recv4.lo: src/libstddjb/socket_recv4.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/uint16.h
+src/libstddjb/socket_recv46.o src/libstddjb/socket_recv46.lo: src/libstddjb/socket_recv46.c src/include/skalibs/ip46.h src/include/skalibs/socket.h
src/libstddjb/socket_recv6.o src/libstddjb/socket_recv6.lo: src/libstddjb/socket_recv6.c src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/uint16.h
+src/libstddjb/socket_recvnb46.o src/libstddjb/socket_recvnb46.lo: src/libstddjb/socket_recvnb46.c src/include/skalibs/ip46.h src/include/skalibs/socket.h
src/libstddjb/socket_remote4.o src/libstddjb/socket_remote4.lo: src/libstddjb/socket_remote4.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/uint16.h
src/libstddjb/socket_remote46.o src/libstddjb/socket_remote46.lo: src/libstddjb/socket_remote46.c src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/uint16.h
src/libstddjb/socket_remote6.o src/libstddjb/socket_remote6.lo: src/libstddjb/socket_remote6.c src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/uint16.h
diff --git a/src/headers/ip46-footer b/src/headers/ip46-footer
index a1062bf..5343c54 100644
--- a/src/headers/ip46-footer
+++ b/src/headers/ip46-footer
@@ -1,7 +1,10 @@
#define ip46_from_ip(i, s, h) ((h) ? ip46_from_ip6(i, s) : ip46_from_ip4(i, s))
-#define socket_recvnb46_g(fd, buf, len, i, port, deadline) socket_recvnb46(fd, buf, len, i, port, (deadline), &STAMP)
+extern ssize_t socket_recv46 (int, char *, size_t, ip46 *, uint16_t *, int) ;
+extern ssize_t socket_recvnb46 (int, char *, size_t, ip46 *, uint16_t *, int, tain const *, tain *) ;
+
+#define socket_recvnb46_g(fd, buf, len, i, port, h, deadline) socket_recvnb46(fd, buf, len, i, port, h, (deadline), &STAMP)
#define socket_sendnb46_g(fd, buf, len, i, port, deadline) socket_sendnb46(fd, buf, len, i, port, (deadline), &STAMP)
extern int socket_deadlineconnstamp46 (int, ip46 const *, uint16_t, tain const *, tain *) ;
diff --git a/src/headers/ip46-header b/src/headers/ip46-header
index 49936a7..fd0be49 100644
--- a/src/headers/ip46-header
+++ b/src/headers/ip46-header
@@ -3,7 +3,7 @@
#ifndef SKALIBS_IP46_H
#define SKALIBS_IP46_H
-#include <string.h>
+#include <sys/types.h>
#include <stdint.h>
#include <errno.h>
diff --git a/src/headers/ip46-with b/src/headers/ip46-with
index 5eec291..f6e0ed1 100644
--- a/src/headers/ip46-with
+++ b/src/headers/ip46-with
@@ -28,12 +28,8 @@ typedef ip46full ip46, *ip46_ref ;
#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 *) ;
extern int socket_remote46 (int, ip46 *, uint16_t *) ;
-#define socket_recvnb46(fd, buf, len, i, port, deadline, stamp) ((i)->is6 ? socket_recvnb6(fd, buf, len, (i)->ip, port, deadline, stamp) : socket_recvnb4(fd, buf, len, (i)->ip, port, deadline, stamp))
-#define socket_recvnb46_g(fd, buf, len, i, port, deadline) socket_recvnb46(fd, buf, len, i, port, (deadline), &STAMP)
#define socket_sendnb46(fd, buf, len, i, port, deadline, stamp) ((i)->is6 ? socket_sendnb6(fd, buf, len, (i)->ip, port, deadline, stamp) : socket_sendnb4(fd, buf, len, (i)->ip, port, deadline, stamp))
-#define socket_sendnb46_g(fd, buf, len, i, port, deadline) socket_sendnb46(fd, buf, len, i, port, (deadline), &STAMP)
diff --git a/src/headers/ip46-without b/src/headers/ip46-without
index 5f332db..58fe022 100644
--- a/src/headers/ip46-without
+++ b/src/headers/ip46-without
@@ -32,12 +32,8 @@ struct ip46_s
#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)
#define socket_remote46(fd, i, port) socket_remote4(fd, (i)->ip, port)
-#define socket_recvnb46(fd, buf, len, i, port, deadline, stamp) socket_recvnb4(fd, buf, len, (i)->ip, port, deadline, stamp)
-#define socket_recvnb46_g(fd, buf, len, i, port, deadline) socket_recvnb46(fd, buf, len, i, port, (deadline), &STAMP)
#define socket_sendnb46(fd, buf, len, i, port, deadline, stamp) socket_sendnb4(fd, buf, len, (i)->ip, port, deadline, stamp)
-#define socket_sendnb46_g(fd, buf, len, i, port, deadline, stamp) socket_sendnb46(fd, buf, len, i, port, (deadline), &STAMP)
diff --git a/src/libstddjb/socket_recv46.c b/src/libstddjb/socket_recv46.c
new file mode 100644
index 0000000..9c1319e
--- /dev/null
+++ b/src/libstddjb/socket_recv46.c
@@ -0,0 +1,24 @@
+/* ISC license. */
+
+#include <skalibs/socket.h>
+#include <skalibs/ip46.h>
+
+#ifdef SKALIBS_IPV6_ENABLED
+
+ssize_t socket_recv46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h)
+{
+ ssize_t r = h ? socket_recv6(s, buf, len, ip->ip, port) : socket_recv4(s, buf, len, ip->ip, port) ;
+ if (r == -1) return -1 ;
+ ip->is6 = !!h ;
+ return r ;
+}
+
+#else
+
+ssize_t socket_recv46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h)
+{
+ (void)h ;
+ return socket_recv4(s, buf, len, ip->ip, port) ;
+}
+
+#endif
diff --git a/src/libstddjb/socket_recvnb46.c b/src/libstddjb/socket_recvnb46.c
new file mode 100644
index 0000000..db63357
--- /dev/null
+++ b/src/libstddjb/socket_recvnb46.c
@@ -0,0 +1,24 @@
+/* ISC license. */
+
+#include <skalibs/socket.h>
+#include <skalibs/ip46.h>
+
+#ifdef SKALIBS_IPV6_ENABLED
+
+ssize_t socket_recvnb46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h, tain const *deadline, tain *stamp)
+{
+ ssize_t r = h ? socket_recvnb6(s, buf, len, ip->ip, port, deadline, stamp) : socket_recvnb4(s, buf, len, ip->ip, port, deadline, stamp) ;
+ if (r == -1) return -1 ;
+ ip->is6 = !!h ;
+ return r ;
+}
+
+#else
+
+ssize_t socket_recvnb46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h, tain const *deadline, tain *stamp)
+{
+ (void)h ;
+ return socket_recvnb4(s, buf, len, ip->ip, port, deadline, stamp) ;
+}
+
+#endif