summaryrefslogtreecommitdiff
path: root/network.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-06-12 19:18:35 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-06-12 19:18:35 -0400
commit85b17f3d217aea2380eb81b8a77c9a668db0652b (patch)
tree27683bfd120016f53e29e6ce95934eb6ff9fbad3 /network.h
parent2e0d9a036ef6f27faa726dc5a2e4e6e2631c4619 (diff)
Start work on the networking code.
Diffstat (limited to 'network.h')
-rw-r--r--network.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/network.h b/network.h
new file mode 100644
index 0000000..c2d8d13
--- /dev/null
+++ b/network.h
@@ -0,0 +1,34 @@
+#ifndef NETWORK_H
+#define NETWORK_H
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/un.h>
+
+typedef struct packet packet;
+typedef struct cmd cmd;
+typedef struct cmd_header cmd_header;
+
+struct packet {
+ uint32_t size; /* Size of packet, in bytes. */
+ cmd cmd; /* Command. */
+};
+
+struct cmd {
+ cmd_header header; /* Command Header. */
+ uint8_t *data; /* Command data. */
+};
+
+struct cmd_header {
+ uint32_t size; /* Size of command, in bytes, including command header. */
+ uint16_t magic; /* Magic Number. Must always be 0x1488. */
+ uint16_t id; /* Command ID. */
+};
+
+#endif