From ad541c67761b8aa6da1566802c347cac4018d0c2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 20:50:24 +0100 Subject: Move the build sources into src/ --- src/ot_buf.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/ot_buf.h (limited to 'src/ot_buf.h') diff --git a/src/ot_buf.h b/src/ot_buf.h new file mode 100644 index 0000000..7fb944e --- /dev/null +++ b/src/ot_buf.h @@ -0,0 +1,25 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + +#ifndef OT_BUF_H__ +#define OT_BUF_H__ + +#include + +/* A growable byte buffer, holding an HTTP request that did not arrive in a + single packet. Requests that arrive whole are served straight from the + worker's input buffer and never come near this. */ +typedef struct { + char *data; + size_t size; +} ot_buf; + +/* Append len bytes from src. Returns 0, or -1 if the memory could not be + had, in which case the buffer keeps whatever it already held. */ +int buf_cat(ot_buf *buf, const void *src, size_t len); + +void buf_truncate(ot_buf *buf, size_t len); + +void buf_reset(ot_buf *buf); + +#endif -- cgit v1.3