-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
71 lines (59 loc) · 1.99 KB
/
main.h
File metadata and controls
71 lines (59 loc) · 1.99 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
69
70
71
//
// Created by basti on 3/15/17.
//
#ifndef PIPERELAYV2_MAIN_H
#define PIPERELAYV2_MAIN_H
#include <iostream>
#include <string.h>
#include <thread>
#include <vector>
#include "PipeWriter.h"
#include "Ssh.h"
using namespace std;
/**
* Struct witch is describing the inpipe *
*/
struct threadStartPipe{
string *name;
string *location;
PipeWriter *outWriter;
bool message;
bool log;
threadStartPipe(string *location, PipeWriter *outPipe, string *name = NULL, bool message = true, bool log = false)
:name(name),location(location),outWriter(outPipe),log(log), message(message){};
};
string location = "/tmp/pipeRelay"; // default location
string configFile = ""; // location of the config File
bool doSSH = false; // shall the program connect via ssh to the clients (config file)
bool doPipe = false; // Shall the program create named Pipes
int numberOfPipes = 0; // number of named Pipes
vector<thread*> *l = new vector<thread*>(); // list of all Threads
PipeWriter *wr; // writing end of the program
/**
* this function shall run in an thread and describe the life of the thread
* the function opens the thread
* and starts the run
* @param w pointer to the struct witch is describing the inpipe
*/
void startPipeReader(threadStartPipe *w);
/**
* this function shall run in an single thread and describe the life of an ssh connection
* this function shall be the first function after thread start
* @param s ssh new object the function calls open and run
*/
void startSSHReader(ssh *s);
/**
* the program parameter is ssh and the program shall run in ssh mode
* @param s location to the config file
*/
void handleSSH(string s);
/**
* the program shall run in named-pipe mode
* @param numberOfThreads number of pipes witch the program cread
*/
void handleNamedPipe(int numberOfThreads);
/**
*
*/
void configuration(int numberOfArg, char *argv[]);
#endif //PIPERELAYV2_MAIN_H