diff options
Diffstat (limited to 'src/net.h')
| -rw-r--r-- | src/net.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -3,12 +3,21 @@ #include <stdint.h> #include "player.h" +#include "hand.h" + +/* + * Packet format: + * first byte: msg_type_t + * second byte: packet length + * followed by payload + */ typedef enum { // Specify message type identifier here msg_type_hello = 0x0, - msg_type_start_game = 0x1 + msg_type_start_game = 0x1, + msg_type_deal_cards = 0x2 } msg_type_t; typedef struct @@ -23,11 +32,15 @@ typedef struct uint8_t payload[]; } msg_t; + +// Server side functions 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_deal_cards(int sock, const hand h); void* server_recv(int sock, uint8_t wanted); +// Client side functions 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); |
