| 69 struct addrinfo* info; /* NULL, if we are the server */ |
69 struct addrinfo* info; /* NULL, if we are the server */ |
| 70 Client *client; |
70 Client *client; |
| 71 } Server; |
71 } Server; |
| 72 |
72 |
| 73 typedef struct { |
73 typedef struct { |
| |
74 uint8_t servercolor; |
| |
75 uint8_t timecontrol; |
| |
76 uint16_t time; |
| |
77 uint16_t addtime; |
| |
78 uint16_t delay; |
| |
79 } NetGameInfo; |
| |
80 |
| |
81 typedef struct { |
| 74 uint32_t mtime_sec; |
82 uint32_t mtime_sec; |
| 75 uint32_t mtime_usec; |
83 uint32_t mtime_usec; |
| 76 uint8_t piece; |
84 uint8_t piece; |
| 77 uint8_t fromfile; |
85 uint8_t fromfile; |
| 78 uint8_t fromrow; |
86 uint8_t fromrow; |
| 79 uint8_t tofile; |
87 uint8_t tofile; |
| 80 uint8_t torow; |
88 uint8_t torow; |
| 81 uint8_t promotion; |
89 uint8_t promotion; |
| 82 } NetMove; |
90 } NetMove; |
| 83 |
|
| 84 #define NETMOVE_LEN 14 |
|
| 85 |
91 |
| 86 int net_create_tcp(Server *server, short port); |
92 int net_create_tcp(Server *server, short port); |
| 87 int net_find_tcp(Server *server, char* host, short port); |
93 int net_find_tcp(Server *server, char* host, short port); |
| 88 |
94 |
| 89 int net_create_sock(Server *server, char *path); |
95 int net_create_sock(Server *server, char *path); |