51 lines
874 B
C
51 lines
874 B
C
#ifndef CUSTOM_MSG_H
|
|
#define CUSTOM_MSG_H
|
|
|
|
#include <server.h> //FIXME: non penso vada incluso ma serve al momento
|
|
|
|
#define MAX_NAME 16
|
|
|
|
int _MSGQID;
|
|
|
|
#define MSG 1
|
|
#define MOVE 2
|
|
#define PLAYER 3
|
|
#define GAME_END 4
|
|
|
|
typedef struct {
|
|
long mtype; // type 1
|
|
int player_id;
|
|
input_server_t server_in;
|
|
} msg_t;
|
|
|
|
typedef struct {
|
|
long mtype; // type 2
|
|
int move;
|
|
} move_t;
|
|
|
|
typedef struct {
|
|
long mtype; // type 3
|
|
int id;
|
|
char name_player[MAX_NAME];
|
|
pid_t pid;
|
|
} player_ds;
|
|
|
|
typedef struct {
|
|
long mtype; // type 4
|
|
int winner; // -1 se draw
|
|
} game_end_t;
|
|
|
|
void setupServerMsgq();
|
|
|
|
void rcvMsg(msg_t *msg);
|
|
void rcvMove(move_t *move);
|
|
void rcvPlayer(player_ds *player);
|
|
void rcvGame_end(game_end_t *game);
|
|
|
|
|
|
void sndMsg(msg_t *msg);
|
|
void sndMove(move_t *move);
|
|
void sndPlayer(player_ds *player);
|
|
void sndGame_end(game_end_t *game);
|
|
|
|
#endif |