src/network.h

changeset 7
41468077b5bb
parent 3
3693fd2eb0e9
child 11
08d7a6e3ec31
equal deleted inserted replaced
6:daaf6e5b3501 7:41468077b5bb
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 }

mercurial