#ifndef UTILS_H #define UTILS_H #include #include #include #include #include #include #include #include #include #include #include #include #define chunkSize 1024 #define MSGSIZE 1100 struct msgBuffer { long msgType; char msgText[MSGSIZE]; }; //Open Queue as a function because writing this once is probably better than four times. //Hopefully it works properly. int openQueue(); int closeQueue(int id); struct msgBuffer makeMessage(); // mapper side int validChar(char c); char *getWord(char *chunk, int *i); char *getChunkData(int mapperID); void sendChunkData(char *inputFile, int nMappers); // reducer side int hashFunction(char* key, int reducers); int getInterData(char *key, int reducerID); void shuffle(int nMappers, int nReducers); // directory void createOutputDir(); char *createMapDir(int mapperID); void removeOutputDir(); void bookeepingCode(); #endif