summaryrefslogtreecommitdiff
path: root/src/libstddjb/socket_recvnb46.c
blob: db63357ca61e7902a92c5ee75f5638f2f86cbae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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