blob: 907412d04186a4f7be483a6c84a1757f747873c8 (
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
35
|
#ifndef OXEN_NET_H
#define OXEN_NET_H
#include <stdint.h>
#include "player.h"
typedef enum
{
// Specify message type identifier here
msg_type_hello = 0x0,
msg_type_start_game = 0x1
} 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);
void server_start_game(int* clients, const uint8_t clientcount, const struct player_list* players);
void* server_recv(int sock, uint8_t wanted);
int client_connect_server(const char* host, const char* port);
void client_hello(int sock, const char* username);
void* client_recv(int sock, uint8_t wanted);
#endif // OXEN_NET_H
|