You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

network.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef NETWORK_H
  2. #define NETWORK_H
  3. #include <sys/socket.h>
  4. #include <netinet/in.h>
  5. #include <arpa/inet.h>
  6. enum {
  7. MAXNETNODES = 8
  8. } maxnetnodesconst;
  9. struct netnode {
  10. struct sockaddr_in netname;
  11. char name[16];
  12. char used;
  13. int kills, deaths;
  14. };
  15. extern struct netnode netnodes[MAXNETNODES];
  16. void getsocket(void);
  17. void freesocket(void);
  18. int send_join(struct sockaddr_in *netname, char playername[16]);
  19. void send_config();
  20. void send_quit();
  21. int scaninvite(int msec);
  22. int start_network_game();
  23. int handle_joins();
  24. int begin_network_game();
  25. void send_invites();
  26. void cancel_network_game();
  27. extern const unsigned char gameversion[4];
  28. typedef enum { NETWORK_NONE = 0, NETWORK_MASTER, NETWORK_SLAVE } network_type;
  29. extern network_type network;
  30. /* actions */
  31. int networktraffic(void);
  32. #define ACTIONHIST 20
  33. extern int mydatacount;
  34. extern int myslot;
  35. extern int actionput,actioncount;
  36. extern unsigned char actionblock[ACTIONHIST*MAXNETNODES];
  37. extern int myaction;
  38. extern unsigned char actions[MAXNETNODES];
  39. extern unsigned char latestactions[MAXNETNODES];
  40. extern long latestcounts[MAXNETNODES];
  41. #endif