diff options
Diffstat (limited to 'network.h')
-rw-r--r-- | network.h | 34 |
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 |