adds ui namespace module

This commit is contained in:
Sven Luethi committed 2021-04-03 00:18:53 +02:00
1 parent 19f5a8a49a
commit 13dfbeddc0
9 files changed
+79 -5

No files matched your search

+1
View File
@@ -3,5 +3,6 @@ add_subdirectory(resolver)
add_subdirectory(dhcp) add_subdirectory(dhcp)
add_subdirectory(api) add_subdirectory(api)
add_subdirectory(cluster) add_subdirectory(cluster)
add_subdirectory(ui)
File renamed without changes.
+1 -1
View File
@@ -8,4 +8,4 @@ add_subdirectory(storage)
# Build Executable: # Build Executable:
add_executable(Plains main.cpp) add_executable(Plains main.cpp)
target_link_libraries(Plains PRIVATE Core DNS Storage Resolver DHCP API Cluster) target_link_libraries(Plains PRIVATE Core DNS Storage Resolver DHCP API Cluster UI)
+6 -4
View File
@@ -1,5 +1,6 @@
#include "Resolver.hpp"
#include "Core.hpp" #include "Core.hpp"
#include "UI.hpp"
#include "Resolver.hpp"
#include "DNS.hpp" #include "DNS.hpp"
#include <vector> #include <vector>
#include <string> #include <string>
@@ -14,7 +15,7 @@ using std::string;
int main(int args, char **argv) { int main(int args, char **argv) {
Logger logger(Logger::DEBUG); Logger logger(Logger::DEBUG);
logger.info.ln ("Starting PlaiNS..."); logger.info.ln ("Starting PLAINS...");
vector<string> arguments; vector<string> arguments;
for ( unsigned index = 0; index < args; ++index ) { for ( unsigned index = 0; index < args; ++index ) {
@@ -25,6 +26,7 @@ int main(int args, char **argv) {
{ {
ConfigManager cfg(logger, arguments); ConfigManager cfg(logger, arguments);
EventBus eventBus(logger); EventBus eventBus(logger);
UI::Server uiServer(logger, eventBus);
Resolver::Server resolver(logger, eventBus); Resolver::Server resolver(logger, eventBus);
/* /*
@@ -53,9 +55,9 @@ int main(int args, char **argv) {
// End of Testcode // End of Testcode
//resolver.run(); //resolver.run();
logger.info.ln ("PlaiNS successfully started."); logger.info.ln ("PLAINS successfully started.");
// Run something on main thread... // Run something on main thread...
logger.info.ln ("Shutting down PlaiNS. Good Bye!"); logger.info.ln ("Shutting down PLAINS. Good Bye!");
} }
catch (Exception& e) { catch (Exception& e) {
logger.fatal << "Uncaught Exception: " << e.what() << Logger::commit; logger.fatal << "Uncaught Exception: " << e.what() << Logger::commit;
+2
View File
@@ -98,7 +98,9 @@ Server::Server(Logger& logger, EventBus& eventBus)
} }
Server::~Server() { Server::~Server() {
_logger.debug.ln ("Stopping Resolver...");
_udpSocket->close(); _udpSocket->close();
_logger.debug.ln ("Resolver stopped");
} }
//void Server::run() { //void Server::run() {
+6
View File
@@ -0,0 +1,6 @@
add_library(UI OBJECT Server.cpp)
target_include_directories(UI PUBLIC include)
target_link_libraries(UI PRIVATE Core DNS PUBLIC Asio)
+25
View File
@@ -0,0 +1,25 @@
#include "Server.hpp"
namespace Plains {
namespace UI {
using asio::ip::tcp;
Server::Server(Logger& logger, EventBus& eventBus)
: _logger(logger),
_eventBus(eventBus)
{
_logger.debug.ln ("Starting UI Webserver...");
_logger.debug.ln ("UI Webserver started");
}
Server::~Server() {
_logger.debug.ln ("Stopping UI Webserver...");
_logger.debug.ln ("UI Webserver stopped");
}
}}
+33
View File
@@ -0,0 +1,33 @@
#ifndef UI_SERVER_HPP
#define UI_SERVER_HPP
#include "asio.hpp"
#include "Core.hpp"
namespace Plains {
namespace UI {
using Core::EventBus;
using Core::Logger;
using Core::Exception;
class Server
{
private:
EventBus& _eventBus;
Logger& _logger;
asio::io_context _ioContext;
asio::ip::tcp::endpoint _sender_endpoint;
public:
Server(Logger& logger, EventBus& eventBus);
~Server();
};
}}
#endif
+5
View File
@@ -0,0 +1,5 @@
#ifndef UI_HPP
#define UI_HPP
#include "Server.hpp"
//Include further classes here
#endif