| 46 #define NETCODE_CHECKMATE 0x24 |
46 #define NETCODE_CHECKMATE 0x24 |
| 47 #define NETCODE_STALEMATE 0x28 |
47 #define NETCODE_STALEMATE 0x28 |
| 48 #define NETCODE_RESIGN 0x41 |
48 #define NETCODE_RESIGN 0x41 |
| 49 #define NETCODE_REMIS 0x42 |
49 #define NETCODE_REMIS 0x42 |
| 50 #define NETCODE_TIMEOVER 0x44 |
50 #define NETCODE_TIMEOVER 0x44 |
| |
51 #define NETCODE_AGAIN 0x70 |
| 51 #define NETCODE_CONNLOST 0x80 |
52 #define NETCODE_CONNLOST 0x80 |
| |
53 #define NETCODE_ERROR 0xFF |
| 52 |
54 |
| 53 #define NETCODE_VERSION 16 |
55 #define NETCODE_VERSION 17 |
| 54 |
56 |
| 55 typedef struct { |
57 typedef struct { |
| 56 int fd; /* -1, if we are the client */ |
58 int fd; /* -1, if we are the client */ |
| 57 struct sockaddr address; |
59 struct sockaddr address; |
| 58 socklen_t address_len; |
60 socklen_t address_len; |
| 75 int net_connect(Server *server); |
77 int net_connect(Server *server); |
| 76 |
78 |
| 77 void net_send_code(int socket, uint8_t code); |
79 void net_send_code(int socket, uint8_t code); |
| 78 void net_send_data(int socket, uint8_t code, void *data, size_t len); |
80 void net_send_data(int socket, uint8_t code, void *data, size_t len); |
| 79 uint8_t net_recieve_code(int socket); |
81 uint8_t net_recieve_code(int socket); |
| |
82 uint8_t net_recieve_code_async(int socket); |
| 80 void net_recieve_data(int socket, void *data, size_t len); |
83 void net_recieve_data(int socket, void *data, size_t len); |
| 81 |
84 |
| 82 #ifdef __cplusplus |
85 #ifdef __cplusplus |
| 83 } |
86 } |
| 84 #endif |
87 #endif |