summaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorMario Kilies <MarioKilies@GMX.net>2011-01-14 23:26:51 +0100
committerMario Kilies <MarioKilies@GMX.net>2011-01-14 23:26:51 +0100
commit20ce50de5cd02d6baa0f143ff628cc190d637e2a (patch)
tree368c5a2f6e140368177fcbdb66acb62476386931 /src/net.h
parentaabdb70042e300b170e9e2831059a92865a73774 (diff)
Implemented basic network packet format.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index f29100a..6b91767 100644
--- a/src/net.h
+++ b/src/net.h
@@ -3,6 +3,24 @@
#define MAX_PLAYERS 10
+typedef enum
+{
+ // Specify message type identifier here
+ msg_type_hello = 0x0
+} msg_type_t;
+
+typedef struct
+{
+ uint8_t type;
+ uint8_t payload_length;
+} msg_header_t;
+
+typedef struct
+{
+ msg_header_t hdr;
+ uint8_t payload[];
+} msg_t;
+
int server_start(const char* port);
int* server_get_players(int serversock, const uint8_t count);
int client_connect_server(const char* host, const char* port);