src/network.h

changeset 2
0a08f79c320d
parent 1
e5fbb8f9edbe
child 3
3693fd2eb0e9
     1.1 --- a/src/network.h	Wed Feb 05 14:07:43 2014 +0100
     1.2 +++ b/src/network.h	Sun Feb 23 21:03:35 2014 +0100
     1.3 @@ -36,16 +36,18 @@
     1.4  #ifdef	__cplusplus
     1.5  extern "C" {
     1.6  #endif
     1.7 +    
     1.8 +#define NETCODE_GAMEINFO 1
     1.9  
    1.10  typedef struct {
    1.11 -    int fd;
    1.12 +    int fd; /* -1, if we are the client */
    1.13      struct sockaddr address;
    1.14      socklen_t address_len;
    1.15  } Client;
    1.16  
    1.17  typedef struct {
    1.18      int fd;
    1.19 -    struct addrinfo* info;
    1.20 +    struct addrinfo* info; /* NULL, if we are the server */
    1.21      Client *client;
    1.22  } Server;
    1.23  
    1.24 @@ -56,6 +58,10 @@
    1.25  int net_destroy(Server *server);
    1.26  int net_connect(Server *server);
    1.27  
    1.28 +void net_send(int socket, uint32_t code, void *data, size_t len);
    1.29 +int net_recieve_code(int socket);
    1.30 +void net_recieve_data(int socket, void *data, size_t len);
    1.31 +
    1.32  
    1.33  #ifdef	__cplusplus
    1.34  }

mercurial