Merge pull request #137 from michael-loki/header_cleanup

Move include/llarp headers to main llarp source dir
pull/140/head
Jeff 6 years ago committed by GitHub
commit 4941d7d453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,12 @@
#include <unistd.h>
#include <config.h>
#include <dns_dotlokilookup.hpp>
#include <dns_iptracker.hpp>
#include <dnsd.hpp>
#include <llarp.h>
#include <llarp/config.h>
#include <llarp/dns_iptracker.hpp>
#include <llarp/dnsd.hpp>
#include <llarp/dns_dotlokilookup.hpp>
#include <llarp/threading.hpp> // for multithreaded version (multiplatorm)
#include <threading.hpp> // for multithreaded version (multiplatorm)
#include <signal.h> // Linux needs this for SIGINT
#include <unistd.h>
#ifdef _WIN32
#define uint UINT

@ -1,12 +1,13 @@
#include <config.hpp> // for ensure_config
#include <fs.hpp>
#include <getopt.h>
#include <libgen.h>
#include <llarp.h>
#include <llarp/logger.hpp>
#include <logger.hpp>
#include <signal.h>
#include <getopt.h>
#include <string>
#include <iostream>
#include <libgen.h>
#include "fs.hpp"
#include "config.hpp" // for ensure_config
#ifdef _WIN32
#define wmin(x, y) (((x) < (y)) ? (x) : (y))

@ -1,20 +1,18 @@
#include <getopt.h>
#include <buffer.hpp>
#include <crypto.hpp>
#include <fs.hpp>
#include <llarp.h>
#include <signal.h>
#include "logger.hpp"
#include <llarp/nodedb.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/time.hpp>
#include <logger.hpp>
#include <messages/dht.hpp>
#include <net.hpp>
#include <nodedb.hpp>
#include <router.hpp>
#include <router_contact.hpp>
#include <time.hpp>
#include <fstream>
#include "buffer.hpp"
#include "crypto.hpp"
#include "fs.hpp"
#include "llarp/net.hpp"
#include <llarp/messages/dht.hpp>
#include <getopt.h>
#include <signal.h>
struct llarp_main *ctx = 0;

@ -1,15 +1,16 @@
#ifndef LLARP_H_
#define LLARP_H_
#include <llarp/dht.h>
#include <llarp/ev.h>
#include <llarp/logic.hpp>
#include <llarp/mem.h>
#include <llarp/version.hpp>
#include <dht.h>
#include <ev.h>
#include <logic.hpp>
#include <mem.h>
#include <version.hpp>
#ifdef __cplusplus
#include <llarp/service/address.hpp> // for service::address
#include <llarp/handlers/tun.hpp> // for handlers
#include <llarp/service/endpoint.hpp>
#include <handlers/tun.hpp> // for handlers
#include <service/address.hpp> // for service::address
#include <service/endpoint.hpp>
extern "C"
{

@ -1,10 +1,11 @@
#ifndef LLARP_HPP
#define LLARP_HPP
#include <iostream>
#include <crypto.h>
#include <llarp.h>
#include <llarp/crypto.h>
#include <llarp/threading.hpp>
#include <threading.hpp>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

@ -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,6 +1,7 @@
#ifndef LLARP_STRING_H
#define LLARP_STRING_H
#include <llarp/common.hpp>
#include <common.hpp>
#ifndef __FreeBSD__
#if !(__APPLE__ && __MACH__)

@ -2,7 +2,7 @@
//#include <string.h>
#include <jni.h>
#include <llarp.h>
#include <llarp/config.h>
#include <config.h>
#include <signal.h>
#include <memory>
#include <thread>
@ -15,7 +15,7 @@ struct AndroidMain
std::string configFile;
/// set configuration and ensure files
bool
bool
Configure(const char * conf, const char * basedir)
{
configFile = conf;
@ -84,7 +84,7 @@ struct AndroidMain
return "";
}
int GetIfRange() const
int GetIfRange() const
{
if(m_impl)
{
@ -95,7 +95,7 @@ struct AndroidMain
return -1;
}
void
void
SetVPN_FD(int fd)
{
if(m_impl)
@ -148,7 +148,7 @@ extern "C"
{
if(daemon->Start())
return env->NewStringUTF("ok");
else
else
return env->NewStringUTF("failed to start daemon");
}
else
@ -163,7 +163,7 @@ extern "C"
daemon->Stop();
}
}
JNIEXPORT void JNICALL
Java_network_loki_lokinet_Lokinet_1JNI_setVPNFileDescriptor(JNIEnv*, jclass, jint fd)
{
@ -207,4 +207,4 @@ extern "C"
daemon->Stop();
}
}
}
}

