summaryrefslogtreecommitdiff
path: root/src/ot_fmt.h
diff options
context:
space:
mode:
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