-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstructDef.h
107 lines (93 loc) · 1.67 KB
/
structDef.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef structDef
#define structDef
#include "global.h"
struct info
{
int port;
int num;
unsigned int seed;
char name[21];
} info;
struct constrnts
{
int label;
int mnwrds;
int mxwrds;
int mnspeed;
int mxspeed;
int step;
int smooth;
float spd_multi;
char name[31];
unsigned long minscore;
char fname[FILENAME_MAX + 1];
} constrnts;
struct gameInfo
{
uint8_t lvl;
uint32_t points;
uint32_t numofwrds;
float typoratio;
float game_cps;
float game_tcps;
clock_t duration;
float topspd;
unsigned int sinit;
char name[21];
} curr_stat;
struct dictionary
{
char *rawwords;
char **word;
size_t n;
size_t max;
} wrds;
struct scores
{
char name[ALIASLEN];
int points;
};
struct cmdmsg
{
char infoion[infoLEN]; // instruction
char plyname[ALIASLEN]; // client's plyname
char buff[BUFFSIZE]; // payload
};
struct tInfo
{
pthread_t tid; // thread's pointer
int sockfd; // socket file descriptor
char plyname[ALIASLEN]; // client's plyname
};
struct listnode
{
struct tInfo threadinfo;
struct listnode *next;
};
struct list
{
struct listnode *head, *tail;
int size;
};
/*Common Variables used throught the code*/
extern int SERV, CLIENT;
extern int wordcount;
extern int graph;
extern int position_word[22];
extern float rate;
extern char dictdirectory[MAXPATHLEN];
extern char strings_word[22][20];
extern int scoreReceive;
extern int isconnected, aliaslen;
extern int ply;
extern char infoion[LINEBUFF];
extern struct scores final[MAXCLIENTS+1];
extern int escpe;
extern int timerval;
extern int DEFAULT_PORT;
extern int CLIENTS;
int sockfd, fd_client;
struct tInfo thread_info[MAXCLIENTS];
struct list info_clients;
pthread_mutex_t mutex_clients;
#endif