about summary refs log tree commit diff stats
path: root/src/message.c
diff options
context:
space:
mode:
authorlatex <latex@disroot.org>2023-02-11 02:01:21 +0100
committerlatex <latex@disroot.org>2023-02-11 02:01:21 +0100
commit82ca959ff701832e96c869161adc5e179c2201dd (patch)
tree3a819f5b26cfd3703a229eaf2ea187c3fa60a0ef /src/message.c
parent79c59f93b7461082cf4aec3025257560fc788c69 (diff)
downloadlibumumble-master.tar.gz
restructure include and fix makefiles HEAD master
* restructed include/ to have a umumble folder
* fix the makefile to use the new include structure
* tests makefile now builds inside root build folder
* added TODO list for shit I gotta do
* laid groundwork for packet parsing/packing: mumble_packet_gen_header
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
new file mode 100644
index 0000000..8c066c2
--- /dev/null
+++ b/src/message.c
@@ -0,0 +1,15 @@
+#include <stdint.h>
+#include <string.h>
+#include <arpa/inet.h>
+
+static void mumble_packet_gen_header(uint8_t *buf, uint16_t type, uint32_t len)
+{
+	uint16_t type_be;
+	uint32_t len_be;
+
+	type_be = htons(type);
+	len_be = htonl(len);
+
+	memcpy(buf, &type_be, 2);
+	memcpy(buf+2, &len_be, 4);
+}