-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectionManager.h
More file actions
68 lines (52 loc) · 1.55 KB
/
connectionManager.h
File metadata and controls
68 lines (52 loc) · 1.55 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Created by Ignacio Mora on 6/14/17.
//
#ifndef MASTERENGINE_CONNECTIONMANAGER_H
#define MASTERENGINE_CONNECTIONMANAGER_H
#include <stdio.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>
#include <unistd.h> //close
#include <arpa/inet.h> //close
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/time.h> //FD_SET, FD_ISSET, FD_ZERO macros
#include <thread>
#include "JSON library/json.hpp"
#include "tableManager.h"
#include "jsonutils.h"
#include "operationManager.h"
#define TRUE 1
#define FALSE 0
#define PORT 8888
#define MAX_SIZE 100000000000000000
using json = nlohmann::json;
class OperationManager;
class ConnectionManager {
public:
ConnectionManager();
void waitForConnections();
void waitForMessage();
void readJSON();
bool isDisk(int fd);
bool isClient(int fd);
void insert(std::string name, std::vector<std::string> column);
TableManager* tables;
OperationManager* operations;
void sendTable(std::string name);
std::vector<std::string> getMetadata();
private:
int opt = TRUE;
int master_socket , addrlen , new_socket , allSockets[45] ,
maxSockets = 45 , activity, i , valread , sd, counter = 0,
diskSockets[15], maxDisks = 15, queryExecutorSocket = 0,
clientSockets[30], maxClients = 30, currentClient = 0;
int max_sd;
struct sockaddr_in address;
char buffer[1024*10]; //data buffer of 10K
//set of socket descriptors
fd_set readfds;
};
#endif //MASTERENGINE_CONNECTIONMANAGER_H