summaryrefslogtreecommitdiff
path: root/src/ot_fmt.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_fmt.h
parentc679ff8a3b1418a5960cc49ba6458a0007df54fa (diff)
Move the build sources into src/
Diffstat (limited to 'src/ot_fmt.h')
-rw-r--r--src/ot_fmt.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ot_fmt.h b/src/ot_fmt.h
new file mode 100644
index 0000000..214cbc4
--- /dev/null
+++ b/src/ot_fmt.h
@@ -0,0 +1,19 @@
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_FMT_H__
5#define OT_FMT_H__
6
7#include <stddef.h>
8
9/* Appending to a cursor that walks a fixed buffer. Both take the cursor by
10 reference and advance it, so a reply is written as a run of statements and
11 no caller does pointer arithmetic of its own. */
12
13void fmt_append(char **cursor, const char *end, const char *format, ...) __attribute__((format(printf, 3, 4)));
14
15/* Append raw bytes for the binary stretches of a bencoded reply.
16 Either everything is appended or nothing at all */
17void fmt_bytes(char **cursor, const char *end, const void *bytes, size_t length);
18
19#endif