forked from papagryllos-productions/threading-pizza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pizza.h
50 lines (47 loc) · 1.17 KB
/
pizza.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
/* Header file */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <fcntl.h>
/* Pizza default values (time in microseconds) */
#define TIME_MARGARITA 10000
#define TIME_PEPPERONI 12000
#define TIME_SPECIAL 15000
#define T_KONTA 5000
#define T_MAKRIA 10000
#define T_VERYLONG 50000
#define N_DIANOMEIS 10
#define N_PSISTES 10
#define N_MAXPIZZA 3
/* change this if server can't connect to shared memory */
#define SHM_KEY 8843
/* random names for semaphores */
#define SEM_NAME1 "ppizzaguys"
#define SEM_NAME2 "ppveinafhu"
#define SEM_NAME3 "haeriglurf"
/* pizza limit, listen queue */
#define LIMIT 200
#define QUEUE 5
#define PATH "/tmp/pizza-server1547809"
/* Declaration of boolean type */
typedef enum { false, true } bool;
/* Struct for the pizza order */
typedef struct {
bool exists;
/* sums of pizza kinds */
short m_num;
short p_num;
short s_num;
/* for distance [short|long] */
bool time;
bool status1;
bool status2;
/* time variables */
int start_sec;
int start_usec;
/* to have the pid of the process that handles it */
pid_t mypid;
} order_t;