aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs6net/s6net_ident_reply_get.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-10 02:17:16 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-10 02:17:16 +0000
commit334d807b924427434b42d4fbae745d3d1b38a218 (patch)
tree6daf12c1e2fa07d2ac6255ef4439e2fb95a57f57 /src/libs6net/s6net_ident_reply_get.c
parent43cb3ee4227de70e0225e9ac142b4d397f93cc41 (diff)
downloads6-networking-334d807b924427434b42d4fbae745d3d1b38a218.tar.gz
Types fix, first pass
XXX marks what must change when skalibs changes. Also started writing functions for client certificate support in sbearssl, but it's not working yet (need more high-level support from BearSSL before it can work)
Diffstat (limited to 'src/libs6net/s6net_ident_reply_get.c')
-rw-r--r--src/libs6net/s6net_ident_reply_get.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libs6net/s6net_ident_reply_get.c b/src/libs6net/s6net_ident_reply_get.c
index b12925f..ee8c87e 100644
--- a/src/libs6net/s6net_ident_reply_get.c
+++ b/src/libs6net/s6net_ident_reply_get.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/allreadwrite.h>
@@ -11,9 +13,9 @@
#include <skalibs/unix-timed.h>
#include <s6-networking/ident.h>
-int s6net_ident_reply_get (char *s, ip46_t const *remoteip, uint16 remoteport, ip46_t const *localip, uint16 localport, tain_t const *deadline, tain_t *stamp)
+ssize_t s6net_ident_reply_get (char *s, ip46_t const *remoteip, uint16_t remoteport, ip46_t const *localip, uint16_t localport, tain_t const *deadline, tain_t *stamp)
{
- unsigned int len ;
+ unsigned int len ; /* XXX: change when skalibs changes */
int fd ;
if (ip46_is6(remoteip) != ip46_is6(localip)) return (errno = EAFNOSUPPORT, -1) ;
fd = socket_tcp46(ip46_is6(remoteip)) ;
@@ -24,7 +26,7 @@ int s6net_ident_reply_get (char *s, ip46_t const *remoteip, uint16 remoteport, i
char buf[S6NET_IDENT_REPLY_SIZE + 1] ;
char fmt[UINT16_FMT] ;
buffer b = BUFFER_INIT(&buffer_write, fd, buf, 256) ;
- unsigned int n = uint16_fmt(fmt, remoteport) ;
+ size_t n = uint16_fmt(fmt, remoteport) ;
buffer_putnoflush(&b, fmt, n) ;
buffer_putnoflush(&b, " , ", 3) ;
n = uint16_fmt(fmt, localport) ;
@@ -37,7 +39,7 @@ int s6net_ident_reply_get (char *s, ip46_t const *remoteip, uint16 remoteport, i
fd_close(fd) ;
if (!len--) return (errno = EPROTO, -1) ;
s[len] = 0 ;
- return (int)len ;
+ return len ;
err:
fd_close(fd) ;