-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathControl.h
67 lines (49 loc) · 1.07 KB
/
Control.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef CONTROL_H
#define CONTROL_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <iostream>
#include <string>
#include <thread>
#include "Connection.h"
#include <sys/time.h>
#include "Sockets.h"
#include <ctime>
#define TRUE 1
#define FALSE 0
class Control{
private:
void sendConMsg(int sock,uint32_t hashCode, uint16_t port, char name[]);
Connection &connection;
Sockets &socket1;
std::thread peerThread;
std::string userInput;
void generateHash();
bool messaging;
/*
getting input for listening port and optional
connecting port then starting the Socket Thread
*/
void controlSetup();
/*
getting Input for sending a Message
*/
void getInputForMessage(uint32_t hashCode);
/*
finally send Message out to chosen socket
*/
void sendMessage();
int sock = 0;
int listenPort = 0;
struct protocolMessage message;
public:
Control(Connection &connectIn, Sockets &socketIn);
/*
Thread that handles all incoming input(Messages,help,stop)
*/
void controller();
};
#endif