-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstructs.h
executable file
·83 lines (60 loc) · 1.43 KB
/
structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef JOYNET_STRUCTS_H
#define JOYNET_STRUCTS_H
#define JOYNET_MAX_CHANNELS 16
typedef struct
{
char * data; // this is the original pointer
char * pointer; // this is the fill pointer (points into the above)
int size;
} JOYNET_SERIAL_DATA;
typedef struct
{
/* decoded data */
int type;
char * data;
int data_size;
/* in case we need it */
ENetEvent * event; // more info about the event
} JOYNET_MESSAGE;
typedef struct
{
/* network access */
ENetAddress address;
ENetHost * host;
ENetPeer * peer;
/* chat info */
char screen_name[256];
short user;
short group;
/* game info */
int master;
int playing;
int spectating;
/* callbacks */
int(*global_callback)(ENetEvent * ep);
int(*channel_callback[JOYNET_MAX_CHANNELS])(JOYNET_MESSAGE * mp);
int(*chat_callback)(char * user, char * message);
int(*voip_callback)(int client, void * data, int size);
/* serialization */
JOYNET_SERIAL_DATA * serial_data;
} JOYNET_CLIENT;
typedef struct
{
/* network access stuff */
ENetAddress address;
ENetHost * host;
ENetEvent event;
/* server data */
char id[256];
/* clients */
JOYNET_CLIENT ** client;
int max_clients;
/* callbacks */
int(*global_callback)(ENetEvent * ep);
int(*internal_callback)(ENetEvent * ep);
int(*channel_callback[JOYNET_MAX_CHANNELS])(JOYNET_MESSAGE * mp);
int(*voice_chat_callback)();
/* serialization */
JOYNET_SERIAL_DATA * serial_data;
} JOYNET_SERVER;
#endif