-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathClientServer.h
50 lines (37 loc) · 1.36 KB
/
mathClientServer.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
/*-------------------------------------------------------------------------*
*--- ---*
*--- mathClientServer.h ---*
*--- ---*
*--- This file declares C functions and constants common to both ---*
*--- mathClient.c and mathServer.c. ---*
*--- ---*
*--- ---- ---- ---- ---- ---- ---- ---- ---- ---*
*--- ---*
*--- Version 1.0 2018 August 9 Joseph Phillips ---*
*--- ---*
*-------------------------------------------------------------------------*/
//--- Header file inclusion ---//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h> // For unlink()
#include <sys/types.h> // For waitpid(), opendir()
#include <sys/wait.h> // For waitpid()
#include <dirent.h> // For opendir(), readdir(), closedir()
#include <sys/socket.h> // For socket()
#include <netinet/in.h> // For sockaddr_in and htons()
#include <netdb.h> // For getaddrinfo()
#include <errno.h> // For errno var
#include <sys/stat.h> // For open(), read(),write(), stat()
#include <fcntl.h> // and close()
#include <pthread.h>
//--- Definition of constants: ---//
#define BUFFER_LEN 256
#define DIR_CMD_CHAR 'l'
#define READ_CMD_CHAR 'r'
#define WRITE_CMD_CHAR 'w'
#define DELETE_CMD_CHAR 'd'
#define CALC_CMD_CHAR 'c'
#define QUIT_CMD_CHAR 'q'
const int MIN_FILE_NUM = 0;
const int MAX_FILE_NUM = 63;