Browse Source

cmake; main

develop
Robin Thoni 8 years ago
parent
commit
42f5eec107
2 changed files with 26 additions and 5 deletions
  1. 11
    3
      src/CMakeLists.txt
  2. 15
    2
      src/Interface/MainClass.cpp

+ 11
- 3
src/CMakeLists.txt View File

@@ -6,7 +6,15 @@ set(SOURCE_FILES
6 6
   Interface/MainClass.h
7 7
   Interface/CommandLineParser.cpp
8 8
   Interface/CommandLineParser.h
9
-  Interface/CommandLineOption.cpp
10
-  Interface/CommandLineOption.h
9
+  DBO/CommandLineOption.cpp
10
+  DBO/CommandLineOption.h
11
+  Business/PdnsSlave.cpp
12
+  Business/PdnsSlave.h
13
+  DBO/SqlConfiguration.cpp
14
+  DBO/SqlConfiguration.h
15
+  DataAccess/PdnsSlaveConfig.cpp
16
+  DataAccess/PdnsSlaveConfig.h
11 17
   )
12
-add_executable(pdns-slave ${SOURCE_FILES})
18
+set(LIBS ${LIBS} jsoncpp)
19
+add_executable(pdns-slave ${SOURCE_FILES} DataAccess/HostsConfig.cpp DataAccess/HostsConfig.h)
20
+target_link_libraries(pdns-slave ${LIBS})

+ 15
- 2
src/Interface/MainClass.cpp View File

@@ -5,6 +5,7 @@
5 5
 #include <iostream>
6 6
 #include <sysexits.h>
7 7
 #include "CommandLineParser.h"
8
+#include "Business/PdnsSlave.h"
8 9
 #include "MainClass.h"
9 10
 
10 11
 MainClass::MainClass(int argc, char *argv[])
@@ -26,8 +27,20 @@ int MainClass::main()
26 27
     if (help.isSet())
27 28
         return parser.showHelp(0, false);
28 29
 
29
-    auto file = configFile.getValue();
30
-    std::cout << "Using configuration file " << file << std::endl;
30
+    auto filePath = configFile.getValue();
31
+    std::cout << "Using configuration file " << filePath << std::endl;
32
+
33
+    PdnsSlave pdnsSlave(filePath);
34
+    if (!pdnsSlave.readConfig())
35
+    {
36
+        std::cerr << "Failed to read pdns-slave configuration" << std::endl;
37
+        return 1;
38
+    }
39
+    if (!pdnsSlave.readDhcpdTemplate())
40
+    {
41
+        std::cerr << "Failed to read dhcpd template" << std::endl;
42
+        return 2;
43
+    }
31 44
 
32 45
     return 0;
33 46
 }

Loading…
Cancel
Save