summaryrefslogtreecommitdiff
path: root/src/ot_buf.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-02 20:50:24 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-02 21:14:02 +0100
commitad541c67761b8aa6da1566802c347cac4018d0c2 (patch)
treea9166fa9d349911d69a6948e53b05344dcc348a0 /src/ot_buf.h
parentc679ff8a3b1418a5960cc49ba6458a0007df54fa (diff)
Move the build sources into src/
Diffstat (limited to 'src/ot_buf.h')
-rw-r--r--src/ot_buf.h25
1 files changed, 25 insertions, 0 deletions
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 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
4#ifndef OT_BUF_H__
5#define OT_BUF_H__
6
7#include <stddef.h>
8
9/* A growable byte buffer, holding an HTTP request that did not arrive in a
10 single packet. Requests that arrive whole are served straight from the
11 worker's input buffer and never come near this. */
12typedef struct {
13 char *data;
14 size_t size;
15} ot_buf;
16
17/* Append len bytes from src. Returns 0, or -1 if the memory could not be
18 had, in which case the buffer keeps whatever it already held. */
19int buf_cat(ot_buf *buf, const void *src, size_t len);
20
21void buf_truncate(ot_buf *buf, size_t len);
22
23void buf_reset(ot_buf *buf);
24
25#endif