summaryrefslogtreecommitdiffstats
path: root/protocol.h
diff options
context:
space:
mode:
authorFinn Behrens <me@kloenk.de>2021-02-26 21:27:25 +0100
committerFinn Behrens <me@kloenk.de>2021-02-26 21:27:25 +0100
commiteb00d6a4f192392225941a57293dba8ba8670a70 (patch)
tree8a5d1eb2ff52316b0d077b6a8ab8369e207e0eb3 /protocol.h
parente48fe6d477294fd5342a3cfd4193477e0518ae9d (diff)
downloadmcc-eb00d6a4f192392225941a57293dba8ba8670a70.tar.gz
mcc-eb00d6a4f192392225941a57293dba8ba8670a70.tar.xz
mcc-eb00d6a4f192392225941a57293dba8ba8670a70.zip
strings or so
Diffstat (limited to 'protocol.h')
-rw-r--r--protocol.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/protocol.h b/protocol.h
index f43c1a6..0978f00 100644
--- a/protocol.h
+++ b/protocol.h
@@ -38,6 +38,16 @@
#define H_TO_BE32(x) bswap_32(x)
#endif
+#define pos_bufferx(x, y) ((x + y))
+#define pos_buffer(x) pos_bufferx(x, counter)
+#define check_addx(func, x) \
+{ \
+ if (func < 0) \
+ return func; \
+ x += func; \
+}
+#define check_add(func) check_addx(func, counter)
+
// MARK: - READ
// MARK: VAR
@@ -72,6 +82,9 @@ typedef struct {
int read_position(position_t *dest, uint8_t *src);
+// string
+int read_string_malloc(char *str, uint8_t *src);
+
// MARK: - WRITE
// MARK: VAR
int write_var_int(int value, uint8_t *dest);
@@ -79,5 +92,7 @@ int write_var_long(long value, uint8_t *dest);
// MARK: primitives
+// string
+int write_string(char *str, uint8_t *dest, int size);
#endif /* protocol_h */