Restructuring project
This commit is contained in:
1 parent
3864be1f85
commit
8fa965823a
34 files changed
+292
-47
No files matched your search
@@ -1,8 +1,5 @@
|
||||
add_library(API OBJECT)
|
||||
add_library(API OBJECT Server.cpp)
|
||||
|
||||
target_sources(API PRIVATE src)
|
||||
|
||||
target_include_directories(API
|
||||
PUBLIC include
|
||||
PRIVATE src)
|
||||
target_include_directories(API PUBLIC include)
|
||||
|
||||
target_link_libraries(API PRIVATE Core)
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "Server.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace API {
|
||||
|
||||
Server::Server(EventBus& eventBus) : eventBus(eventBus) {
|
||||
//Constructor
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -1,6 +1,4 @@
|
||||
#ifndef API_HPP
|
||||
#define API_HPP
|
||||
|
||||
class API;
|
||||
|
||||
#include "Server.hpp"
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef SERVER_HPP
|
||||
#define SERVER_HPP
|
||||
#include "EventBus.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace API {
|
||||
|
||||
using Core::EventBus;
|
||||
|
||||
class Server {
|
||||
const EventBus& eventBus;
|
||||
|
||||
public:
|
||||
Server(EventBus& eventBus);
|
||||
};
|
||||
|
||||
}}
|
||||
#endif
|
||||
Whitespace-only changes.
@@ -1,7 +1,5 @@
|
||||
add_library(Cluster OBJECT)
|
||||
add_library(Cluster OBJECT Cluster.cpp)
|
||||
|
||||
target_sources(Cluster PRIVATE src)
|
||||
target_include_directories(Cluster PUBLIC include)
|
||||
|
||||
target_include_directories(Cluster
|
||||
PUBLIC include
|
||||
PRIVATE src)
|
||||
target_link_libraries(Cluster PRIVATE Core)
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "Cluster.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Cluster {
|
||||
|
||||
Cluster::Cluster() {};
|
||||
//Code
|
||||
}}
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef CLUSTER_HPP
|
||||
#define CLUSTER_HPP
|
||||
#include "Cluster.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Cluster {
|
||||
|
||||
class Cluster
|
||||
{
|
||||
@@ -8,4 +10,6 @@ class Cluster
|
||||
Cluster();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Whitespace-only changes.
@@ -1,11 +1,8 @@
|
||||
|
||||
add_library(Core OBJECT EventBus.cpp ConfigManager.cpp)
|
||||
add_library(Core OBJECT EventBus.cpp ConfigManager.cpp Record.cpp)
|
||||
|
||||
target_include_directories(Core PUBLIC include)
|
||||
|
||||
#add_library(EventBus OBJECT EventBus.cpp EventBus.hpp)
|
||||
#target_link_libraries(Core INTERFACE EventBus)
|
||||
|
||||
|
||||
# Build Executable:
|
||||
add_executable(Distrins main.cpp)
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#include "ConfigManager.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
ConfigManager::ConfigManager(int numParameters, char **parameters) {
|
||||
//Process
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -2,8 +2,17 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
EventBus::EventBus() {};
|
||||
|
||||
void EventBus::test() {
|
||||
std::cout << "Testing from within EventBus!" << std::endl;
|
||||
}
|
||||
|
||||
void EventBus::run() {
|
||||
std::cout << "Run event queue.... oops done! Exiting..." << std::endl;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "Record.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
string Record::serialize() {
|
||||
return "Nothing implemented";
|
||||
}
|
||||
|
||||
}}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#include "EventBus.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
EventBus::EventBus() {};
|
||||
|
||||
void EventBus::test() {
|
||||
std::cout << "Testing from within EventBus!" << std::endl;
|
||||
}
|
||||
|
||||
void EventBus::run() {
|
||||
std::cout << "Run event queue.... oops done! Exiting..." << std::endl;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -1,10 +1,16 @@
|
||||
#ifndef CONFIG_MANAGER_HPP
|
||||
#define CONFIG_MANAGER_HPP
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
class ConfigManager
|
||||
{
|
||||
public:
|
||||
ConfigManager(int numParameters, char **parameters);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,15 @@
|
||||
#ifndef EVENT_BUS_HPP
|
||||
#define EVENT_BUS_HPP
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
class EventBus {
|
||||
public:
|
||||
EventBus();
|
||||
void test();
|
||||
void run(); // Run the event queue worker
|
||||
};
|
||||
|
||||
}}
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
}}
|
||||
@@ -1 +1,7 @@
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
class Ledger;
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef LOGGING_HPP
|
||||
#define LOGGING_HPP
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
class Logging;
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Whitespace-only changes.
@@ -0,0 +1,71 @@
|
||||
#ifndef RECORD_HPP
|
||||
#define RECORD_HPP
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include "Resource.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
using std::string;
|
||||
|
||||
// Provides an abstract class for dns records that may be stored in the database
|
||||
class Record : public Resource
|
||||
{
|
||||
public:
|
||||
//const uint16_t id;
|
||||
string serialize();
|
||||
};
|
||||
/*
|
||||
class ARecord : public Record { const uint16_t id = 1; };
|
||||
class AAAARecord : public Record { const uint16_t id = 28; };
|
||||
class AFSDBRecord : public Record { const uint16_t id = 18; };
|
||||
class APLRecord : public Record { const uint16_t id = 42; };
|
||||
class CAARecord : public Record { const uint16_t id = 257; };
|
||||
class CDNSKEYRecord : public Record { const uint16_t id = 60; };
|
||||
class CDSRecord : public Record { const uint16_t id = 59; };
|
||||
class CERTRecord : public Record { const uint16_t id = 37; };
|
||||
class CNAMERecord : public Record { const uint16_t id = 5; };
|
||||
class CSYNCRecord : public Record { const uint16_t id = 62; };
|
||||
class DHCIDRecord : public Record { const uint16_t id = 49; };
|
||||
class DLVRecord : public Record { const uint16_t id = 32769; };
|
||||
class DNAMERecord : public Record { const uint16_t id = 39; };
|
||||
class DNSKEYRecord : public Record { const uint16_t id = 48; };
|
||||
class DSRecord : public Record { const uint16_t id = 43; };
|
||||
class EUI48Record : public Record { const uint16_t id = 108; };
|
||||
class EUI64Record : public Record { const uint16_t id = 109; };
|
||||
class HINFORecord : public Record { const uint16_t id = 13; };
|
||||
class HIPRecord : public Record { const uint16_t id = 55; };
|
||||
class IPSECKEYRecord : public Record { const uint16_t id = 45; };
|
||||
class KEYRecord : public Record { const uint16_t id = 25; };
|
||||
class KXRecord : public Record { const uint16_t id = 36; };
|
||||
class LOCRecord : public Record { const uint16_t id = 29; };
|
||||
class MXRecord : public Record { const uint16_t id = 15; };
|
||||
class NAPTRRecord : public Record { const uint16_t id = 35; };
|
||||
class NSRecord : public Record { const uint16_t id = 2; };
|
||||
class NSECRecord : public Record { const uint16_t id = 47; };
|
||||
class NSEC3Record : public Record { const uint16_t id = 50; };
|
||||
class NSEC3PARAMRecord : public Record { const uint16_t id = 51; };
|
||||
class OPENPGPKEYRecord : public Record { const uint16_t id = 61; };
|
||||
class PTRRecord : public Record { const uint16_t id = 12; };
|
||||
class RRSIGRecord : public Record { const uint16_t id = 46; };
|
||||
class RPRecord : public Record { const uint16_t id = 17; };
|
||||
class SIGRecord : public Record { const uint16_t id = 24; };
|
||||
class SMIMEARecord : public Record { const uint16_t id = 53; };
|
||||
class SOARecord : public Record { const uint16_t id = 6; };
|
||||
class SRVRecord : public Record { const uint16_t id = 33; };
|
||||
class SSHFPRecord : public Record { const uint16_t id = 44; };
|
||||
class TARecord : public Record { const uint16_t id = 32768; };
|
||||
class TKEYRecord : public Record { const uint16_t id = 249; };
|
||||
class TLSARecord : public Record { const uint16_t id = 52; };
|
||||
class TSIGRecord : public Record { const uint16_t id = 250; };
|
||||
class TXTRecord : public Record { const uint16_t id = 16; };
|
||||
class URIRecord : public Record { const uint16_t id = 256; };
|
||||
class ZONEMDRecord : public Record { const uint16_t id = 63; };
|
||||
class SVCBRecord : public Record { const uint16_t id = 64; };
|
||||
class HTTPSRecord : public Record { const uint16_t id = 65; };
|
||||
*/
|
||||
|
||||
}}
|
||||
#endif
|
||||
@@ -1,2 +1,20 @@
|
||||
# Provides an abstract class for resources that may be stored in the database
|
||||
class Resource;
|
||||
#ifndef RESOURCE_HPP
|
||||
#define RESOURCE_HPP
|
||||
|
||||
#include <string>
|
||||
#include "Serialize.hpp"
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
using std::string;
|
||||
|
||||
// Provides an abstract class for resources that may be stored in the ledger
|
||||
class Resource : public Serialize
|
||||
{
|
||||
public:
|
||||
virtual string serialize() const = 0;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,17 @@
|
||||
#ifndef #SERIALIZE_HPP
|
||||
#define #SERIALIZE_HPP
|
||||
#ifndef SERIALIZE_HPP
|
||||
#define SERIALIZE_HPP
|
||||
#include <string>
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
using std::string;
|
||||
|
||||
class Serialize {
|
||||
public:
|
||||
virtual string Serialize() const = 0;
|
||||
}
|
||||
virtual string serialize() const = 0;
|
||||
};
|
||||
|
||||
}}
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace DistriNS {
|
||||
namespace Core {
|
||||
|
||||
|
||||
class Zone : public Serialize, public Resource;
|
||||
|
||||
}}
|
||||
+12
-3
@@ -2,16 +2,25 @@
|
||||
#include "Resolver.hpp"
|
||||
#include "EventBus.hpp"
|
||||
#include "ConfigManager.hpp"
|
||||
#include "Record.hpp" //Testing
|
||||
|
||||
int main(int args, char **argv) {
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
using namespace DistriNS;
|
||||
//using namespace Core;
|
||||
|
||||
ConfigManager cfg(args, argv);
|
||||
auto eventBus = EventBus();
|
||||
Resolver resolver(eventBus);
|
||||
Core::ConfigManager cfg(args, argv);
|
||||
auto eventBus = Core::EventBus();
|
||||
Resolver::Server resolver(eventBus);
|
||||
|
||||
//Record testrec = ARecord();
|
||||
|
||||
cout << "Booting complete." << endl;
|
||||
|
||||
//Run eventBus on main thread.
|
||||
eventBus.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
add_library(Resolver OBJECT Resolver.cpp)
|
||||
add_library(Resolver OBJECT Server.cpp)
|
||||
|
||||
target_include_directories(Resolver PUBLIC include)
|
||||
|
||||
|
||||
@@ -3,8 +3,13 @@
|
||||
#include <asio/ts/buffer.hpp>
|
||||
#include <asio/ts/internet.hpp>
|
||||
|
||||
Resolver::Resolver(EventBus &eventBus) : eventBus(eventBus) {
|
||||
namespace DistriNS {
|
||||
namespace Resolver {
|
||||
|
||||
Server::Server(EventBus& eventBus) : eventBus(eventBus) {
|
||||
// Code
|
||||
//test:
|
||||
eventBus.test();
|
||||
};
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -1,13 +1,5 @@
|
||||
#ifndef RESOLVER_HPP
|
||||
#define RESOLVER_HPP
|
||||
#include "EventBus.hpp"
|
||||
|
||||
class Resolver
|
||||
{
|
||||
const EventBus &eventBus;
|
||||
|
||||
public:
|
||||
Resolver(EventBus &eventBus);
|
||||
};
|
||||
|
||||
#include "Server.hpp"
|
||||
//Include further classes here
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef SERVER_HPP
|
||||
#define SERVER_HPP
|
||||
#include "EventBus.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Resolver {
|
||||
|
||||
using Core::EventBus;
|
||||
|
||||
class Server
|
||||
{
|
||||
const EventBus& eventBus;
|
||||
|
||||
public:
|
||||
Server(EventBus& eventBus);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,5 @@
|
||||
add_library(Storage OBJECT)
|
||||
add_library(Storage OBJECT Storage.cpp)
|
||||
|
||||
target_sources(Storage PRIVATE src)
|
||||
|
||||
target_include_directories(Storage
|
||||
PUBLIC include
|
||||
PRIVATE src)
|
||||
target_include_directories(Storage PUBLIC include)
|
||||
|
||||
target_link_libraries(Storage PRIVATE Core)
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "Storage.hpp"
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Storage {
|
||||
|
||||
}}
|
||||
@@ -2,5 +2,9 @@
|
||||
#define STORAGE_HPP
|
||||
|
||||
|
||||
namespace DistriNS {
|
||||
namespace Storage {
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Whitespace-only changes.
Reference in new issue
Block a user