summaryrefslogtreecommitdiff
path: root/network.h
blob: 3a4904ee4a67b70269a093354c5aa0ad6012c68f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 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. */
};

struct cmd {
	cmd_header header;	/* Command Header. */
	uint8_t data[];		/* Command data. */
};

struct packet {
	uint32_t size;		/* Size of packet, in bytes. */
	cmd cmd;		/* Command. */
};

#endif