summaryrefslogtreecommitdiff
path: root/src/fuzz-wrapfd.h
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2023-03-06 21:50:51 +0800
committerMatt Johnston <matt@ucc.asn.au>2023-03-06 21:50:51 +0800
commit9ddedcc53ca1c00b94c7de1ea1edf7a5e34297b2 (patch)
tree5796a1a4348b925bef0b0807a1203593589ae279 /src/fuzz-wrapfd.h
parent3292b8c6f1e5fcc405fa0f7a20e90a60f74037b2 (diff)
parenta992d3f0be411e0ba2b93e744df07e2189c7af0d (diff)
downloaddropbear-9ddedcc53ca1c00b94c7de1ea1edf7a5e34297b2.tar.gz
Merge branch 'build/folder-reorg' of github.com:tjkolev/dropbear
Diffstat (limited to 'src/fuzz-wrapfd.h')
-rw-r--r--src/fuzz-wrapfd.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/fuzz-wrapfd.h b/src/fuzz-wrapfd.h
new file mode 100644
index 0000000..d0dea88
--- /dev/null
+++ b/src/fuzz-wrapfd.h
@@ -0,0 +1,27 @@
+#ifndef FUZZ_WRAPFD_H
+#define FUZZ_WRAPFD_H
+
+#include "includes.h"
+#include "buffer.h"
+
+enum wrapfd_mode {
+ UNUSED = 0,
+ COMMONBUF, // using the common buffer
+ DUMMY, // reads return fixed output, of random length
+};
+
+// buf is a common buffer read by all wrapped FDs. doesn't take ownership of buf
+void wrapfd_setup(buffer *buf);
+void wrapfd_setseed(uint32_t seed);
+int wrapfd_new_fuzzinput(void);
+int wrapfd_new_dummy(void);
+
+// 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);
+int fuzz_kill(pid_t pid, int sig);
+
+#endif // FUZZ_WRAPFD_H