wip; wont build

This commit is contained in:
Sven Luethi committed 2021-04-11 15:06:50 +02:00
1 parent 4959429aee
commit 1c5ffa1dde
13 files changed
+64 -45

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
build/
doc/
*.swp
.vscode
+2 -2
View File
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = DistriNS
PROJECT_NAME = Plains
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = doc
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
+6
View File
@@ -35,6 +35,12 @@ inotifywait -m -q -r -e close_write --format %f ../src/ | grep --line-buffered "
#### Header Files
- LargeCamelCase.hpp
# TODOs
## Resolver
- DNSSec
- Dane Support
## Useful Links
### DNS Protocol
+8 -2
View File
@@ -1,12 +1,18 @@
#include "Record.hpp"
namespace Plains {
namespace Core {
namespace DNS {
string Record::serialize() {
return "Nothing implemented";
Record::Record(const uint16_t id) : _id(id) {
_os = ostream(_sb);
_os << "NOT IMPLEMENTED";
}
ostream& Record::operator>>(Serializable& record) {
return _os;
}
ARecord::ARecord() : Record(1) {}
+10 -4
View File
@@ -1,22 +1,28 @@
#ifndef RECORD_HPP
#define RECORD_HPP
#include <cstdint>
#include <string>
#include "Resource.hpp"
#include <iostream>
#include <sstream>
namespace Plains {
namespace Core {
namespace DNS {
using std::string;
using std::ostream;
using std::stringbuf;
// 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();
Record(const uint16_t id) : _id(id) {}
ostream& operator>>(Serializable& object);
Record(const uint16_t id);
private:
stringbuf _sb;
ostream* _os;
};
class ARecord : public Record { ARecord(); };
+1
View File
@@ -4,5 +4,6 @@
#include "Logger.hpp"
#include "ConfigManager.hpp"
#include "Exception.hpp"
#include "Serializable.hpp"
//Include further classes here
#endif
+5 -9
View File
@@ -1,19 +1,15 @@
#ifndef RESOURCE_HPP
#define RESOURCE_HPP
#include <string>
#include "Serialize.hpp"
#include "Serializable.hpp"
namespace Plains {
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;
};
class Resource : public Serializable {};
}}
+21
View File
@@ -0,0 +1,21 @@
#ifndef SERIALIZABLE_HPP
#define SERIALIZABLE_HPP
#include <string>
#include <iostream>
namespace Plains {
namespace Core {
using std::ostream;
class Serializable {
public:
// Serialize
virtual ostream& operator>>(Serializable& object);
// Deserialize
//virtual Serializable& operator<<(ostream& os);
};
}}
#endif
-17
View File
@@ -1,17 +0,0 @@
#ifndef SERIALIZE_HPP
#define SERIALIZE_HPP
#include <string>
namespace Plains {
namespace Core {
using std::string;
class Serialize {
public:
virtual string serialize() const = 0;
};
}}
#endif
+3 -3
View File
@@ -25,7 +25,7 @@ Resolver::Server* globalResolver;
int main(int args, char **argv) {
Logger logger(Logger::DEBUG);
logger.info.ln ("Starting PLAINS...");
logger.info.ln ("Starting Plains...");
vector<string> arguments;
for ( unsigned index = 0; index < args; ++index ) {
@@ -75,7 +75,7 @@ int main(int args, char **argv) {
// End of Testcode
eventBus.run();
logger.info.ln ("PLAINS successfully started.");
logger.info.ln ("Plains successfully started.");
}
catch (Exception& e) {
logger.fatal << "Uncaught Exception: " << e.what() << Logger::commit;
@@ -115,6 +115,6 @@ void shutdown() {
globalUIServer->~Server();
globalEventBus->~EventBus();
globalConfigManager->~ConfigManager();
globalLogger->info.ln ("PLAINS shut down.");
globalLogger->info.ln ("Plains shut down.");
globalLogger->~Logger();
}
+2 -3
View File
@@ -28,13 +28,11 @@ Server::Server(Logger& logger, EventBus& eventBus)
_eventBus(eventBus)
{
_logger.debug.ln ("Starting Resolver...");
//throw Exception("Testi");
_logger.warn << "Testing some stuff..." << Logger::commit;
_logger.warn << "Message header overall size: " << sizeof(Message::Header) << Logger::commit;
//_logger.debug << "Message::QR:RESPONSE Enum:" << Message::QR::RESPONSE << endl;
/*
std::cerr << std::hex << 0xABCDEF
std::fstream myfile;
std::streampos beg,end;
@@ -125,8 +123,9 @@ void Server::run() {
//std::cout << "size: " << udpReadStatus << std::endl;
for(int i=0; i<udpReadStatus; ++i) {
//std::cout << std::hex << (char)buffer[i];
std::cout << std::setw(2) << static_cast<unsigned>(buffer[i]);
std::cout << std::setw(2) << static_cast<unsigned>(buffer[i]) << " ";
}
std::cout << std::endl << std::endl;
if ( sendto(udpServerSocket, msg, strlen(msg), 0, (struct sockaddr*)&clientAddress, clientAddressLength) < 0 ) {
close(udpServerSocket);
+2 -2
View File
@@ -40,8 +40,8 @@ Server::~Server() {
}
void Server::run() {
_logger.info.ln ("UI Running Webserver on Port 8080");
_server->listen("0.0.0.0", 8080);
_logger.info.ln ("UI available at http://localhost:3030");
_server->listen("127.0.0.1", 3030);
}
+3 -3
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>PLAINS Control Panel</title>
<title>Plains Control Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
</head>
@@ -53,7 +53,7 @@
</ul>
</section>
<section id="nav_left">
<h1>PLAINS</h1>
<h1>PlAINS</h1>
<ul>
<li><a>About</a></li>
<li><a>Support</a></li>
@@ -120,7 +120,7 @@
</p>
</section>
<section id="footer">
<p>PLAINS v0.04</p>
<p>Plains v0.04</p>
</section>
</body>
</html>