-
Notifications
You must be signed in to change notification settings - Fork 0
/
packets_server.h
36 lines (29 loc) · 1.53 KB
/
packets_server.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
#ifndef PACKETS_SERVER_H
#define PACKETS_SERVER_H
#include "packets_common.h"
#include <stdint.h>
/* basic functions */
void initDataServer();
void freeDataServer();
void addHeaderServer(uint16_t msg_type, int32_t packet_size, int32_t player_id);
void addFooterServer(char end);
/* server to client send */
void addJoinQueueResponseToData(struct JoinQueueResponse *join_resp, int32_t player_id, int32_t is_last);
void addPlayerQueueInfoToData(struct PlayerQueueInfo *player_queue);
void addQueueStatusToData(struct QueueStatus *queue_status, int32_t player_id, int32_t is_last);
void addInitialLocationsToData(struct InitialLocations *loc, int32_t player_id, int32_t is_last);
void addPlayerGameInfoToData(struct PlayerGameInfo *player_game);
void addGameReadyResponseToData(int32_t player_id, int32_t is_last);
void addObjectInfoToData(struct ObjectInfo *obj);
void addGameStateToData(struct GameState *game_state, int32_t player_id, int32_t is_last);
void addNotificationToData(struct Notification *note, int32_t player_id, int32_t is_last);
void addGameOverToData(int32_t player_id, int32_t is_last);
void addPlayerScoreboardInfoToData(struct PlayerScoreboardInfo *player_board);
void addScoreboardToData(struct Scoreboard *board, int32_t player_id, int32_t is_last);
/* client to server parse */
struct JoinQueueRequest *getJoinQueueRequest(unsigned char *msg);
struct ButtonPressed *getButtonPressed(unsigned char *msg);
/* helper functions for testing */
int getDataBufferServer(unsigned char *res, int32_t packet_size);
int getDataEndServer();
#endif