view fuzz-wrapfd.h @ 1365:9aa6cd66b51d fuzz

zlib can use m_malloc/m_free too
author Matt Johnston <matt@ucc.asn.au>
date Mon, 22 May 2017 22:09:26 +0800
parents 16f45f2df38f
children d4cc85e6c569
line wrap: on
line source

#ifndef FUZZ_WRAPFD_H
#define FUZZ_WRAPFD_H

#include "buffer.h"

enum wrapfd_mode {
    UNUSED = 0,
    PLAIN,
    INPROGRESS,
    RANDOMIN,
};

void wrapfd_setup(uint32_t wrapseed);
// doesn't take ownership of buf. buf is optional.
void wrapfd_add(int fd, buffer *buf, enum wrapfd_mode mode);

// called via #defines for read/write/select
int wrapfd_read(int fd, void *out, size_t count);
int wrapfd_write(int fd, const void* in, size_t count);
int wrapfd_select(int nfds, fd_set *readfds, fd_set *writefds, 
    fd_set *exceptfds, struct timeval *timeout);
int wrapfd_close(int fd);

#endif // FUZZ_WRAPFD_H