Complete restructuring and addition of core Logging system and dhcp module

This commit is contained in:
Suraxius committed 2021-01-03 22:43:45 +01:00
1 parent 8fa965823a
commit 7fa4d1fc58
49 files changed
+3627 -193

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
add_subdirectory(core)
add_subdirectory(storage)
add_subdirectory(resolver)
add_subdirectory(dhcp)
add_subdirectory(api)
add_subdirectory(cluster)
+3 -3
View File
@@ -1,5 +1,5 @@
add_library(API OBJECT Server.cpp)
add_library(DHCP OBJECT Server.cpp)
target_include_directories(API PUBLIC include)
target_include_directories(DHCP PUBLIC include)
target_link_libraries(API PRIVATE Core)
target_link_libraries(DHCP PRIVATE Core)
+1 -1
View File
@@ -1,6 +1,6 @@
#include "Server.hpp"
namespace DistriNS {
namespace Plains {
namespace API {
Server::Server(EventBus& eventBus) : eventBus(eventBus) {
+1 -1
View File
@@ -2,7 +2,7 @@
#define SERVER_HPP
#include "EventBus.hpp"
namespace DistriNS {
namespace Plains {
namespace API {
using Core::EventBus;
+1 -1
View File
@@ -1,4 +1,4 @@
add_library(Cluster OBJECT Cluster.cpp)
add_library(Cluster OBJECT Client.cpp)
target_include_directories(Cluster PUBLIC include)
+8
View File
@@ -0,0 +1,8 @@
#include "Client.hpp"
namespace Plains {
namespace Cluster {
Client::Client() {};
//Code
}}
-8
View File
@@ -1,8 +0,0 @@
#include "Cluster.hpp"
namespace DistriNS {
namespace Cluster {
Cluster::Cluster() {};
//Code
}}
+15
View File
@@ -0,0 +1,15 @@
#ifndef CLIENT_HPP
#define CLIENT_HPP
namespace Plains {
namespace Cluster {
class Client
{
public:
Client();
};
}}
#endif
+1 -12
View File
@@ -1,15 +1,4 @@
#ifndef CLUSTER_HPP
#define CLUSTER_HPP
namespace DistriNS {
namespace Cluster {
class Cluster
{
public:
Cluster();
};
}}
#include "Client.hpp"
#endif
+5 -3
View File
@@ -1,9 +1,11 @@
add_library(Core OBJECT EventBus.cpp ConfigManager.cpp Record.cpp)
add_library(Core OBJECT EventBus.cpp ConfigManager.cpp Logger.cpp)
target_include_directories(Core PUBLIC include)
add_subdirectory(dns)
add_subdirectory(storage)
# Build Executable:
add_executable(Distrins main.cpp)
target_link_libraries(Distrins PRIVATE Core Storage Resolver API Cluster)
add_executable(Plains main.cpp)
target_link_libraries(Plains PRIVATE Core DNS Storage Resolver DHCP API Cluster)
+21 -2
View File
@@ -1,11 +1,30 @@
#include "ConfigManager.hpp"
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <string>
namespace DistriNS {
namespace Plains {
namespace Core {
using std::cout;
using std::endl;
using std::string;
ConfigManager::ConfigManager(int numParameters, char **parameters) {
//Process
// move this to a function that can return an error code?
if ( numParameters <= 1 ) return;
cout << "Interpreting Paremters..." << endl;
for (unsigned i = 0; i < (numParameters-1); ++i) {
string p = string(parameters[i]);
string v = string(parameters[i+1]);
// Check if this parameter is an argument or an argument value:
if ( p.compare(0,1,"-") == 0 ) {
cout << "Interpreting parameter " << p << endl;
if ( ! p.compare("--initial-peer") ) cout << "Peer " << v << " set" << endl;
}
}
}
}}
+1 -1
View File
@@ -2,7 +2,7 @@
#include <string>
#include <iostream>
namespace DistriNS {
namespace Plains {
namespace Core {
EventBus::EventBus() {};
+81
View File
@@ -0,0 +1,81 @@
#include "Logger.hpp"
#include <iostream>
#include <ctime>
namespace Plains {
namespace Core {
using std::cout;
using std::cerr;
using std::endl;
//static string getTimeStamp() { return ctime ( time ( 0 ) ); }
Logger::Logger(enum Level logLevel, EventBus& eventBus) :
logLevel(logLevel),
eventBus(eventBus)
{
logFile = ofstream("plains.log");
if (!logFile) {
cerr << "Unable to open Logfile" << endl;
//logFile = cout.fstream;
}
else {
cout << "Log file opened" << endl;
//oldStdOut = cout.rdbuf();
//cout.rdbuf(logFile.rdbuf());
}
}
Logger::~Logger() {
logFile.close();
}
void Logger::setLogLevel(Level level) {
}
void Logger::log(Level lvl, const string& msg) { log ( lvl, msg.c_str() ); }
void Logger::log(Level lvl, const char* msg) {
switch ( lvl ) {
case DEBUG: debug (msg); break;
case INFO: info (msg); break;
case WARN: warn (msg); break;
case FATAL: fatal (msg); break;
}
}
void Logger::debug ( const string& msg ) {
logFile << "DATESTAMP [DEBUG] " << msg << endl;
}
void Logger::debug ( const char* msg ) {
logFile << "DATESTAMP [DEBUG] " << msg << endl;
}
void Logger::info ( const string& msg ) {
if ( logLevel >= INFO ) logFile << "DATESTAMP [INFO] " << msg << endl;
}
void Logger::info ( const char* msg ) {
if ( logLevel >= INFO ) logFile << "DATESTAMP [INFO] " << msg << endl;
}
void Logger::warn ( const string& msg ) {
if ( logLevel >= WARN ) logFile << "DATESTAMP [WARN] " << msg << endl;
}
void Logger::warn ( const char* msg ) {
if ( logLevel >= WARN ) logFile << "DATESTAMP [WARN] " << msg << endl;
}
void Logger::fatal ( const string& msg ) {
if ( logLevel == FATAL ) logFile << "DATESTAMP [FATAL] " << msg << endl;
}
void Logger::fatal ( const char* msg ) {
if ( logLevel == FATAL ) logFile << "DATESTAMP [FATAL] " << msg << endl;
}
}}
-11
View File
@@ -1,11 +0,0 @@
#include "Record.hpp"
namespace DistriNS {
namespace Core {
string Record::serialize() {
return "Nothing implemented";
}
}}
-18
View File
@@ -1,18 +0,0 @@
#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;
}
}}
+6
View File
@@ -0,0 +1,6 @@
add_library(DNS OBJECT Record.cpp)
target_include_directories(DNS PUBLIC include)
target_link_libraries(DNS PRIVATE Core)
+62
View File
@@ -0,0 +1,62 @@
#include "Record.hpp"
namespace Plains {
namespace Core {
namespace DNS {
string Record::serialize() {
return "Nothing implemented";
}
ARecord::ARecord() : Record(1) {}
AAAARecord::AAAARecord() : Record(28) {}
AFSDBRecord::AFSDBRecord() : Record(18) {}
APLRecord::APLRecord() : Record(42) {}
CAARecord::CAARecord() : Record(257) {}
CDNSKEYRecord::CDNSKEYRecord() : Record(60) {}
CDSRecord::CDSRecord() : Record(59) {}
CERTRecord::CERTRecord() : Record(37) {}
CNAMERecord::CNAMERecord() : Record(5) {}
CSYNCRecord::CSYNCRecord() : Record(62) {}
DHCIDRecord::DHCIDRecord() : Record(49) {}
DLVRecord::DLVRecord() : Record(32769) {}
DNAMERecord::DNAMERecord() : Record(39) {}
DNSKEYRecord::DNSKEYRecord() : Record(48) {}
DSRecord::DSRecord() : Record(43) {}
EUI48Record::EUI48Record() : Record(108) {}
EUI64Record::EUI64Record() : Record(109) {}
HINFORecord::HINFORecord() : Record(13) {}
HIPRecord::HIPRecord() : Record(55) {}
IPSECKEYRecord::IPSECKEYRecord() : Record(45) {}
KEYRecord::KEYRecord() : Record(25) {}
KXRecord::KXRecord() : Record(36) {}
LOCRecord::LOCRecord() : Record(29) {}
MXRecord::MXRecord() : Record(15) {}
NAPTRRecord::NAPTRRecord() : Record(35) {}
NSRecord::NSRecord() : Record(2) {}
NSECRecord::NSECRecord() : Record(47) {}
NSEC3Record::NSEC3Record() : Record(50) {}
NSEC3PARAMRecord::NSEC3PARAMRecord() : Record(51) {}
OPENPGPKEYRecord::OPENPGPKEYRecord() : Record(61) {}
PTRRecord::PTRRecord() : Record(12) {}
RRSIGRecord::RRSIGRecord() : Record(46) {}
RPRecord::RPRecord() : Record(17) {}
SIGRecord::SIGRecord() : Record(24) {}
SMIMEARecord::SMIMEARecord() : Record(53) {}
SOARecord::SOARecord() : Record(6) {}
SRVRecord::SRVRecord() : Record(33) {}
SSHFPRecord::SSHFPRecord() : Record(44) {}
TARecord::TARecord() : Record(32768) {}
TKEYRecord::TKEYRecord() : Record(249) {}
TLSARecord::TLSARecord() : Record(52) {}
TSIGRecord::TSIGRecord() : Record(250) {}
TXTRecord::TXTRecord() : Record(16) {}
URIRecord::URIRecord() : Record(256) {}
ZONEMDRecord::ZONEMDRecord() : Record(63) {}
SVCBRecord::SVCBRecord() : Record(64) {}
HTTPSRecord::HTTPSRecord() : Record(65) {}
}}}
+12
View File
@@ -0,0 +1,12 @@
#include "Zone.hpp"
namespace Plains {
namespace Core {
namespace DNS {
string Zone::serialize() {
return "Nothing implemented";
}
}}}
+5
View File
@@ -0,0 +1,5 @@
#ifndef DNS_HPP
#define DNS_HPP
#include "Record.hpp"
#include "Zone.hpp"
#endif
+72
View File
@@ -0,0 +1,72 @@
#ifndef RECORD_HPP
#define RECORD_HPP
#include <cstdint>
#include <string>
#include "Resource.hpp"
namespace Plains {
namespace Core {
namespace DNS {
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();
Record(const uint16_t id) : id(id) {}
};
class ARecord : public Record { ARecord(); };
class AAAARecord : public Record { AAAARecord(); };
class AFSDBRecord : public Record { AFSDBRecord(); };
class APLRecord : public Record { APLRecord(); };
class CAARecord : public Record { CAARecord(); };
class CDNSKEYRecord : public Record { CDNSKEYRecord(); };
class CDSRecord : public Record { CDSRecord(); };
class CERTRecord : public Record { CERTRecord(); };
class CNAMERecord : public Record { CNAMERecord(); };
class CSYNCRecord : public Record { CSYNCRecord(); };
class DHCIDRecord : public Record { DHCIDRecord(); };
class DLVRecord : public Record { DLVRecord(); };
class DNAMERecord : public Record { DNAMERecord(); };
class DNSKEYRecord : public Record { DNSKEYRecord(); };
class DSRecord : public Record { DSRecord(); };
class EUI48Record : public Record { EUI48Record(); };
class EUI64Record : public Record { EUI64Record(); };
class HINFORecord : public Record { HINFORecord(); };
class HIPRecord : public Record { HIPRecord(); };
class IPSECKEYRecord : public Record { IPSECKEYRecord(); };
class KEYRecord : public Record { KEYRecord(); };
class KXRecord : public Record { KXRecord(); };
class LOCRecord : public Record { LOCRecord(); };
class MXRecord : public Record { MXRecord(); };
class NAPTRRecord : public Record { NAPTRRecord(); };
class NSRecord : public Record { NSRecord(); };
class NSECRecord : public Record { NSECRecord(); };
class NSEC3Record : public Record { NSEC3Record(); };
class NSEC3PARAMRecord : public Record { NSEC3PARAMRecord(); };
class OPENPGPKEYRecord : public Record { OPENPGPKEYRecord(); };
class PTRRecord : public Record { PTRRecord(); };
class RRSIGRecord : public Record { RRSIGRecord(); };
class RPRecord : public Record { RPRecord(); };
class SIGRecord : public Record { SIGRecord(); };
class SMIMEARecord : public Record { SMIMEARecord(); };
class SOARecord : public Record { SOARecord(); };
class SRVRecord : public Record { SRVRecord(); };
class SSHFPRecord : public Record { SSHFPRecord(); };
class TARecord : public Record { TARecord(); };
class TKEYRecord : public Record { TKEYRecord(); };
class TLSARecord : public Record { TLSARecord(); };
class TSIGRecord : public Record { TSIGRecord(); };
class TXTRecord : public Record { TXTRecord(); };
class URIRecord : public Record { URIRecord(); };
class ZONEMDRecord : public Record { ZONEMDRecord(); };
class SVCBRecord : public Record { SVCBRecord(); };
class HTTPSRecord : public Record { HTTPSRecord(); };
}}}
#endif
+21
View File
@@ -0,0 +1,21 @@
#ifndef ZONE_HPP
#define ZONE_HPP
#include <cstdint>
#include <string>
#include "Resource.hpp"
namespace Plains {
namespace Core {
namespace DNS {
using std::string;
class Zone : public Resource
{
public:
//const uint16_t id;
string serialize();
};
}}}
#endif
+1 -2
View File
@@ -1,10 +1,9 @@
#ifndef CONFIG_MANAGER_HPP
#define CONFIG_MANAGER_HPP
namespace DistriNS {
namespace Plains {
namespace Core {
class ConfigManager
{
public:
+7
View File
@@ -0,0 +1,7 @@
#ifndef CORE_HPP
#define CORE_HPP
#include "EventBus.hpp"
#include "Logger.hpp"
#include "ConfigManager.hpp"
//Include further classes here
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef EVENT_BUS_HPP
#define EVENT_BUS_HPP
namespace DistriNS {
namespace Plains {
namespace Core {
class EventBus {
+1 -1
View File
@@ -1,4 +1,4 @@
namespace DistriNS {
namespace Plains {
namespace Core {
+1 -1
View File
@@ -1,4 +1,4 @@
namespace DistriNS {
namespace Plains {
namespace Core {
+41
View File
@@ -0,0 +1,41 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include <string>
#include <fstream>
#include "Core.hpp"
namespace Plains {
namespace Core {
using std::string;
using std::ofstream;
using std::streambuf;
class Logger {
public:
enum Level { DEBUG, INFO, WARN, FATAL };
Logger(Level logLevel, EventBus& eventBus);
~Logger();
void setLogLevel(Level level);
void log(Level lvl, const char* msg);
void log(Level lvl, const string& msg);
void debug(const string& msg);
void debug(const char* msg);
void info(const string& msg);
void info(const char* msg);
void warn(const string& msg);
void warn(const char* msg);
void fatal(const string& msg);
void fatal(const char* msg);
private:
EventBus& eventBus;
enum Level logLevel;
ofstream logFile;
streambuf* oldStdOut;
};
}}
#endif
-11
View File
@@ -1,11 +0,0 @@
#ifndef LOGGING_HPP
#define LOGGING_HPP
namespace DistriNS {
namespace Core {
class Logging;
}}
#endif
-71
View File
@@ -1,71 +0,0 @@
#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 -1
View File
@@ -3,7 +3,7 @@
#include <string>
#include "Serialize.hpp"
namespace DistriNS {
namespace Plains {
namespace Core {
using std::string;
+1 -1
View File
@@ -2,7 +2,7 @@
#define SERIALIZE_HPP
#include <string>
namespace DistriNS {
namespace Plains {
namespace Core {
-7
View File
@@ -1,7 +0,0 @@
namespace DistriNS {
namespace Core {
class Zone : public Serialize, public Resource;
}}
+7 -10
View File
@@ -1,23 +1,20 @@
#include <iostream>
#include "Resolver.hpp"
#include "EventBus.hpp"
#include "ConfigManager.hpp"
#include "Record.hpp" //Testing
#include "Core.hpp"
#include "DNS.hpp"
int main(int args, char **argv) {
using std::cout;
using std::endl;
using namespace DistriNS;
using namespace Plains;
//using namespace Core;
Core::ConfigManager cfg(args, argv);
auto eventBus = Core::EventBus();
Resolver::Server resolver(eventBus);
Core::EventBus eventBus;
Core::Logger logger(Core::Logger::DEBUG, eventBus);
Resolver::Server resolver(logger, eventBus);
//Record testrec = ARecord();
cout << "Booting complete." << endl;
logger.debug ("Booting complete.");
//Run eventBus on main thread.
eventBus.run();
File renamed without changes.
+11
View File
@@ -0,0 +1,11 @@
#include "Storage.hpp"
namespace Plains {
namespace Core {
namespace Storage {
Storage::Storage() {
//Costrunctor
}
}}}
+16
View File
@@ -0,0 +1,16 @@
#ifndef STORAGE_HPP
#define STORAGE_HPP
namespace Plains {
namespace Core {
namespace Storage {
class Storage {
public:
Storage();
};
}}}
#endif
+5
View File
@@ -0,0 +1,5 @@
add_library(API OBJECT Server.cpp)
target_include_directories(API PUBLIC include)
target_link_libraries(API PRIVATE Core)
+10
View File
@@ -0,0 +1,10 @@
#include "Server.hpp"
namespace Plains {
namespace DHCP {
Server::Server(EventBus& eventBus) : eventBus(eventBus) {
//Constructor
}
}}
+4
View File
@@ -0,0 +1,4 @@
#ifndef DHCP_HPP
#define DHCP_HPP
#include "Server.hpp"
#endif
+18
View File
@@ -0,0 +1,18 @@
#ifndef SERVER_HPP
#define SERVER_HPP
#include "EventBus.hpp"
namespace Plains {
namespace DHCP {
using Core::EventBus;
class Server {
const EventBus& eventBus;
public:
Server(EventBus& eventBus);
};
}}
#endif
+19 -4
View File
@@ -1,15 +1,30 @@
#include "Resolver.hpp"
#include "Server.hpp"
#include <asio.hpp>
#include <asio/ts/buffer.hpp>
#include <asio/ts/internet.hpp>
namespace DistriNS {
//Testing:
#include <iostream>
#include "Message.hpp"
namespace Plains {
namespace Resolver {
Server::Server(EventBus& eventBus) : eventBus(eventBus) {
// Code
using std::cout;
using std::endl;
Server::Server(Logger& logger, EventBus& eventBus) : logger(logger), eventBus(eventBus) {
cout << "Testing some stuff..." << endl;
cout << "Message class overall size:" << sizeof(Message) << endl;
cout << "Message::Header size:" << sizeof(Message::Header) << endl;
cout << "Message::QR:RESPONSE Enum:" << Message::QR::RESPONSE << endl;
//test:
eventBus.test();
}
Server::~Server() {
}
}}
+53
View File
@@ -0,0 +1,53 @@
#ifndef MESSAGE_HPP
#define MESSAGE_HPP
namespace Plains {
namespace Resolver {
class Message
{
public:
//private:
//const enum id {};
struct QR { enum { QUERY, RESPONSE }; };
struct OpCode { enum { QUERY, IQUERY, STATUS, _reserved, NOTIFY, UPDATE }; };
struct RCode { enum { NO_ERR, FORMAT_ERR, SERVER_FAIL, NAME_ERR, NOT_IMPL, REFUSED, YX_DOM, YX_RR_SET, NX_RR_SET, NOT_AUTH, NOT_ZONE }; };
struct Header {
unsigned int id : 16; //dentifier: A 16-bit identification field generated by the device that creates the DNS query. It is copied by the server into the response, so it can be used by that device to match that query to the corresponding reply received from a DNS server. This is used in a manner similar to how the Identifier field is used in many of the ICMP message types.
unsigned int qr : 1; //Query/Response Flag: Differentiates between queries and responses. Set to 0 when the query is generated; changed to 1 when that query is changed to a response by a replying server.
unsigned int opCode : 4;
unsigned int aa : 1; //Authoritative Answer Flag: This bit is set to 1 in a response to indicate that the server that created the response is authoritative for the zone in which the domain name specified in the Question section is located. If it is 0, the response is non-authoritative.
unsigned int tc : 1; //Truncation Flag: When set to 1, indicates that the message was truncated due to its length being longer than the maximum permitted for the type of transport mechanism used. TCP doesn't have a length limit for messages, while UDP messages are limited to 512 bytes, so this bit being sent usually is an indication that the message was sent using UDP and was too long to fit. The client may need to establish a TCP session to get the full message. On the other hand, if the portion truncated was part of the Additional section, it may choose not to bother.
unsigned int rd : 1; //Recursion Desired: When set in a query, requests that the server receiving the query attempt to answer the query recursively, if the server supports recursive resolution. The value of this bit is not changed in the response.
unsigned int ra : 1; //Recursion Available: Set to 1 or cleared to 0 in a response to indicate whether the server creating the response supports recursive queries. This can then be noted by the device that sent the query for future use.
unsigned int z : 3; //Zero: Three reserved bits set to zero.
unsigned int rCode : 4;
unsigned int qdCount : 16; //Question Count: Specifies the number of questions in the Question section of the message.
unsigned int anCount : 16; //Answer Record Count: Specifies the number of resource records in the Answer section of the message.
unsigned int nsCount : 16; //Authority Record Count: Specifies the number of resource records in the Authority section of the message. (“NS” stands for “name server”, of course. J)
unsigned int arCount : 16; //Additional Record Count: Specifies the number of resource records in the Additional section of the message.
};
struct Question {};
struct Answer {};
struct Authority {};
struct Additional {};
};
}}
#endif
+6 -3
View File
@@ -1,18 +1,21 @@
#ifndef SERVER_HPP
#define SERVER_HPP
#include "EventBus.hpp"
#include "Core.hpp"
namespace DistriNS {
namespace Plains {
namespace Resolver {
using Core::EventBus;
using Core::Logger;
class Server
{
const EventBus& eventBus;
const Logger& logger;
public:
Server(EventBus& eventBus);
Server(Logger& logger, EventBus& eventBus);
~Server();
};
}}
-6
View File
@@ -1,6 +0,0 @@
#include "Storage.hpp"
namespace DistriNS {
namespace Storage {
}}
-10
View File
@@ -1,10 +0,0 @@
#ifndef STORAGE_HPP
#define STORAGE_HPP
namespace DistriNS {
namespace Storage {
}}
#endif