38 #endif |
38 #endif |
39 |
39 |
40 #define NETCODE_ACCEPT 0x00 |
40 #define NETCODE_ACCEPT 0x00 |
41 #define NETCODE_DECLINE 0x01 |
41 #define NETCODE_DECLINE 0x01 |
42 #define NETCODE_GAMEINFO 0x10 |
42 #define NETCODE_GAMEINFO 0x10 |
|
43 #define NETCODE_MOVE 0x20 |
|
44 #define NETCODE_SURRENDER 0x21 |
|
45 #define NETCODE_REMIS 0x22 |
43 |
46 |
44 #define NETCODE_VERSION 1 |
47 #define NETCODE_VERSION 3 |
45 |
48 |
46 typedef struct { |
49 typedef struct { |
47 int fd; /* -1, if we are the client */ |
50 int fd; /* -1, if we are the client */ |
48 struct sockaddr address; |
51 struct sockaddr address; |
49 socklen_t address_len; |
52 socklen_t address_len; |
62 int net_destroy(Server *server); |
65 int net_destroy(Server *server); |
63 int net_connect(Server *server); |
66 int net_connect(Server *server); |
64 |
67 |
65 void net_send_code(int socket, uint32_t code); |
68 void net_send_code(int socket, uint32_t code); |
66 void net_send_data(int socket, void *data, size_t len); |
69 void net_send_data(int socket, void *data, size_t len); |
67 int net_recieve_code(int socket); |
70 uint32_t net_recieve_code(int socket); |
68 void net_recieve_data(int socket, void *data, size_t len); |
71 void net_recieve_data(int socket, void *data, size_t len); |
69 |
72 |
70 |
73 |
71 #ifdef __cplusplus |
74 #ifdef __cplusplus |
72 } |
75 } |