wip; wont build
This commit is contained in:
1 parent
4959429aee
commit
1c5ffa1dde
13 files changed
+64
-45
No files matched your search
@@ -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) {}
|
||||
|
||||
@@ -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(); };
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#include "Logger.hpp"
|
||||
#include "ConfigManager.hpp"
|
||||
#include "Exception.hpp"
|
||||
#include "Serializable.hpp"
|
||||
//Include further classes here
|
||||
#endif
|
||||
@@ -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 {};
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user