commit 8ee762c8c75f9bf57a2e93bbe1479c3d97052db4
parent 0f357678296f0cc0595f8e943eb63c62a3232ff7
Author: MTRNord <mtrnord1@gmail.com>
Date: Fri, 22 Sep 2017 17:19:07 +0200
Prepare some files for later. Next TODO: Do the Prerouting and Postrouting stuff in broker
Signed-off-by: MTRNord <mtrnord1@gmail.com>
Diffstat:
6 files changed, 82 insertions(+), 20 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -3,5 +3,5 @@ project(tunneldigger_broker)
set(CMAKE_CXX_STANDARD 14)
-set(SOURCE_FILES main.cpp)
+set(SOURCE_FILES main.cpp hooks.cpp hooks.h broker.cpp broker.h)
add_executable(tunneldigger_broker ${SOURCE_FILES})
diff --git a/broker.cpp b/broker.cpp
@@ -0,0 +1,14 @@
+//
+// Created by marce on 22.09.2017.
+//
+
+#include "broker.h"
+#include <iostream>
+
+using namespace std;
+
+int broker::TunnelManager::initialize() {
+ printf("Prepare Routing");
+
+ return 0;
+}
+\ No newline at end of file
diff --git a/broker.h b/broker.h
@@ -0,0 +1,18 @@
+//
+// Created by marce on 22.09.2017.
+//
+
+#ifndef TUNNELDIGGER_BROKER_BROKER_H
+#define TUNNELDIGGER_BROKER_BROKER_H
+
+
+class broker {
+ public:
+ class TunnelManager {
+ public:
+ int initialize();
+ };
+};
+
+
+#endif //TUNNELDIGGER_BROKER_BROKER_H
diff --git a/hooks.cpp b/hooks.cpp
@@ -0,0 +1,12 @@
+//
+// Created by marce on 22.09.2017.
+//
+
+#include "hooks.h"
+#include <iostream>
+
+using namespace std;
+
+int hooks::HookProcess::Register() {
+ return 0;
+}
+\ No newline at end of file
diff --git a/hooks.h b/hooks.h
@@ -0,0 +1,16 @@
+//
+// Created by marce on 22.09.2017.
+//
+
+#ifndef TUNNELDIGGER_BROKER_HOOKS_H
+#define TUNNELDIGGER_BROKER_HOOKS_H
+
+class hooks {
+ public:
+ class HookProcess {
+ public:
+ int Register();
+ };
+};
+
+#endif //TUNNELDIGGER_BROKER_HOOKS_H
diff --git a/main.cpp b/main.cpp
@@ -1,31 +1,32 @@
#ifdef linux
#include <unistd.h>
+ #include <libiptc/libiptc.h>
#endif
#include <iostream>
-#include "libs/INIReader.h"
+
using namespace std;
int main(int argc, char* argv[]) {
- string configFile= "../l2tp_broker.cfg.example";
- if (argc > 1) {
- if (string(argv[1]) != "") {
- configFile = argv[1];
+ #ifdef linux
+ string configFile= "../l2tp_broker.cfg.example";
+ if (argc > 1) {
+ if (string(argv[1]) != "") {
+ configFile = argv[1];
+ }else{
+ std::cout << "Using example config" << endl;
+ }
}else{
std::cout << "Using example config" << endl;
}
- }else{
- std::cout << "Using example config" << endl;
- }
- INIReader reader(configFile);
+ INIReader reader(configFile);
- if (reader.ParseError() < 0) {
- std::cout << "Can't load 'l2tp_broker.cfg.example'" << reader.ParseError() << endl;
- return 1;
- }
- std::cout << "Config loaded from 'l2tp_broker.cfg.example': address="
- << reader.Get("broker", "address", "UNKNOWN") << ", port="
- << reader.Get("broker", "port", "UNKNOWN") << endl;
- #ifdef linux
+ if (reader.ParseError() < 0) {
+ std::cout << "Can't load '"<< configFile << "'" << reader.ParseError() << endl;
+ return 1;
+ }
+ std::cout << "Config loaded from '"<< configFile << "': address="
+ << reader.Get("broker", "address", "UNKNOWN") << ", port="
+ << reader.Get("broker", "port", "UNKNOWN") << endl;
int uid=getuid(), euid=geteuid();
if (uid<0 || uid!=euid) {
/* We might have elevated privileges beyond that of the user who invoked
@@ -35,7 +36,6 @@ int main(int argc, char* argv[]) {
}
return 0;
#else
- printf("You currently have to use Linux to run this. Other System support might eventually come in the future. :)\n");
- return 1;
+ printf("You currently have to use Linux to run this. Other System support might eventually come in the future. :)\n"); return 1;
#endif
}
\ No newline at end of file