-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmsgs.h
More file actions
42 lines (30 loc) · 805 Bytes
/
msgs.h
File metadata and controls
42 lines (30 loc) · 805 Bytes
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
#ifndef _MSGS_H
#define _MSGS_H
#include "game.h" // sGame
#include "sigmsg.h" // MAX_SIGMSG_SZ
typedef enum {
// init handshake
MSG_JOIN,
MSG_INITST8,
MSG_READY,
MSG_START,
// in-game messages
MSG_TURN,
MSG_PAUSE,
MSG_RESUME,
// ending message
MSG_END
} eMsgsTypes;
typedef struct {
eMsgsTypes type;
char data[MAX_SIGMSG_SZ-sizeof(eMsgsTypes)]; // payload
} sMsg;
extern sMsg last_msg;
extern unsigned int last_msg_len;
int msg_ctl (sGame *g, int cmd, struct sigmsgid_ds *buf);
int msg_init (sGame *g, int create);
int msg_send (sMsg *msg, unsigned int datasz);
int msg_transfer (sMsg *msg, unsigned int *datasz);
int msg_answer (sMsg *msg, unsigned int datasz);
int msg_deinit (int destroy);
#endif