mirror of https://github.com/oxen-io/lokinet
Merge pull request #137 from michael-loki/header_cleanup
Move include/llarp headers to main llarp source dirpull/140/head
commit
4941d7d453
@ -1,57 +0,0 @@
|
||||
#ifndef LLARP_BUFFER_HPP
|
||||
#define LLARP_BUFFER_HPP
|
||||
|
||||
#include <llarp/buffer.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
StackBuffer(T& stack)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = &stack[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = sizeof(stack);
|
||||
return buff;
|
||||
}
|
||||
|
||||
/** initialize llarp_buffer_t from raw memory */
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
InitBuffer(T buf, size_t sz)
|
||||
{
|
||||
byte_t* ptr = (byte_t*)buf;
|
||||
llarp_buffer_t ret;
|
||||
ret.cur = ptr;
|
||||
ret.base = ptr;
|
||||
ret.sz = sz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** initialize llarp_buffer_t from container */
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
Buffer(T& t)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = &t[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = t.size();
|
||||
return buff;
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
ConstBuffer(const T& t)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = (byte_t*)&t[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = t.size();
|
||||
return buff;
|
||||
}
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -1,83 +0,0 @@
|
||||
#ifndef LLARP_CRYPTO_HPP
|
||||
#define LLARP_CRYPTO_HPP
|
||||
|
||||
#include <llarp/crypto.h>
|
||||
#include <llarp/mem.h>
|
||||
#include <llarp/threadpool.h>
|
||||
#include <llarp/aligned.hpp>
|
||||
#include <llarp/router_id.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
const byte_t*
|
||||
seckey_topublic(const byte_t* secret);
|
||||
|
||||
const byte_t*
|
||||
pq_keypair_to_public(const byte_t* keypair);
|
||||
|
||||
const byte_t*
|
||||
pq_keypair_to_secret(const byte_t* keypair);
|
||||
|
||||
using SharedSecret = AlignedBuffer< SHAREDKEYSIZE >;
|
||||
using KeyExchangeNonce = AlignedBuffer< 32 >;
|
||||
|
||||
struct PubKey final : public AlignedBuffer< PUBKEYSIZE >
|
||||
{
|
||||
PubKey() : AlignedBuffer< PUBKEYSIZE >(){};
|
||||
PubKey(const byte_t* ptr) : AlignedBuffer< PUBKEYSIZE >(ptr){};
|
||||
|
||||
std::string
|
||||
ToString() const;
|
||||
|
||||
bool
|
||||
FromString(const std::string& str);
|
||||
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& out, const PubKey& k)
|
||||
{
|
||||
return out << k.ToString();
|
||||
}
|
||||
|
||||
operator RouterID() const
|
||||
{
|
||||
return RouterID(data());
|
||||
}
|
||||
|
||||
PubKey&
|
||||
operator=(const byte_t* ptr)
|
||||
{
|
||||
memcpy(data(), ptr, size());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct SecretKey final : public AlignedBuffer< SECKEYSIZE >
|
||||
{
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& out, const SecretKey&)
|
||||
{
|
||||
// make sure we never print out secret keys
|
||||
return out << "[secretkey]";
|
||||
}
|
||||
|
||||
SecretKey&
|
||||
operator=(const byte_t* ptr)
|
||||
{
|
||||
memcpy(data(), ptr, size());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
using ShortHash = AlignedBuffer< SHORTHASHSIZE >;
|
||||
using Signature = AlignedBuffer< SIGSIZE >;
|
||||
using TunnelNonce = AlignedBuffer< TUNNONCESIZE >;
|
||||
using SymmNonce = AlignedBuffer< NONCESIZE >;
|
||||
using SymmKey = AlignedBuffer< 32 >;
|
||||
|
||||
using PQCipherBlock = AlignedBuffer< PQ_CIPHERTEXTSIZE + 1 >;
|
||||
using PQPubKey = AlignedBuffer< PQ_PUBKEYSIZE >;
|
||||
using PQKeyPair = AlignedBuffer< PQ_KEYPAIRSIZE >;
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
#include <llarp/dht/context.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/dht/messages/all.hpp>
|
||||
#include <llarp/dht/node.hpp>
|
@ -1,8 +0,0 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_ALL_HPP
|
||||
#define LLARP_DHT_MESSAGES_ALL_HPP
|
||||
#include <llarp/dht/messages/findintro.hpp>
|
||||
#include <llarp/dht/messages/findrouter.hpp>
|
||||
#include <llarp/dht/messages/gotintro.hpp>
|
||||
#include <llarp/dht/messages/gotrouter.hpp>
|
||||
#include <llarp/dht/messages/pubintro.hpp>
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
#include <llarp/dns/name.hpp>
|
||||
#include <llarp/dns/rr.hpp>
|
||||
#include <llarp/dns/serialize.hpp>
|
||||
#include <llarp/dns/message.hpp>
|
||||
#include <llarp/dns/server.hpp>
|
@ -1,140 +0,0 @@
|
||||
#ifndef LLARP_ENCODE_HPP
|
||||
#define LLARP_ENCODE_HPP
|
||||
#include <stdint.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
// from https://en.wikipedia.org/wiki/Base32#z-base-32
|
||||
static const char zbase32_alpha[] = {'y', 'b', 'n', 'd', 'r', 'f', 'g', '8',
|
||||
'e', 'j', 'k', 'm', 'c', 'p', 'q', 'x',
|
||||
'o', 't', '1', 'u', 'w', 'i', 's', 'z',
|
||||
'a', '3', '4', '5', 'h', '7', '6', '9'};
|
||||
|
||||
static const std::unordered_map< char, uint8_t > zbase32_reverse_alpha = {
|
||||
{'y', 0}, {'b', 1}, {'n', 2}, {'d', 3}, {'r', 4}, {'f', 5},
|
||||
{'g', 6}, {'8', 7}, {'e', 8}, {'j', 9}, {'k', 10}, {'m', 11},
|
||||
{'c', 12}, {'p', 13}, {'q', 14}, {'x', 15}, {'o', 16}, {'t', 17},
|
||||
{'1', 18}, {'u', 19}, {'w', 20}, {'i', 21}, {'s', 22}, {'z', 23},
|
||||
{'a', 24}, {'3', 25}, {'4', 26}, {'5', 27}, {'h', 28}, {'7', 29},
|
||||
{'6', 30}, {'9', 31}};
|
||||
|
||||
template < int a, int b >
|
||||
static size_t
|
||||
DecodeSize(size_t sz)
|
||||
{
|
||||
auto d = div(sz, a);
|
||||
if(d.rem)
|
||||
d.quot++;
|
||||
return b * d.quot;
|
||||
}
|
||||
|
||||
template < typename Stack, typename V >
|
||||
bool
|
||||
Base32Decode(const Stack& stack, V& value)
|
||||
{
|
||||
int tmp = 0, bits = 0;
|
||||
size_t ret = 0;
|
||||
size_t len = DecodeSize< 5, 8 >(value.size());
|
||||
size_t outLen = value.size();
|
||||
for(size_t i = 0; i < len; i++)
|
||||
{
|
||||
char ch = stack[i];
|
||||
if(ch)
|
||||
{
|
||||
auto itr = zbase32_reverse_alpha.find(ch);
|
||||
if(itr == zbase32_reverse_alpha.end())
|
||||
return false;
|
||||
ch = itr->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ret == outLen;
|
||||
}
|
||||
tmp |= ch;
|
||||
bits += 5;
|
||||
if(bits >= 8)
|
||||
{
|
||||
if(ret >= outLen)
|
||||
return false;
|
||||
value[ret] = tmp >> (bits - 8);
|
||||
bits -= 8;
|
||||
ret++;
|
||||
}
|
||||
tmp <<= 5;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// adapted from i2pd
|
||||
template < typename V, typename Stack >
|
||||
const char*
|
||||
Base32Encode(const V& value, Stack& stack)
|
||||
{
|
||||
size_t ret = 0, pos = 1;
|
||||
int bits = 8, tmp = value[0];
|
||||
size_t len = value.size();
|
||||
while(ret < sizeof(stack) && (bits > 0 || pos < len))
|
||||
{
|
||||
if(bits < 5)
|
||||
{
|
||||
if(pos < len)
|
||||
{
|
||||
tmp <<= 8;
|
||||
tmp |= value[pos] & 0xFF;
|
||||
pos++;
|
||||
bits += 8;
|
||||
}
|
||||
else // last byte
|
||||
{
|
||||
tmp <<= (5 - bits);
|
||||
bits = 5;
|
||||
}
|
||||
}
|
||||
|
||||
bits -= 5;
|
||||
int ind = (tmp >> bits) & 0x1F;
|
||||
if(ret < sizeof(stack))
|
||||
{
|
||||
stack[ret] = zbase32_alpha[ind];
|
||||
ret++;
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
return &stack[0];
|
||||
}
|
||||
|
||||
/// encode V as hex to stack
|
||||
/// null terminate
|
||||
/// return pointer to base of stack buffer on success otherwise returns
|
||||
/// nullptr
|
||||
template < typename V, typename Stack >
|
||||
const char*
|
||||
HexEncode(const V& value, Stack& stack)
|
||||
{
|
||||
size_t idx = 0;
|
||||
char* ptr = &stack[0];
|
||||
char* end = ptr + sizeof(stack);
|
||||
while(idx < value.size())
|
||||
{
|
||||
auto wrote = snprintf(ptr, end - ptr, "%.2x", value[idx]);
|
||||
if(wrote == -1)
|
||||
return nullptr;
|
||||
ptr += wrote;
|
||||
idx++;
|
||||
}
|
||||
*ptr = 0;
|
||||
return &stack[0];
|
||||
}
|
||||
|
||||
int
|
||||
char2int(char input);
|
||||
|
||||
bool
|
||||
HexDecode(const char* src, uint8_t* target, size_t sz);
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
#ifndef LLARP_EXIT_HPP
|
||||
#define LLARP_EXIT_HPP
|
||||
#include <llarp/exit/context.hpp>
|
||||
#include <llarp/exit/policy.hpp>
|
||||
#include <llarp/exit/session.hpp>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#ifndef LLARP_LINK_LAYER_HPP
|
||||
#define LLARP_LINK_LAYER_HPP
|
||||
#include <llarp/link/server.hpp>
|
||||
#include <llarp/link/session.hpp>
|
||||
constexpr size_t MAX_LINK_MSG_SIZE = 8192;
|
||||
constexpr llarp_time_t DefaultLinkSessionLifetime = 10 * 1000;
|
||||
#endif
|
@ -1,278 +0,0 @@
|
||||
#ifndef LLARP_LOGGER_HPP
|
||||
#define LLARP_LOGGER_HPP
|
||||
#include <llarp/time.hpp>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <llarp/threading.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#ifdef _WIN32
|
||||
#define VC_EXTRALEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
#ifdef RPI
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
// probably will need to move out of llarp namespace for c api
|
||||
enum LogLevel
|
||||
{
|
||||
eLogDebug,
|
||||
eLogInfo,
|
||||
eLogWarn,
|
||||
eLogError,
|
||||
eLogNone
|
||||
};
|
||||
|
||||
struct Logger
|
||||
{
|
||||
std::string nodeName;
|
||||
LogLevel minlevel = eLogInfo;
|
||||
std::ostream& out;
|
||||
|
||||
std::function< void(const std::string&) > customLog;
|
||||
|
||||
llarp::util::Mutex access;
|
||||
#ifdef _WIN32
|
||||
bool isConsoleModern =
|
||||
true; // qol fix so oldfag clients don't see ugly escapes
|
||||
HANDLE fd1 = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
|
||||
short old_attrs;
|
||||
#endif
|
||||
Logger() : Logger(std::cout, "unnamed")
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Attempt to use ANSI escapes directly
|
||||
// if the modern console is active.
|
||||
DWORD mode_flags;
|
||||
|
||||
GetConsoleMode(fd1, &mode_flags);
|
||||
// since release SDKs don't have ANSI escape support yet
|
||||
// we get all or nothing: if we can't get it, then we wouldn't
|
||||
// be able to get any of them individually
|
||||
mode_flags |= 0x0004 | 0x0008;
|
||||
BOOL t = SetConsoleMode(fd1, mode_flags);
|
||||
if(!t)
|
||||
this->isConsoleModern = false; // fall back to setting colours manually
|
||||
#endif
|
||||
}
|
||||
|
||||
Logger(std::ostream& o, const std::string& name) : nodeName(name), out(o)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
extern Logger _glog;
|
||||
|
||||
void
|
||||
SetLogLevel(LogLevel lvl);
|
||||
|
||||
/** internal */
|
||||
template < typename TArg >
|
||||
void
|
||||
LogAppend(std::stringstream& ss, TArg&& arg) noexcept
|
||||
{
|
||||
ss << std::forward< TArg >(arg);
|
||||
}
|
||||
/** internal */
|
||||
template < typename TArg, typename... TArgs >
|
||||
void
|
||||
LogAppend(std::stringstream& ss, TArg&& arg, TArgs&&... args) noexcept
|
||||
{
|
||||
LogAppend(ss, std::forward< TArg >(arg));
|
||||
LogAppend(ss, std::forward< TArgs >(args)...);
|
||||
}
|
||||
|
||||
static inline std::string
|
||||
thread_id_string()
|
||||
{
|
||||
auto tid = std::this_thread::get_id();
|
||||
std::hash< std::thread::id > h;
|
||||
uint16_t id = h(tid) % 1000;
|
||||
#if defined(ANDROID) || defined(RPI)
|
||||
char buff[8] = {0};
|
||||
snprintf(buff, sizeof(buff), "%u", id);
|
||||
return buff;
|
||||
#else
|
||||
return std::to_string(id);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct log_timestamp
|
||||
{
|
||||
const char* format;
|
||||
|
||||
log_timestamp(const char* fmt = "%c %Z") : format(fmt)
|
||||
{
|
||||
}
|
||||
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& out, const log_timestamp& ts)
|
||||
{
|
||||
#if defined(ANDROID) || defined(RPI)
|
||||
(void)ts;
|
||||
return out << time_now_ms();
|
||||
#else
|
||||
auto now = llarp::Clock_t::to_time_t(llarp::Clock_t::now());
|
||||
return out << std::put_time(std::localtime(&now), ts.format);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/** internal */
|
||||
template < typename... TArgs >
|
||||
void
|
||||
_Log(LogLevel lvl, const char* fname, int lineno, TArgs&&... args) noexcept
|
||||
{
|
||||
if(_glog.minlevel > lvl)
|
||||
return;
|
||||
|
||||
std::stringstream ss;
|
||||
#ifdef ANDROID
|
||||
int loglev = -1;
|
||||
switch(lvl)
|
||||
{
|
||||
case eLogNone:
|
||||
break;
|
||||
case eLogDebug:
|
||||
ss << "[DBG] ";
|
||||
loglev = ANDROID_LOG_DEBUG;
|
||||
break;
|
||||
case eLogInfo:
|
||||
ss << "[NFO] ";
|
||||
loglev = ANDROID_LOG_INFO;
|
||||
break;
|
||||
case eLogWarn:
|
||||
ss << "[WRN] ";
|
||||
loglev = ANDROID_LOG_WARN;
|
||||
break;
|
||||
case eLogError:
|
||||
ss << "[ERR] ";
|
||||
loglev = ANDROID_LOG_ERROR;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
if(_glog.isConsoleModern)
|
||||
{
|
||||
#endif
|
||||
switch(lvl)
|
||||
{
|
||||
case eLogNone:
|
||||
break;
|
||||
case eLogDebug:
|
||||
ss << (char)27 << "[0m";
|
||||
ss << "[DBG] ";
|
||||
break;
|
||||
case eLogInfo:
|
||||
ss << (char)27 << "[1m";
|
||||
ss << "[NFO] ";
|
||||
break;
|
||||
case eLogWarn:
|
||||
ss << (char)27 << "[1;33m";
|
||||
ss << "[WRN] ";
|
||||
break;
|
||||
case eLogError:
|
||||
ss << (char)27 << "[1;31m";
|
||||
ss << "[ERR] ";
|
||||
break;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
}
|
||||
else // legacy console
|
||||
{
|
||||
// these _should_ be low white on black
|
||||
GetConsoleScreenBufferInfo(_glog.fd1, &_glog.consoleInfo);
|
||||
_glog.old_attrs = _glog.consoleInfo.wAttributes;
|
||||
switch(lvl)
|
||||
{
|
||||
case eLogNone:
|
||||
break;
|
||||
case eLogDebug:
|
||||
SetConsoleTextAttribute(_glog.fd1,
|
||||
FOREGROUND_RED | FOREGROUND_GREEN
|
||||
| FOREGROUND_BLUE); // low white on black
|
||||
ss << "[DBG] ";
|
||||
break;
|
||||
case eLogInfo:
|
||||
SetConsoleTextAttribute(
|
||||
_glog.fd1,
|
||||
FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN
|
||||
| FOREGROUND_BLUE); // high white on black
|
||||
ss << "[NFO] ";
|
||||
break;
|
||||
case eLogWarn:
|
||||
SetConsoleTextAttribute(_glog.fd1,
|
||||
FOREGROUND_RED | FOREGROUND_GREEN
|
||||
| FOREGROUND_INTENSITY); // bright yellow
|
||||
ss << "[WRN] ";
|
||||
break;
|
||||
case eLogError:
|
||||
SetConsoleTextAttribute(
|
||||
_glog.fd1, FOREGROUND_RED | FOREGROUND_INTENSITY); // bright red
|
||||
ss << "[ERR] ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
std::string tag = fname;
|
||||
ss << _glog.nodeName << " (" << thread_id_string() << ") "
|
||||
<< log_timestamp() << " " << tag << ":" << lineno;
|
||||
ss << "\t";
|
||||
LogAppend(ss, std::forward< TArgs >(args)...);
|
||||
#ifndef ANDROID
|
||||
#ifdef _WIN32
|
||||
if(_glog.isConsoleModern)
|
||||
{
|
||||
#endif
|
||||
ss << (char)27 << "[0;0m";
|
||||
_glog.out << ss.str() << std::endl;
|
||||
#ifdef _WIN32
|
||||
}
|
||||
else
|
||||
{
|
||||
_glog.out << ss.str() << std::endl;
|
||||
SetConsoleTextAttribute(
|
||||
_glog.fd1, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
{
|
||||
tag = "LOKINET|" + tag;
|
||||
__android_log_write(loglev, tag.c_str(), ss.str().c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace llarp
|
||||
|
||||
#define LogDebug(x, ...) \
|
||||
_Log(llarp::eLogDebug, LOG_TAG, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogInfo(x, ...) \
|
||||
_Log(llarp::eLogInfo, LOG_TAG, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogWarn(x, ...) \
|
||||
_Log(llarp::eLogWarn, LOG_TAG, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogError(x, ...) \
|
||||
_Log(llarp::eLogError, LOG_TAG, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogDebugTag(tag, x, ...) \
|
||||
_Log(llarp::eLogDebug, tag, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogInfoTag(tag, x, ...) \
|
||||
_Log(llarp::eLogInfo, tag, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogWarnTag(tag, x, ...) \
|
||||
_Log(llarp::eLogWarn, tag, __LINE__, x, ##__VA_ARGS__)
|
||||
#define LogErrorTag(tag, x, ...) \
|
||||
_Log(llarp::eLogError, tag, __LINE__, x, ##__VA_ARGS__)
|
||||
|
||||
#ifndef LOG_TAG
|
||||
#define LOG_TAG "default"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,105 +0,0 @@
|
||||
#ifndef LLARP_MEM_HPP
|
||||
#define LLARP_MEM_HPP
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/mem.h>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
void
|
||||
Zero(void *ptr, size_t sz);
|
||||
|
||||
template < typename T >
|
||||
void
|
||||
dumphex(const uint8_t *t)
|
||||
{
|
||||
size_t idx = 0;
|
||||
while(idx < sizeof(T))
|
||||
{
|
||||
printf("%.2x ", t[idx++]);
|
||||
if(idx % 8 == 0)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
template < typename T, size_t align = 128 >
|
||||
void
|
||||
DumpBufferHex(const T &buff)
|
||||
{
|
||||
size_t idx = 0;
|
||||
printf("buffer of size %zu\n", buff.sz);
|
||||
while(idx < buff.sz)
|
||||
{
|
||||
if(buff.base + idx == buff.cur)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
printf("%c[1;31m", 27);
|
||||
#endif
|
||||
}
|
||||
printf("%.2x", buff.base[idx]);
|
||||
if(buff.base + idx == buff.cur)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
printf("%c[0;0m", 27);
|
||||
#endif
|
||||
}
|
||||
++idx;
|
||||
if(idx % align == 0)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
template < typename T, size_t align = 128 >
|
||||
void
|
||||
DumpBuffer(const T &buff)
|
||||
{
|
||||
size_t idx = 0;
|
||||
printf("buffer of size %zu\n", buff.sz);
|
||||
while(idx < buff.sz)
|
||||
{
|
||||
if(buff.base + idx == buff.cur)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
printf("%c[1;31m", 27);
|
||||
#endif
|
||||
}
|
||||
if(std::isprint(buff.base[idx]))
|
||||
{
|
||||
printf("%c", buff.base[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(".");
|
||||
}
|
||||
if(buff.base + idx == buff.cur)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
printf("%c[0;0m", 27);
|
||||
#endif
|
||||
}
|
||||
++idx;
|
||||
if(idx % align == 0)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#if __cplusplus < 201402L
|
||||
namespace std
|
||||
{
|
||||
template < typename T, typename... Args >
|
||||
std::unique_ptr< T >
|
||||
make_unique(Args &&... args)
|
||||
{
|
||||
return std::unique_ptr< T >(new T(std::forward< Args >(args)...));
|
||||
}
|
||||
} // namespace std
|
||||
#endif
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
#ifndef LLARP_MESSAGES_HPP
|
||||
#define LLARP_MESSAGES_HPP
|
||||
|
||||
/**
|
||||
include shortcut for all link and routing messages
|
||||
*/
|
||||
|
||||
#include <llarp/messages/dht_immediate.hpp>
|
||||
#include <llarp/messages/link_intro.hpp>
|
||||
#include <llarp/messages/relay.hpp>
|
||||
#include <llarp/messages/relay_commit.hpp>
|
||||
#include <llarp/messages/discard.hpp>
|
||||
#include <llarp/messages/path_confirm.hpp>
|
||||
#include <llarp/messages/exit.hpp>
|
||||
#include <llarp/messages/transfer_traffic.hpp>
|
||||
|
||||
#endif
|
@ -1,111 +0,0 @@
|
||||
#ifndef LLARP_RC_HPP
|
||||
#define LLARP_RC_HPP
|
||||
#include <llarp/address_info.hpp>
|
||||
#include <llarp/crypto.h>
|
||||
#include <llarp/bencode.hpp>
|
||||
#include <llarp/exit_info.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define MAX_RC_SIZE (1024)
|
||||
#define NICKLEN (32)
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
struct RouterContact final : public IBEncodeMessage
|
||||
{
|
||||
RouterContact() : IBEncodeMessage()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
RouterContact(const RouterContact &other)
|
||||
: IBEncodeMessage()
|
||||
, addrs(other.addrs)
|
||||
, enckey(other.enckey)
|
||||
, pubkey(other.pubkey)
|
||||
, exits(other.exits)
|
||||
, signature(other.signature)
|
||||
, nickname(other.nickname)
|
||||
, last_updated(other.last_updated)
|
||||
{
|
||||
version = other.version;
|
||||
}
|
||||
|
||||
// advertised addresses
|
||||
std::vector< AddressInfo > addrs;
|
||||
// public encryption public key
|
||||
llarp::PubKey enckey;
|
||||
// public signing public key
|
||||
llarp::PubKey pubkey;
|
||||
// advertised exits
|
||||
std::vector< ExitInfo > exits;
|
||||
// signature
|
||||
llarp::Signature signature;
|
||||
/// node nickname, yw kee
|
||||
llarp::AlignedBuffer< NICKLEN > nickname;
|
||||
|
||||
uint64_t last_updated;
|
||||
|
||||
bool
|
||||
BEncode(llarp_buffer_t *buf) const override;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
bool
|
||||
IsExit() const
|
||||
{
|
||||
return exits.size() > 0;
|
||||
}
|
||||
|
||||
bool
|
||||
BDecode(llarp_buffer_t *buf) override
|
||||
{
|
||||
Clear();
|
||||
return IBEncodeMessage::BDecode(buf);
|
||||
}
|
||||
|
||||
bool
|
||||
DecodeKey(llarp_buffer_t k, llarp_buffer_t *buf) override;
|
||||
|
||||
RouterContact &
|
||||
operator=(const RouterContact &other);
|
||||
|
||||
bool
|
||||
HasNick() const;
|
||||
|
||||
std::string
|
||||
Nick() const;
|
||||
|
||||
bool
|
||||
IsPublicRouter() const;
|
||||
|
||||
void
|
||||
SetNick(const std::string &nick);
|
||||
|
||||
bool
|
||||
Verify(llarp::Crypto *crypto) const;
|
||||
|
||||
bool
|
||||
Sign(llarp::Crypto *crypto, const llarp::SecretKey &secret);
|
||||
|
||||
bool
|
||||
OtherIsNewer(const RouterContact &other) const
|
||||
{
|
||||
return last_updated < other.last_updated;
|
||||
}
|
||||
|
||||
bool
|
||||
Read(const char *fname);
|
||||
|
||||
bool
|
||||
Write(const char *fname) const;
|
||||
|
||||
private:
|
||||
bool
|
||||
VerifySignature(llarp::Crypto *crypto) const;
|
||||
};
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -1,12 +0,0 @@
|
||||
#ifndef LLARP_SERVICE_HPP
|
||||
#define LLARP_SERVICE_HPP
|
||||
#include <iostream>
|
||||
#include <llarp/service/Identity.hpp>
|
||||
#include <llarp/service/Intro.hpp>
|
||||
#include <llarp/service/IntroSet.hpp>
|
||||
#include <llarp/service/config.hpp>
|
||||
#include <llarp/service/context.hpp>
|
||||
#include <llarp/service/endpoint.hpp>
|
||||
#include <llarp/service/types.hpp>
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
#ifndef LLARP_SERVICE_TYPES_HPP
|
||||
#define LLARP_SERVICE_TYPES_HPP
|
||||
#include <llarp/service/address.hpp>
|
||||
#include <llarp/service/vanity.hpp>
|
||||
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
#ifndef LLARP_STR_HPP
|
||||
#define LLARP_STR_HPP
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
bool
|
||||
StrEq(const char *s1, const char *s2);
|
||||
|
||||
bool
|
||||
IsFalseValue(const char *str);
|
||||
|
||||
bool
|
||||
IsTrueValue(const char *str);
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
@ -1,12 +1,13 @@
|
||||
#ifndef LLARP_ALIGNED_HPP
|
||||
#define LLARP_ALIGNED_HPP
|
||||
|
||||
#include <llarp/bencode.h>
|
||||
#include <llarp/crypto.h>
|
||||
#include <bencode.h>
|
||||
#include <crypto.h>
|
||||
#include <encode.hpp>
|
||||
#include <logger.hpp>
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <llarp/encode.hpp>
|
||||
#include <llarp/logger.hpp>
|
||||
|
||||
extern "C"
|
||||
{
|
@ -1,8 +1,10 @@
|
||||
#ifndef LLARP_BENCODE_H
|
||||
#define LLARP_BENCODE_H
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/common.hpp>
|
||||
#include <llarp/proto.hpp>
|
||||
|
||||
#include <buffer.h>
|
||||
#include <common.hpp>
|
||||
#include <proto.hpp>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
@ -1,10 +1,11 @@
|
||||
#ifndef LLARP_BENCODE_HPP
|
||||
#define LLARP_BENCODE_HPP
|
||||
|
||||
#include <llarp/bencode.h>
|
||||
#include <llarp/buffer.hpp>
|
||||
#include <llarp/logger.hpp>
|
||||
#include <llarp/mem.hpp>
|
||||
#include <buffer.hpp>
|
||||
#include <bencode.h>
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <fstream>
|
||||
|
@ -1,7 +1,9 @@
|
||||
#ifndef LLARP_BUFFER_H_
|
||||
#define LLARP_BUFFER_H_
|
||||
#include <llarp/common.hpp>
|
||||
#include <llarp/mem.h>
|
||||
|
||||
#include <common.hpp>
|
||||
#include <mem.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
@ -1 +1,57 @@
|
||||
#include <llarp/buffer.hpp>
|
||||
#ifndef LLARP_BUFFER_HPP
|
||||
#define LLARP_BUFFER_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
StackBuffer(T& stack)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = &stack[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = sizeof(stack);
|
||||
return buff;
|
||||
}
|
||||
|
||||
/** initialize llarp_buffer_t from raw memory */
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
InitBuffer(T buf, size_t sz)
|
||||
{
|
||||
byte_t* ptr = (byte_t*)buf;
|
||||
llarp_buffer_t ret;
|
||||
ret.cur = ptr;
|
||||
ret.base = ptr;
|
||||
ret.sz = sz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** initialize llarp_buffer_t from container */
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
Buffer(T& t)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = &t[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = t.size();
|
||||
return buff;
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
llarp_buffer_t
|
||||
ConstBuffer(const T& t)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = (byte_t*)&t[0];
|
||||
buff.cur = buff.base;
|
||||
buff.sz = t.size();
|
||||
return buff;
|
||||
}
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef LLARP_CODEL_QUEUE_HPP
|
||||
#define LLARP_CODEL_QUEUE_HPP
|
||||
#include <llarp/time.hpp>
|
||||
#include <llarp/logger.hpp>
|
||||
#include <llarp/mem.hpp>
|
||||
#include <llarp/threading.hpp>
|
||||
|
||||
#include <logger.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <threading.hpp>
|
||||
#include <time.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
namespace llarp
|
@ -1,7 +1,8 @@
|
||||
#ifndef LLARP_CRYPTO_H_
|
||||
#define LLARP_CRYPTO_H_
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/common.hpp>
|
||||
#include <buffer.h>
|
||||
#include <common.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
@ -1 +1,83 @@
|
||||
#include <llarp/crypto.hpp>
|
||||
#ifndef LLARP_CRYPTO_HPP
|
||||
#define LLARP_CRYPTO_HPP
|
||||
|
||||
#include <aligned.hpp>
|
||||
#include <crypto.h>
|
||||
#include <mem.h>
|
||||
#include <router_id.hpp>
|
||||
#include <threadpool.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
const byte_t*
|
||||
seckey_topublic(const byte_t* secret);
|
||||
|
||||
const byte_t*
|
||||
pq_keypair_to_public(const byte_t* keypair);
|
||||
|
||||
const byte_t*
|
||||
pq_keypair_to_secret(const byte_t* keypair);
|
||||
|
||||
using SharedSecret = AlignedBuffer< SHAREDKEYSIZE >;
|
||||
using KeyExchangeNonce = AlignedBuffer< 32 >;
|
||||
|
||||
struct PubKey final : public AlignedBuffer< PUBKEYSIZE >
|
||||
{
|
||||
PubKey() : AlignedBuffer< PUBKEYSIZE >(){};
|
||||
PubKey(const byte_t* ptr) : AlignedBuffer< PUBKEYSIZE >(ptr){};
|
||||
|
||||
std::string
|
||||
ToString() const;
|
||||
|
||||
bool
|
||||
FromString(const std::string& str);
|
||||
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& out, const PubKey& k)
|
||||
{
|
||||
return out << k.ToString();
|
||||
}
|
||||
|
||||
operator RouterID() const
|
||||
{
|
||||
return RouterID(data());
|
||||
}
|
||||
|
||||
PubKey&
|
||||
operator=(const byte_t* ptr)
|
||||
{
|
||||
memcpy(data(), ptr, size());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct SecretKey final : public AlignedBuffer< SECKEYSIZE >
|
||||
{
|
||||
friend std::ostream&
|
||||
operator<<(std::ostream& out, const SecretKey&)
|
||||
{
|
||||
// make sure we never print out secret keys
|
||||
return out << "[secretkey]";
|
||||
}
|
||||
|
||||
SecretKey&
|
||||
operator=(const byte_t* ptr)
|
||||
{
|
||||
memcpy(data(), ptr, size());
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
using ShortHash = AlignedBuffer< SHORTHASHSIZE >;
|
||||
using Signature = AlignedBuffer< SIGSIZE >;
|
||||
using TunnelNonce = AlignedBuffer< TUNNONCESIZE >;
|
||||
using SymmNonce = AlignedBuffer< NONCESIZE >;
|
||||
using SymmKey = AlignedBuffer< 32 >;
|
||||
|
||||
using PQCipherBlock = AlignedBuffer< PQ_CIPHERTEXTSIZE + 1 >;
|
||||
using PQPubKey = AlignedBuffer< PQ_PUBKEYSIZE >;
|
||||
using PQKeyPair = AlignedBuffer< PQ_KEYPAIRSIZE >;
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef LLARP_DHT_H_
|
||||
#define LLARP_DHT_H_
|
||||
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/crypto.hpp>
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <crypto.hpp>
|
||||
#include <buffer.h>
|
||||
#include <router_contact.hpp>
|
||||
|
||||
/**
|
||||
* dht.h
|
@ -0,0 +1,5 @@
|
||||
#include <dht/context.hpp>
|
||||
#include <dht/key.hpp>
|
||||
#include <dht/message.hpp>
|
||||
#include <dht/messages/all.hpp>
|
||||
#include <dht/node.hpp>
|
@ -1,8 +1,8 @@
|
||||
#ifndef LLARP_DHT_BUCKET_HPP
|
||||
#define LLARP_DHT_BUCKET_HPP
|
||||
|
||||
#include <llarp/dht/kademlia.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <dht/kademlia.hpp>
|
||||
#include <dht/key.hpp>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
@ -1,14 +1,14 @@
|
||||
#ifndef LLARP_DHT_CONTEXT_HPP
|
||||
#define LLARP_DHT_CONTEXT_HPP
|
||||
|
||||
#include <llarp/dht.h>
|
||||
#include <llarp/dht/bucket.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/dht/messages/findintro.hpp>
|
||||
#include <llarp/dht/node.hpp>
|
||||
#include <llarp/service/IntroSet.hpp>
|
||||
#include <llarp/time.hpp>
|
||||
#include <dht.h>
|
||||
#include <dht/bucket.hpp>
|
||||
#include <dht/key.hpp>
|
||||
#include <dht/message.hpp>
|
||||
#include <dht/messages/findintro.hpp>
|
||||
#include <dht/node.hpp>
|
||||
#include <service/IntroSet.hpp>
|
||||
#include <time.hpp>
|
||||
|
||||
#include <set>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LLARP_DHT_KADEMLIA_HPP
|
||||
#define LLARP_DHT_KADEMLIA_HPP
|
||||
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <dht/key.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,10 +1,11 @@
|
||||
#ifndef LLARP_DHT_MESSAGE_HPP
|
||||
#define LLARP_DHT_MESSAGE_HPP
|
||||
|
||||
#include <llarp/dht.h>
|
||||
#include <llarp/bencode.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <llarp/path_types.hpp>
|
||||
#include <bencode.hpp>
|
||||
#include <dht.h>
|
||||
#include <dht/key.hpp>
|
||||
#include <path_types.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
@ -0,0 +1,8 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_ALL_HPP
|
||||
#define LLARP_DHT_MESSAGES_ALL_HPP
|
||||
#include <dht/messages/findintro.hpp>
|
||||
#include <dht/messages/findrouter.hpp>
|
||||
#include <dht/messages/gotintro.hpp>
|
||||
#include <dht/messages/gotrouter.hpp>
|
||||
#include <dht/messages/pubintro.hpp>
|
||||
#endif
|
@ -1,9 +1,10 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
||||
#define LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/routing/message.hpp>
|
||||
#include <llarp/service/address.hpp>
|
||||
#include <llarp/service/tag.hpp>
|
||||
|
||||
#include <dht/message.hpp>
|
||||
#include <routing/message.hpp>
|
||||
#include <service/address.hpp>
|
||||
#include <service/tag.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_FIND_ROUTER_HPP
|
||||
#define LLARP_DHT_MESSAGES_FIND_ROUTER_HPP
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <dht/message.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,7 +1,9 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_GOT_INTRO_HPP
|
||||
#define LLARP_DHT_MESSAGES_GOT_INTRO_HPP
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/service/IntroSet.hpp>
|
||||
|
||||
#include <dht/message.hpp>
|
||||
#include <service/IntroSet.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
@ -1,7 +1,7 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_GOT_ROUTER_HPP
|
||||
#define LLARP_DHT_MESSAGES_GOT_ROUTER_HPP
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <dht/message.hpp>
|
||||
#include <router_contact.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
#ifndef LLARP_DHT_MESSAGES_PUB_INTRO_HPP
|
||||
#define LLARP_DHT_MESSAGES_PUB_INTRO_HPP
|
||||
#include <llarp/dht/message.hpp>
|
||||
#include <llarp/service/IntroSet.hpp>
|
||||
#include <dht/message.hpp>
|
||||
#include <service/IntroSet.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
@ -1,9 +1,9 @@
|
||||
#ifndef LLARP_DHT_NODE_HPP
|
||||
#define LLARP_DHT_NODE_HPP
|
||||
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <llarp/service/IntroSet.hpp>
|
||||
#include <dht/key.hpp>
|
||||
#include <router_contact.hpp>
|
||||
#include <service/IntroSet.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,18 +1,19 @@
|
||||
#ifndef LIBLLARP_DNS_HPP
|
||||
#define LIBLLARP_DNS_HPP
|
||||
|
||||
#include <llarp/dns.h>
|
||||
#include <dns.h>
|
||||
#include <sys/types.h> // for uint & ssize_t
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include <llarp/net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <llarp/dns_rectypes.hpp>
|
||||
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <dns_rectypes.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define LLARP_DNS_RECTYPE_A 1
|
||||
#define LLARP_DNS_RECTYPE_NS 2
|
@ -0,0 +1,5 @@
|
||||
#include <dns/name.hpp>
|
||||
#include <dns/rr.hpp>
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/message.hpp>
|
||||
#include <dns/server.hpp>
|
@ -1,8 +1,8 @@
|
||||
#ifndef LLARP_DNS_MESSAGE_HPP
|
||||
#define LLARP_DNS_MESSAGE_HPP
|
||||
#include <llarp/dns/serialize.hpp>
|
||||
#include <llarp/dns/rr.hpp>
|
||||
#include <llarp/dns/question.hpp>
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/rr.hpp>
|
||||
#include <dns/question.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,9 +1,10 @@
|
||||
#ifndef LLARP_DNS_NAME_HPP
|
||||
#define LLARP_DNS_NAME_HPP
|
||||
|
||||
#include <buffer.h>
|
||||
#include <net_int.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <llarp/buffer.h>
|
||||
#include <llarp/net_int.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,8 +1,9 @@
|
||||
#ifndef LLARP_DNS_QUESTION_HPP
|
||||
#define LLARP_DNS_QUESTION_HPP
|
||||
#include <llarp/dns/serialize.hpp>
|
||||
#include <llarp/dns/name.hpp>
|
||||
#include <llarp/net_int.hpp>
|
||||
|
||||
#include <dns/serialize.hpp>
|
||||
#include <dns/name.hpp>
|
||||
#include <net_int.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,10 +1,12 @@
|
||||
#ifndef LLARP_DNS_RR_HPP
|
||||
#define LLARP_DNS_RR_HPP
|
||||
#include <llarp/dns/name.hpp>
|
||||
#include <llarp/dns/serialize.hpp>
|
||||
#include <llarp/net_int.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include <dns/name.hpp>
|
||||
#include <dns/serialize.hpp>
|
||||
#include <net_int.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#ifndef LLARP_DNS_SERIALIZE_HPP
|
||||
#define LLARP_DNS_SERIALIZE_HPP
|
||||
#include <llarp/buffer.h>
|
||||
#include <buffer.h>
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
@ -1,10 +1,10 @@
|
||||
#ifndef LLARP_DNS_SERVER_HPP
|
||||
#define LLARP_DNS_SERVER_HPP
|
||||
#include <llarp/string_view.hpp>
|
||||
#include <llarp/dns/message.hpp>
|
||||
|
||||
#include <llarp/ev.h>
|
||||
#include <llarp/net.hpp>
|
||||
#include <dns/message.hpp>
|
||||
#include <ev.h>
|
||||
#include <net.hpp>
|
||||
#include <string_view.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef LIBLLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
#define LIBLLARP_DNS_DOTLOKILOOKUP_HPP
|
||||
|
||||
#include <llarp/service/address.hpp>
|
||||
#include <dnsd.hpp>
|
||||
#include <service/address.hpp>
|
||||
|
||||
#include "dnsd.hpp"
|
||||
|
||||
using map_address_hook_func =
|
||||
std::function< bool(const byte_t *addr, bool isSNode, uint32_t ip) >;
|
@ -1,11 +1,12 @@
|
||||
#ifndef LIBLLARP_DNSIPTRACKER_HPP
|
||||
#define LIBLLARP_DNSIPTRACKER_HPP
|
||||
|
||||
#include <llarp/net.hpp>
|
||||
#include <dns_dotlokilookup.hpp>
|
||||
#include <net.hpp>
|
||||
#include <service/address.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <llarp/service/address.hpp>
|
||||
#include "dns_dotlokilookup.hpp"
|
||||
|
||||
// either a request or response?
|
||||
// neither, it's a result set row
|
@ -1,9 +1,9 @@
|
||||
#ifndef LIBLLARP_DNS_REC_TYPES_HPP
|
||||
#define LIBLLARP_DNS_REC_TYPES_HPP
|
||||
|
||||
#include <buffer.h> // for byte_t
|
||||
#include <net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
#include <vector>
|
||||
#include <llarp/buffer.h> // for byte_t
|
||||
#include <llarp/net.hpp> // for llarp::Addr , llarp::huint32_t
|
||||
|
||||
namespace llarp
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#ifndef LIBLLARP_DNSC_HPP
|
||||
#define LIBLLARP_DNSC_HPP
|
||||
|
||||
#include <llarp/ev.h> // for sockaadr
|
||||
#include <llarp/dns.hpp> // get protocol structs
|
||||
#include <ev.h> // for sockaadr
|
||||
#include <dns.hpp> // get protocol structs
|
||||
|
||||
// internal, non-public functions
|
||||
// well dnsc init/stop are public...
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue