skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

socket_recv46.c (523B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/socket.h>
      4 #include <skalibs/ip46.h>
      5 
      6 #ifdef SKALIBS_IPV6_ENABLED
      7 
      8 ssize_t socket_recv46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h)
      9 {
     10   ssize_t r = h ? socket_recv6(s, buf, len, ip->ip, port) : socket_recv4(s, buf, len, ip->ip, port) ;
     11   if (r == -1) return -1 ;
     12   ip->is6 = !!h ;
     13   return r ;
     14 }
     15 
     16 #else
     17 
     18 ssize_t socket_recv46 (int s, char *buf, size_t len, ip46 *ip, uint16_t *port, int h)
     19 {
     20   (void)h ;
     21   return socket_recv4(s, buf, len, ip->ip, port) ;
     22 }
     23 
     24 #endif