summaryrefslogtreecommitdiffstats
path: root/protocol.h
diff options
context:
space:
mode:
authorFinn Behrens <me@kloenk.de>2021-02-19 11:13:53 +0100
committerFinn Behrens <me@kloenk.de>2021-02-19 11:13:53 +0100
commit92b180374eee440aec9537bdd4380f14edbfa28d (patch)
treeda378ca5bee95abebba1f9b0f0af64edc614fa80 /protocol.h
parent1fb5e6e7514a54abbfbde689a74d325ad4382f5e (diff)
downloadmcc-92b180374eee440aec9537bdd4380f14edbfa28d.tar.gz
mcc-92b180374eee440aec9537bdd4380f14edbfa28d.tar.xz
mcc-92b180374eee440aec9537bdd4380f14edbfa28d.zip
move ev to socket.c
Diffstat (limited to 'protocol.h')
-rw-r--r--protocol.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/protocol.h b/protocol.h
new file mode 100644
index 0000000..a002bf8
--- /dev/null
+++ b/protocol.h
@@ -0,0 +1,35 @@
+//
+// protocol.h
+// mcc@exe
+//
+// Created by Finn Behrens on 19.02.21.
+//
+
+#ifndef protocol_h
+#define protocol_h
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <errno.h>
+#include <byteswap.h>
+
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define BE32_TO_H(x) (x)
+#else
+#define BE32_TO_H(x) bswap_32(x)
+#endif
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define H_TO_BE32(x) (x)
+#else
+#define H_TO_BE32(x) bswap_32(x)
+#endif
+
+int read_var_int(int *dest, uint8_t *src);
+int read_var_long(long *dest, uint8_t *src);
+
+int write_var_int(int value, uint8_t *dest);
+int write_var_long(long value, uint8_t *dest);
+
+#endif /* protocol_h */