Changeset 1686


Ignore:
Timestamp:
Jan 17, 2007, 4:07:35 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • recvfrom() support from Dominik Kuhlen.
Location:
zzuf/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/AUTHORS

    r1678 r1686  
    77 Rémi Denis-Courmont <rdenis#simphalempin:com> (readv support)
    88 Clément Stenac <zorglub#diwi:org> (pread support)
     9 Dominik Kuhlen <dominik.kuhlen#gmit-gmbh:de> (recvfrom support)
    910
  • zzuf/trunk/doc/zzuf.1

    r1682 r1686  
    322322Unix file descriptor handling:
    323323\fBopen\fR(), \fBlseek\fR(), \fBread\fR(), \fBreadv\fR(), \fBpread\fR(),
    324 \fBaccept\fR(), \fBsocket\fR(), \fBclose\fR()
     324\fBaccept\fR(), \fBsocket\fR(), \fBrecvfrom\fR(), \fBclose\fR()
    325325.TP
    326326Standard IO streams:
  • zzuf/trunk/src/lib-fd.c

    r1683 r1686  
    44 *                2007 Rémi Denis-Courmont <rdenis#simphalempin:com>
    55 *                2007 Clément Stenac <zorglub#diwi:org>
     6 *                2007 Dominik Kuhlen <dominik.kuhlen#gmit-gmbh:de>
    67 *                All Rights Reserved
    78 *
     
    6263                                SOCKLEN_T *addrlen);
    6364static int     (*socket_orig)  (int domain, int type, int protocol);
     65static int     (*recvfrom_orig)(int s,  void  *buf,  size_t len, int flags,
     66                                struct sockaddr *from, SOCKLEN_T *fromlen);
    6467static ssize_t (*read_orig)    (int fd, void *buf, size_t count);
    6568static ssize_t (*readv_orig)   (int fd, const struct iovec *iov, int count);
     
    151154}
    152155
     156int recvfrom(int s,  void  *buf,  size_t len, int flags,
     157             struct sockaddr *from, SOCKLEN_T *fromlen)
     158{
     159    int ret;
     160
     161    LOADSYM(recvfrom);
     162    ret = recvfrom_orig(s, buf, len, flags, from, fromlen);
     163    if(!_zz_ready || _zz_disabled || !_zz_network)
     164        return ret;
     165
     166    if(ret > 0)
     167    {
     168        char *b = buf;
     169
     170        _zz_fuzz(s, buf, ret);
     171        _zz_addpos(s, ret);
     172
     173        if(ret >= 4)
     174            debug("%s(%i, %p, %li) = %i \"%c%c%c%c...", __FUNCTION__, s, buf,
     175                  (long int)len, ret, b[0], b[1], b[2], b[3]);
     176        else
     177            debug("%s(%i, %p, %li) = %i \"%c...", __FUNCTION__, s, buf,
     178                  (long int)len, ret, b[0]);
     179    }
     180    else
     181        debug("%s(%i, %p, %li) = %i", __FUNCTION__, s, buf, (long int)len, ret);
     182
     183    return ret;
     184}
     185
    153186static void offset_check(int fd)
    154187{
Note: See TracChangeset for help on using the changeset viewer.