-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
49 lines (37 loc) · 1.1 KB
/
utils.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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include <dirent.h>
#include <fcntl.h>
#include "dataFunctions.h"
#include "heap.h"
typedef struct statistics{
char date[11];
char country[32];
char disease[32];
int ranges[4];
}statistics;
typedef struct workerInfo{
char* writeFifo;
char* readFifo;
char** countries;
int writeFd;
int readFd;
pid_t pid;
int num;
}workerInfo;
void findRanges(statistics** stat,BucketRecord* record);
void searchTree(Treenode* root,statistics** stat);
void printStat(statistics * stat);
void readBytes(int rfd,char* buffer,int bufferSize,int message_size);
void writeBytes(char * data,int wfd, int bufferSize);
void sendStat(char* data,int bufferSize,int wfd);
void savestat(int readFd,int bufferSize,char* data,int sizeOfdata);
int findNum(int id,workerInfo ** array,int numWorkers);
int findWorkerFromCountry(char* country, workerInfo ** array,int numWorkers,int *counter);
int CheckDate(char entryDate[strlen(DATE)+1],char exitDate[strlen(DATE)+1]);