@ -1,14 +1,16 @@
#ifndef __ABYSS_CLIENT_HPP__
#define __ABYSS_CLIENT_HPP__
#include <string>
#include <memory>
#include <list>
#include <abyss/json.hpp>
#include <ev.h>
#include <string_view.hpp>
#include <deque>
#include <unordered_map>
#include <functional>
#include <llarp/string_view.hpp>
#include <abyss/json.hpp>
#include <llarp/ev.h>
#include <list>
#include <memory>
#include <string>
#include <unordered_map>
namespace abyss
{

@ -1,9 +1,10 @@
#ifndef __ABYSS_HTTP_HPP__
#define __ABYSS_HTTP_HPP__
#include <abyss/json.hpp>
#include <string_view.hpp>
#include <string>
#include <unordered_map>
#include <llarp/string_view.hpp>
#include <abyss/json.hpp>
namespace abyss
{

@ -1,14 +1,15 @@
#ifndef __ABYSS_SERVER_HPP__
#define __ABYSS_SERVER_HPP__
#include <llarp/ev.h>
#include <llarp/logic.hpp>
#include <llarp/string_view.hpp>
#include <llarp/time.hpp>
#include <abyss/json.hpp>
#include <ev.h>
#include <logic.hpp>
#include <string_view.hpp>
#include <time.hpp>
#include <list>
#include <memory>
#include <string>
#include <abyss/json.hpp>
#include <unordered_map>
namespace abyss

@ -1,5 +1,6 @@
#include <libabyss.hpp>
#include <llarp/net.hpp>
#include <net.hpp>
#ifndef _WIN32
#include <sys/signal.h>
#endif

@ -1,8 +1,8 @@
#include <abyss/client.hpp>
#include <abyss/http.hpp>
#include <llarp/logger.hpp>
#include <llarp/crypto.hpp>
#include <llarp/buffer.hpp>
#include <logger.hpp>
#include <crypto.hpp>
#include <buffer.hpp>
namespace abyss
{

@ -1,10 +1,11 @@
#include <llarp/string_view.hpp>
#include <abyss/json.hpp>
#include <vector>
#include <cstring>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <string_view.hpp>
#include <cstring>
#include <string>
#include <vector>
namespace abyss
{

@ -1,12 +1,13 @@
#include <abyss/server.hpp>
#include <abyss/http.hpp>
#include <llarp/time.hpp>
#include <llarp/buffer.hpp>
#include <abyss/server.hpp>
#include <buffer.hpp>
#include <logger.hpp>
#include <time.hpp>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <string>
#include <llarp/logger.hpp>
#include <algorithm>
#include <unordered_map>
namespace abyss
{

@ -1,11 +1,11 @@
#include <llarp/address_info.hpp>
#include <address_info.hpp>
#ifndef _WIN32
#include <arpa/inet.h>
#endif
#include <llarp/bencode.h>
#include <llarp/mem.h>
#include <llarp/string.h>
#include <llarp/net.hpp>
#include <bencode.h>
#include <mem.h>
#include <string.h>
#include <net.hpp>
namespace llarp
{
@ -25,17 +25,17 @@ namespace llarp
}
bool
AddressInfo::operator==(const AddressInfo &other) const
operator==(const AddressInfo& lhs, const AddressInfo& rhs)
{
// we don't care about rank
return pubkey == other.pubkey && port == other.port
&& dialect == other.dialect && ip == other.ip;
return lhs.pubkey == rhs.pubkey && lhs.port == rhs.port
&& lhs.dialect == rhs.dialect && lhs.ip == rhs.ip;
}
bool
AddressInfo::operator<(const AddressInfo &other) const
operator<(const AddressInfo& lhs, const AddressInfo& rhs)
{
return rank < other.rank || ip < other.ip || port < other.port;
return lhs.rank < rhs.rank || lhs.ip < rhs.ip || lhs.port < rhs.port;
}
bool

@ -1,15 +1,15 @@
#ifndef LLARP_AI_HPP
#define LLARP_AI_HPP
#include <llarp/crypto.h>
#include <llarp/mem.h>
#include <llarp/net.h>
#include <stdbool.h>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <bencode.hpp>
#include <crypto.h>
#include <crypto.hpp>
#include <mem.h>
#include <net.h>
#include <string>
#include <vector>
#include <stdbool.h>
/**
* address_info.hpp
@ -48,12 +48,6 @@ namespace llarp
AddressInfo&
operator=(const AddressInfo& other);
bool
operator==(const AddressInfo& other) const;
bool
operator<(const AddressInfo& other) const;
bool
BEncode(llarp_buffer_t* buf) const override;
@ -84,6 +78,13 @@ namespace llarp
};
};
bool
operator==(const AddressInfo& lhs, const AddressInfo& rhs);
bool
operator<(const AddressInfo& lhs, const AddressInfo& rhs);
} // 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,5 +1,5 @@
#include <llarp/bencode.h>
#include <llarp/logger.hpp>
#include <bencode.h>
#include <logger.hpp>
bool
bencode_write_bytestring(llarp_buffer_t* buff, const void* data, size_t sz)

@ -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,5 +1,6 @@
#include <llarp/buffer.h>
#include <llarp/endian.hpp>
#include <buffer.h>
#include <endian.hpp>
#include <stdarg.h>
#include <stdio.h>

@ -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,11 +1,11 @@
#include "config.hpp"
#include <llarp/config.h>
#include <llarp/defaults.hpp>
#include <llarp/net.hpp>
#include "fs.hpp"
#include "ini.hpp"
#include "logger.hpp"
#include "mem.hpp"
#include <config.h>
#include <config.hpp>
#include <defaults.hpp>
#include <fs.hpp>
#include <ini.hpp>
#include <logger.hpp>
#include <mem.hpp>
#include <net.hpp>
namespace llarp
{

@ -1,10 +1,10 @@
#ifndef LIBLLARP_CONFIG_HPP
#define LIBLLARP_CONFIG_HPP
#include <config.h>
#include <list>
#include <string>
#include <llarp/config.h>
namespace llarp
{
struct Config

@ -1,19 +1,19 @@
#include <dns_dotlokilookup.hpp>
#include <dnsd.hpp>
#include <ev.hpp>
#include <getopt.h>
#include <llarp.h>
#include <llarp/logger.h>
#include <signal.h>
#include <sys/param.h> // for MIN
#include <llarp.hpp>
#include <logger.h>
#include <router.hpp>
#include <signal.h>
#include <llarp/dnsd.hpp>
#include <llarp/dns_dotlokilookup.hpp>
#include <sys/param.h> // for MIN
#if(__FreeBSD__) || (__OpenBSD__) || (__NetBSD__)
#include <pthread_np.h>
#endif
#include "ev.hpp"
namespace llarp
{
@ -464,7 +464,6 @@ extern "C"
return nullptr;
}
//#include <llarp/service/context.hpp>
bool
main_router_endpoint_iterator(
struct llarp_main *ptr, struct llarp::service::Context::endpoint_iter &i)

@ -1,4 +1,4 @@
#include <llarp/crypto.hpp>
#include <crypto.hpp>
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,10 +1,10 @@
#include <assert.h>
#include <llarp/crypto.h>
#include <crypto.h>
#include <sodium/crypto_generichash.h>
#include <sodium/crypto_sign.h>
#include <sodium/crypto_scalarmult.h>
#include <sodium/crypto_stream_xchacha20.h>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include "mem.hpp"
extern "C"

@ -1,5 +1,5 @@
#include <llarp/dht.h>
#include <llarp/dht/context.hpp>
#include <dht.h>
#include <dht/context.hpp>
#include "router_contact.hpp"
llarp_dht_context::llarp_dht_context(llarp::Router *router)

@ -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,8 +1,9 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/gotrouter.hpp>
#include <llarp/messages/dht.hpp>
#include <llarp/messages/dht_immediate.hpp>
#include "router.hpp"
#include <dht/context.hpp>
#include <dht/messages/gotrouter.hpp>
#include <messages/dht.hpp>
#include <messages/dht_immediate.hpp>
#include <router.hpp>
#include <vector>
namespace llarp

@ -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,5 +1,5 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/all.hpp>
#include <dht/context.hpp>
#include <dht/messages/all.hpp>
namespace llarp
{

@ -1,4 +1,4 @@
#include <llarp/messages/dht_immediate.hpp>
#include <messages/dht_immediate.hpp>
#include <router.hpp>

@ -1,7 +1,7 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/findintro.hpp>
#include <llarp/dht/messages/gotintro.hpp>
#include <llarp/routing/message.hpp>
#include <dht/context.hpp>
#include <dht/messages/findintro.hpp>
#include <dht/messages/gotintro.hpp>
#include <routing/message.hpp>
namespace llarp
{

@ -1,8 +1,7 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/findrouter.hpp>
#include <llarp/dht/messages/gotrouter.hpp>
#include <llarp/messages/dht.hpp>
#include <dht/context.hpp>
#include <dht/messages/findrouter.hpp>
#include <dht/messages/gotrouter.hpp>
#include <messages/dht.hpp>
#include <router.hpp>
namespace llarp

@ -1,7 +1,6 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/gotintro.hpp>
#include <llarp/messages/dht.hpp>
#include <dht/context.hpp>
#include <dht/messages/gotintro.hpp>
#include <messages/dht.hpp>
#include <router.hpp>
namespace llarp

@ -1,6 +1,5 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/gotrouter.hpp>
#include <dht/context.hpp>
#include <dht/messages/gotrouter.hpp>
#include <router.hpp>

@ -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,6 +1,7 @@
#ifndef LLARP_DHT_KEY_HPP
#define LLARP_DHT_KEY_HPP
#include <llarp/aligned.hpp>
#include <aligned.hpp>
namespace llarp
{
@ -52,4 +53,4 @@ namespace llarp
} // namespace dht
} // namespace llarp
#endif
#endif

@ -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,8 +1,7 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/pubintro.hpp>
#include <llarp/messages/dht.hpp>
#include <llarp/messages/dht_immediate.hpp>
#include <dht/context.hpp>
#include <dht/messages/pubintro.hpp>
#include <messages/dht.hpp>
#include <messages/dht_immediate.hpp>
#include <router.hpp>
namespace llarp

@ -1,6 +1,6 @@
#include <llarp/endian.hpp>
#include <llarp/dnsd.hpp> // for llarp_handle_dnsd_recvfrom, dnsc
#include <llarp/logger.hpp>
#include <dnsd.hpp> // for llarp_handle_dnsd_recvfrom, dnsc
#include <endian.hpp>
#include <logger.hpp>
void
hexDump(const char *buffer, uint16_t size)

@ -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,7 +1,7 @@
#include <llarp/dns/message.hpp>
#include <llarp/endian.hpp>
#include <llarp/logger.hpp>
#include <llarp/buffer.hpp>
#include <buffer.hpp>
#include <dns/message.hpp>
#include <endian.hpp>
#include <logger.hpp>
namespace llarp
{

@ -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,7 +1,8 @@
#include <llarp/dns/name.hpp>
#include <llarp/net.hpp>
#include <sstream>
#include <dns/name.hpp>
#include <net.hpp>
#include <algorithm>
#include <sstream>
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,5 +1,5 @@
#include <llarp/dns/question.hpp>
#include <llarp/logger.hpp>
#include <dns/question.hpp>
#include <logger.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,5 +1,5 @@
#include <llarp/dns/rr.hpp>
#include <llarp/logger.hpp>
#include <dns/rr.hpp>
#include <logger.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,5 +1,5 @@
#include <llarp/dns/serialize.hpp>
#include <llarp/net_int.hpp>
#include <dns/serialize.hpp>
#include <net_int.hpp>
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,4 +1,4 @@
#include <llarp/dns/server.hpp>
#include <dns/server.hpp>
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,7 +1,7 @@
#include <llarp/dns_dotlokilookup.hpp>
#include <llarp/handlers/tun.hpp>
#include <llarp/service/context.hpp>
#include <llarp/logic.hpp>
#include <dns_dotlokilookup.hpp>
#include <handlers/tun.hpp>
#include <logic.hpp>
#include <service/context.hpp>
std::string const default_chars =
"abcdefghijklmnaoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";

@ -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,4 +1,4 @@
#include <llarp/dns_iptracker.hpp>
#include <dns_iptracker.hpp>
dns_iptracker g_dns_iptracker;

@ -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,5 +1,5 @@
#include <llarp/dns_rectypes.hpp>
#include <llarp/dns.hpp> // for vput16bits()
#include <dns.hpp> // for vput16bits()
#include <dns_rectypes.hpp>
namespace llarp
{

@ -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,4 +1,6 @@
#include <llarp/dnsc.hpp>
#include <dnsc.hpp>
#include <logger.hpp>
#include <net.hpp> // for llarp::Addr
#ifndef _WIN32
#include <arpa/inet.h>
@ -13,8 +15,6 @@
#include <unistd.h> /* close */
#include <algorithm> // for std::find_if
#include <llarp/net.hpp> // for llarp::Addr
#include <llarp/logger.hpp>
#include <stdio.h> // sprintf
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))

@ -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...

@ -1,5 +1,5 @@
#include <llarp/dnsd.hpp>
#include <llarp/net.hpp>
#include <dnsd.hpp>
#include <net.hpp>
extern dns_tracker dns_udp_tracker;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save