Mercurial > dropbear
comparison fuzz-wrapfd.h @ 1740:dfbe947bdf0d fuzz
Make wrapfd share a common buffer for all FDs
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 15 Oct 2020 22:46:24 +0800 |
parents | e75dab5bec71 |
children | 97ad26e397a5 |
comparison
equal
deleted
inserted
replaced
1739:13d834efc376 | 1740:dfbe947bdf0d |
---|---|
3 | 3 |
4 #include "buffer.h" | 4 #include "buffer.h" |
5 | 5 |
6 enum wrapfd_mode { | 6 enum wrapfd_mode { |
7 UNUSED = 0, | 7 UNUSED = 0, |
8 PLAIN, | 8 COMMONBUF, // using the common buffer |
9 INPROGRESS, | |
10 RANDOMIN | |
11 }; | 9 }; |
12 | 10 |
13 void wrapfd_setup(void); | 11 // buf is a common buffer read by all wrapped FDs. doesn't take ownership of buf |
12 void wrapfd_setup(buffer *buf); | |
14 void wrapfd_setseed(uint32_t seed); | 13 void wrapfd_setseed(uint32_t seed); |
15 // doesn't take ownership of buf. buf is optional. | 14 int wrapfd_new(); |
16 void wrapfd_add(int fd, buffer *buf, enum wrapfd_mode mode); | |
17 | 15 |
18 // called via #defines for read/write/select | 16 // called via #defines for read/write/select |
19 int wrapfd_read(int fd, void *out, size_t count); | 17 int wrapfd_read(int fd, void *out, size_t count); |
20 int wrapfd_write(int fd, const void* in, size_t count); | 18 int wrapfd_write(int fd, const void* in, size_t count); |
21 int wrapfd_select(int nfds, fd_set *readfds, fd_set *writefds, | 19 int wrapfd_select(int nfds, fd_set *readfds, fd_set *writefds, |