From 85b17f3d217aea2380eb81b8a77c9a668db0652b Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 12 Jun 2021 19:18:35 -0400 Subject: Start work on the networking code. --- network.c | 7 +++++++ network.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 network.c create mode 100644 network.h diff --git a/network.c b/network.c new file mode 100644 index 0000000..6bfd9d7 --- /dev/null +++ b/network.c @@ -0,0 +1,7 @@ +#include +#include +#include +#include +#include +#include "macros.h" +#include "network.h" 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 +#include +#include +#include +#include +#include +#include +#include +#include + +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 -- cgit v1.2.3-13-gbd6f