summaryrefslogtreecommitdiff
path: root/pgm4/ttt.h
blob: abc4c0911fbab4a2c11e4e3cf0230d7a14f4c05f (plain) (blame)
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
/* ttt.h
 *
 * Adam Carpenter - 2017
 */

#ifndef TTT_H
#define TTT_H


// Constants.
#define MESSAGE_BUFF 64
#define MAX_HOSTNAME 255
#define MAX_CLIENTS 4
#define FALSE 0
#define TRUE 1
#define X_WIN 'X'
#define O_WIN 'O'
#define TIE_GAME '-'

// Messages that can be sent by the server and client.
#define HANDLE "h"
#define ABORT "a"
#define PLAYERID 'p'
#define BOARD 'b'
#define MOVE "m"
#define WAIT "w"
#define ENDGAME 'e'

#endif

// Function declarations.
int sendMessage(int connSock, char *message);
int getMessage(int connSock, char *message);