sdlbomber/network.h

54 lines
1.0 KiB
C
Raw Normal View History

#ifndef NETWORK_H
#define NETWORK_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
2009-08-09 22:02:13 +00:00
#define MAXNETNODES 8
struct netnode {
struct sockaddr_in netname;
char name[16];
char used;
};
2009-08-09 22:02:13 +00:00
extern struct netnode netnodes[MAXNETNODES];
void getsocket(void);
void freesocket(void);
int send_join(struct sockaddr_in *netname, char playername[16]);
2009-08-09 17:10:35 +00:00
void send_config();
void send_quit();
int scaninvite(int msec);
int start_network_game();
int handle_joins();
int begin_network_game();
void send_invites();
void cancel_network_game();
extern const unsigned char gameversion[4];
typedef enum { NETWORK_NONE = 0, NETWORK_MASTER, NETWORK_SLAVE } network_type;
extern network_type network;
/* actions */
int networktraffic(void);
#define ACTIONHIST 20
extern int mydatacount;
extern int myslot;
extern int actionput,actioncount;
extern unsigned char actionblock[ACTIONHIST*MAXNETNODES];
extern int myaction;
extern unsigned char actions[MAXNETNODES];
extern unsigned char latestactions[MAXNETNODES];
extern long latestcounts[MAXNETNODES];
#endif