From 0b2ebc83e0b60f61cd7ce3caf8aab600f39f2275 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 22:45:37 +0000 Subject: [PATCH 1/9] De-C-ify several .h headers --- daemon/rcutil.cpp | 9 +++------ include/llarp/codel.hpp | 4 ++-- include/llarp/dht/context.hpp | 5 +++-- include/llarp/ev.h | 2 +- include/llarp/exit/endpoint.hpp | 4 ++-- include/llarp/ip.hpp | 2 +- include/llarp/link/server.hpp | 1 - include/llarp/link/session.hpp | 2 +- include/llarp/logger.hpp | 1 - include/llarp/logic.h | 2 +- include/llarp/path.hpp | 2 +- include/llarp/pathset.hpp | 2 +- include/llarp/rpc.hpp | 2 +- include/llarp/service/IntroSet.hpp | 2 +- include/llarp/service/protocol.hpp | 2 +- include/llarp/time.h | 8 -------- include/llarp/time.hpp | 9 +++++++-- include/llarp/{timer.h => timer.hpp} | 7 ++++--- include/llarp/types.h | 9 --------- include/llarp/types.hpp | 9 +++++++++ libabyss/include/abyss/server.hpp | 4 ++-- libabyss/src/server.cpp | 2 +- llarp/ev.cpp | 6 +++--- llarp/ev_kqueue.hpp | 1 - llarp/proofofwork.cpp | 1 - llarp/router_contact.cpp | 8 ++++---- llarp/routing/path_confirm.cpp | 9 +++++---- llarp/service/lookup.cpp | 3 ++- llarp/threadpool.cpp | 2 +- llarp/time.cpp | 20 +++++++++----------- llarp/timer.cpp | 10 +++++----- test/hiddenservice_unittest.cpp | 4 +++- 32 files changed, 74 insertions(+), 80 deletions(-) delete mode 100644 include/llarp/time.h rename include/llarp/{timer.h => timer.hpp} (94%) delete mode 100644 include/llarp/types.h create mode 100644 include/llarp/types.hpp diff --git a/daemon/rcutil.cpp b/daemon/rcutil.cpp index 7fcc7d3db..3b3b4bb4c 100644 --- a/daemon/rcutil.cpp +++ b/daemon/rcutil.cpp @@ -4,7 +4,7 @@ #include "logger.hpp" #include -#include +#include #include #include "buffer.hpp" @@ -14,9 +14,6 @@ #include "router.hpp" #include -//#include -//#include -//#include // for llarp::pubkey struct llarp_main *ctx = 0; @@ -391,7 +388,7 @@ main(int argc, char *argv[]) printf("Creating [%s]\n", rcfname); // if we zero it out then // set updated timestamp - rc.last_updated = llarp_time_now_ms(); + rc.last_updated = llarp::time_now_ms(); // load longterm identity llarp_crypto crypt; llarp_crypto_init(&crypt); @@ -440,7 +437,7 @@ main(int argc, char *argv[]) // llarp_rc_read(rcfname, &rc); // set updated timestamp - rc.last_updated = llarp_time_now_ms(); + rc.last_updated = llarp::time_now_ms(); // load longterm identity llarp_crypto crypt; diff --git a/include/llarp/codel.hpp b/include/llarp/codel.hpp index 80de73fb1..ad2edca58 100644 --- a/include/llarp/codel.hpp +++ b/include/llarp/codel.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_CODEL_QUEUE_HPP #define LLARP_CODEL_QUEUE_HPP -#include +#include #include #include #include @@ -97,7 +97,7 @@ namespace llarp Process(Visit visitor, Filter f) { llarp_time_t lowest = 0xFFFFFFFFFFFFFFFFUL; - // auto start = llarp_time_now_ms(); + // auto start = time_now_ms(); // llarp::LogInfo("CoDelQueue::Process - start at ", start); Lock_t lock(m_QueueMutex); auto start = firstPut; diff --git a/include/llarp/dht/context.hpp b/include/llarp/dht/context.hpp index 3566b39a2..acdfeba8a 100644 --- a/include/llarp/dht/context.hpp +++ b/include/llarp/dht/context.hpp @@ -2,13 +2,14 @@ #define LLARP_DHT_CONTEXT_HPP #include -#include #include #include #include #include #include +#include #include +#include #include @@ -302,7 +303,7 @@ namespace llarp if(itr == timeouts.end()) { timeouts.insert( - std::make_pair(k, llarp_time_now_ms() + requestTimeoutMS)); + std::make_pair(k, time_now_ms() + requestTimeoutMS)); } t->Start(askpeer); } diff --git a/include/llarp/ev.h b/include/llarp/ev.h index c1cbbfc34..6d2b923b1 100644 --- a/include/llarp/ev.h +++ b/include/llarp/ev.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include /** * ev.h diff --git a/include/llarp/exit/endpoint.hpp b/include/llarp/exit/endpoint.hpp index 0b29dd08a..434934795 100644 --- a/include/llarp/exit/endpoint.hpp +++ b/include/llarp/exit/endpoint.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_EXIT_ENDPOINT_HPP #define LLARP_EXIT_ENDPOINT_HPP -#include +#include #include #include #include @@ -51,4 +51,4 @@ namespace llarp } // namespace exit } // namespace llarp -#endif \ No newline at end of file +#endif diff --git a/include/llarp/ip.hpp b/include/llarp/ip.hpp index 50ad45b2a..95f65e832 100644 --- a/include/llarp/ip.hpp +++ b/include/llarp/ip.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_IP_HPP #define LLARP_IP_HPP #include -#include +#include #include #include diff --git a/include/llarp/link/server.hpp b/include/llarp/link/server.hpp index 5d622c98d..09a755d35 100644 --- a/include/llarp/link/server.hpp +++ b/include/llarp/link/server.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #include struct llarp_router; diff --git a/include/llarp/link/session.hpp b/include/llarp/link/session.hpp index f2d3e29d3..a6e0e24c0 100644 --- a/include/llarp/link/session.hpp +++ b/include/llarp/link/session.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace llarp diff --git a/include/llarp/logger.hpp b/include/llarp/logger.hpp index a947c8a05..e8d60c431 100644 --- a/include/llarp/logger.hpp +++ b/include/llarp/logger.hpp @@ -16,7 +16,6 @@ #endif #ifdef RPI #include -#include #endif namespace llarp diff --git a/include/llarp/logic.h b/include/llarp/logic.h index 18db854e1..e293f3f42 100644 --- a/include/llarp/logic.h +++ b/include/llarp/logic.h @@ -2,7 +2,7 @@ #define LLARP_LOGIC_H #include #include -#include +#include struct llarp_logic { diff --git a/include/llarp/path.hpp b/include/llarp/path.hpp index a02447ddb..0740bff08 100644 --- a/include/llarp/path.hpp +++ b/include/llarp/path.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_PATH_HPP #define LLARP_PATH_HPP #include -#include +#include #include #include #include diff --git a/include/llarp/pathset.hpp b/include/llarp/pathset.hpp index 9455e8bf9..b1c3331c4 100644 --- a/include/llarp/pathset.hpp +++ b/include/llarp/pathset.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_PATHSET_HPP #define LLARP_PATHSET_HPP -#include +#include #include #include #include diff --git a/include/llarp/rpc.hpp b/include/llarp/rpc.hpp index f1510cb93..31d94bd03 100644 --- a/include/llarp/rpc.hpp +++ b/include/llarp/rpc.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_RPC_HPP #define LLARP_RPC_HPP -#include +#include #include #include #include diff --git a/include/llarp/service/IntroSet.hpp b/include/llarp/service/IntroSet.hpp index 66afedaba..ceeca786d 100644 --- a/include/llarp/service/IntroSet.hpp +++ b/include/llarp/service/IntroSet.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_SERVICE_INTROSET_HPP #define LLARP_SERVICE_INTROSET_HPP -#include +#include #include #include #include diff --git a/include/llarp/service/protocol.hpp b/include/llarp/service/protocol.hpp index b75d65137..8d2a1b325 100644 --- a/include/llarp/service/protocol.hpp +++ b/include/llarp/service/protocol.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_SERVICE_PROTOCOL_HPP #define LLARP_SERVICE_PROTOCOL_HPP -#include +#include #include #include #include diff --git a/include/llarp/time.h b/include/llarp/time.h deleted file mode 100644 index 7b6842d87..000000000 --- a/include/llarp/time.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LLARP_TIME_H -#define LLARP_TIME_H -#include - -llarp_time_t -llarp_time_now_ms(); - -#endif diff --git a/include/llarp/time.hpp b/include/llarp/time.hpp index 85fb0a08b..2b57c9ca8 100644 --- a/include/llarp/time.hpp +++ b/include/llarp/time.hpp @@ -1,11 +1,16 @@ #ifndef LLARP_TIME_HPP #define LLARP_TIME_HPP +#include + #include namespace llarp { - typedef std::chrono::system_clock Clock_t; -} + using Clock_t = std::chrono::system_clock; + + llarp_time_t + time_now_ms(); +} // namespace llarp #endif diff --git a/include/llarp/timer.h b/include/llarp/timer.hpp similarity index 94% rename from include/llarp/timer.h rename to include/llarp/timer.hpp index 388e51f13..291b1f07f 100644 --- a/include/llarp/timer.h +++ b/include/llarp/timer.hpp @@ -1,8 +1,9 @@ -#ifndef LLARP_TIMER_H -#define LLARP_TIMER_H +#ifndef LLARP_TIMER_HPP +#define LLARP_TIMER_HPP + #include #include -#include +#include /** called with userptr, original timeout, left */ typedef void (*llarp_timer_handler_func)(void *, uint64_t, uint64_t); diff --git a/include/llarp/types.h b/include/llarp/types.h deleted file mode 100644 index 695734610..000000000 --- a/include/llarp/types.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef LLARP_TYPES_H -#define LLARP_TYPES_H -#include - -typedef uint8_t llarp_proto_version_t; -typedef uint64_t llarp_time_t; -typedef uint64_t llarp_seconds_t; - -#endif diff --git a/include/llarp/types.hpp b/include/llarp/types.hpp new file mode 100644 index 000000000..abaaee29e --- /dev/null +++ b/include/llarp/types.hpp @@ -0,0 +1,9 @@ +#ifndef LLARP_TYPES_H +#define LLARP_TYPES_H +#include + +using llarp_proto_version_t = std::uint8_t; +using llarp_time_t = std::uint64_t; +using llarp_seconds_t = std::uint64_t; + +#endif diff --git a/libabyss/include/abyss/server.hpp b/libabyss/include/abyss/server.hpp index 7658f38a1..8c069d251 100644 --- a/libabyss/include/abyss/server.hpp +++ b/libabyss/include/abyss/server.hpp @@ -3,11 +3,11 @@ #include #include -#include +#include +#include #include #include #include -#include #include #include diff --git a/libabyss/src/server.cpp b/libabyss/src/server.cpp index 45c733d00..7eb4db3d6 100644 --- a/libabyss/src/server.cpp +++ b/libabyss/src/server.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/llarp/ev.cpp b/llarp/ev.cpp index d08d9ae05..59aef067c 100644 --- a/llarp/ev.cpp +++ b/llarp/ev.cpp @@ -34,7 +34,7 @@ llarp_ev_loop_alloc(struct llarp_ev_loop **ev) #error no event loop subclass #endif (*ev)->init(); - (*ev)->_now = llarp_time_now_ms(); + (*ev)->_now = llarp::time_now_ms(); } void @@ -49,7 +49,7 @@ llarp_ev_loop_run(struct llarp_ev_loop *ev, struct llarp_logic *logic) { while(ev->running()) { - ev->_now = llarp_time_now_ms(); + ev->_now = llarp::time_now_ms(); ev->tick(EV_TICK_INTERVAL); if(ev->running()) llarp_logic_tick(logic, ev->_now); @@ -64,7 +64,7 @@ llarp_ev_loop_run_single_process(struct llarp_ev_loop *ev, { while(ev->running()) { - ev->_now = llarp_time_now_ms(); + ev->_now = llarp::time_now_ms(); ev->tick(EV_TICK_INTERVAL); if(ev->running()) { diff --git a/llarp/ev_kqueue.hpp b/llarp/ev_kqueue.hpp index 62a825bf7..7fc3bb775 100644 --- a/llarp/ev_kqueue.hpp +++ b/llarp/ev_kqueue.hpp @@ -8,7 +8,6 @@ #if __FreeBSD__ || __OpenBSD__ || __NetBSD__ || (__APPLE__ && __MACH__) // kqueue / kevent #include -#include #include #endif diff --git a/llarp/proofofwork.cpp b/llarp/proofofwork.cpp index f5bf8b5a8..d773bc155 100644 --- a/llarp/proofofwork.cpp +++ b/llarp/proofofwork.cpp @@ -1,4 +1,3 @@ -#include #include #include #include "buffer.hpp" diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index ff4401440..c3abbc656 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -1,9 +1,9 @@ #include -#include -#include #include -#include #include +#include +#include +#include #include "buffer.hpp" #include "logger.hpp" #include "mem.hpp" @@ -156,7 +156,7 @@ namespace llarp byte_t tmp[MAX_RC_SIZE] = {0}; auto buf = llarp::StackBuffer< decltype(tmp) >(tmp); signature.Zero(); - last_updated = llarp_time_now_ms(); + last_updated = time_now_ms(); if(!BEncode(&buf)) return false; buf.sz = buf.cur - buf.base; diff --git a/llarp/routing/path_confirm.cpp b/llarp/routing/path_confirm.cpp index f36f3fa63..b7752e016 100644 --- a/llarp/routing/path_confirm.cpp +++ b/llarp/routing/path_confirm.cpp @@ -1,6 +1,7 @@ -#include -#include #include + +#include +#include #include namespace llarp @@ -12,7 +13,7 @@ namespace llarp } PathConfirmMessage::PathConfirmMessage(uint64_t lifetime) - : pathLifetime(lifetime), pathCreated(llarp_time_now_ms()) + : pathLifetime(lifetime), pathCreated(time_now_ms()) { } @@ -56,4 +57,4 @@ namespace llarp } } // namespace routing -} // namespace llarp \ No newline at end of file +} // namespace llarp diff --git a/llarp/service/lookup.cpp b/llarp/service/lookup.cpp index 5174d5651..4e7b7d514 100644 --- a/llarp/service/lookup.cpp +++ b/llarp/service/lookup.cpp @@ -1,6 +1,7 @@ #include #include #include +#include namespace llarp { @@ -10,7 +11,7 @@ namespace llarp const std::string &n) : parent(p), txid(tx), name(n) { - m_created = llarp_time_now_ms(); + m_created = time_now_ms(); p->PutLookup(this, tx); } diff --git a/llarp/threadpool.cpp b/llarp/threadpool.cpp index c090d3db5..5fb2f6e15 100644 --- a/llarp/threadpool.cpp +++ b/llarp/threadpool.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/llarp/time.cpp b/llarp/time.cpp index bef56e580..167c288ac 100644 --- a/llarp/time.cpp +++ b/llarp/time.cpp @@ -1,4 +1,3 @@ -#include #include namespace llarp @@ -12,14 +11,13 @@ namespace llarp .count(); } + // use std::chrono because otherwise the network breaks with Daylight Savings + // this time, it doesn't get truncated -despair + // that concern is what drove me back to the POSIX C time functions + // in the first place + llarp_time_t + time_now_ms() + { + return llarp::time_since_epoch< std::chrono::milliseconds >(); + } } // namespace llarp - -// use std::chrono because otherwise the network breaks with Daylight Savings -// this time, it doesn't get truncated -despair -// that concern is what drove me back to the POSIX C time functions -// in the first place -llarp_time_t -llarp_time_now_ms() -{ - return llarp::time_since_epoch< std::chrono::milliseconds >(); -} diff --git a/llarp/timer.cpp b/llarp/timer.cpp index 98387f1da..98596afcf 100644 --- a/llarp/timer.cpp +++ b/llarp/timer.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -66,7 +66,7 @@ struct llarp_timer_context llarp_timer_context() { - m_Now = llarp_time_now_ms(); + m_Now = llarp::time_now_ms(); } uint32_t ids = 0; @@ -193,7 +193,7 @@ void llarp_timer_set_time(struct llarp_timer_context* t, llarp_time_t now) { if(now == 0) - now = llarp_time_now_ms(); + now = llarp::time_now_ms(); t->m_Now = now; } @@ -261,7 +261,7 @@ llarp_timer_run(struct llarp_timer_context* t, struct llarp_threadpool* pool) { llarp::util::Lock lock(t->timersMutex); // we woke up - llarp_timer_tick_all_async(t, pool, llarp_time_now_ms()); + llarp_timer_tick_all_async(t, pool, llarp::time_now_ms()); } } } diff --git a/test/hiddenservice_unittest.cpp b/test/hiddenservice_unittest.cpp index 33a75bce5..4a1374624 100644 --- a/test/hiddenservice_unittest.cpp +++ b/test/hiddenservice_unittest.cpp @@ -1,5 +1,7 @@ #include + #include +#include struct HiddenServiceTest : public ::testing::Test { @@ -31,7 +33,7 @@ TEST_F(HiddenServiceTest, TestGenerateIntroSet) llarp::service::Address addr; ASSERT_TRUE(ident.pub.CalculateAddress(addr.data())); llarp::service::IntroSet I; - auto now = llarp_time_now_ms(); + auto now = llarp::time_now_ms(); I.T = now; while(I.I.size() < 10) { From 3a8a90e4405cc240af3e571848701e8b42602f7d Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 19 Nov 2018 23:42:04 +0000 Subject: [PATCH 2/9] make gcc 8.2 and RPI=1 happy --- include/llarp/exit_info.hpp | 2 +- llarp/dns_dotlokilookup.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/llarp/exit_info.hpp b/include/llarp/exit_info.hpp index 6465702de..d9fe607f2 100644 --- a/include/llarp/exit_info.hpp +++ b/include/llarp/exit_info.hpp @@ -54,7 +54,7 @@ namespace llarp return out; out << std::string("/"); #if defined(ANDROID) || defined(RPI) - snprintf(tmp, sizeof(tmp), "%u", + snprintf(tmp, sizeof(tmp), "%lu", llarp::bits::count_array_bits(xi.netmask.s6_addr)); return out << tmp; #else diff --git a/llarp/dns_dotlokilookup.cpp b/llarp/dns_dotlokilookup.cpp index e4df50eeb..153fa1e57 100644 --- a/llarp/dns_dotlokilookup.cpp +++ b/llarp/dns_dotlokilookup.cpp @@ -230,19 +230,19 @@ ReverseHandlerIter(struct llarp::service::Context::endpoint_iter *endpointCfg) llarp::LogDebug(searchIp, " vs ", checkIp); llarp::IPRange range = llarp::iprange_ipv4( - stoi(tokensCheck[0]), stoi(tokensCheck[1]), stoi(tokensCheck[2]), - stoi(tokensCheck[3]), tunEndpoint->tunif.netmask); // create range + std::stoi(tokensCheck[0]), std::stoi(tokensCheck[1]), std::stoi(tokensCheck[2]), + std::stoi(tokensCheck[3]), tunEndpoint->tunif.netmask); // create range // hack atm to work around limitations in ipaddr_ipv4_bits and llarp::IPRange llarp::huint32_t searchIPv4_fixed = llarp::ipaddr_ipv4_bits( - stoi(tokensSearch[searchTokens - 6]), - stoi(tokensSearch[searchTokens - 5]), - stoi(tokensSearch[searchTokens - 4]), - stoi(tokensSearch[searchTokens - 3])); // create ip + std::stoi(tokensSearch[searchTokens - 6]), + std::stoi(tokensSearch[searchTokens - 5]), + std::stoi(tokensSearch[searchTokens - 4]), + std::stoi(tokensSearch[searchTokens - 3])); // create ip llarp::huint32_t searchIPv4_search = llarp::ipaddr_ipv4_bits( - stoi(tokensSearch[searchTokens - 3]), - stoi(tokensSearch[searchTokens - 4]), - stoi(tokensSearch[searchTokens - 5]), - stoi(tokensSearch[searchTokens - 6])); // create ip + std::stoi(tokensSearch[searchTokens - 3]), + std::stoi(tokensSearch[searchTokens - 4]), + std::stoi(tokensSearch[searchTokens - 5]), + std::stoi(tokensSearch[searchTokens - 6])); // create ip // bool inRange = range.Contains(searchAddr.xtohl()); bool inRange = range.Contains(searchIPv4_search); From 271ef910d79c87120380eaa6ba6456058abadaec Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Tue, 20 Nov 2018 00:13:27 +0000 Subject: [PATCH 3/9] Fix RPI build --- include/llarp/logger.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llarp/logger.hpp b/include/llarp/logger.hpp index e8d60c431..4876aa0f8 100644 --- a/include/llarp/logger.hpp +++ b/include/llarp/logger.hpp @@ -102,7 +102,7 @@ namespace llarp { #if defined(ANDROID) || defined(RPI) (void)ts; - return out << llarp_time_now_ms(); + 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); From 4851c54c92554f9c6ac65b47929f53e7ba30deea Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 23:27:59 +0000 Subject: [PATCH 4/9] Rename common.h --- include/llarp/bencode.h | 2 +- include/llarp/buffer.h | 2 +- include/llarp/{common.h => common.hpp} | 4 ++-- include/llarp/crypto.h | 2 +- include/llarp/nodedb.hpp | 2 +- include/llarp/string.h | 2 +- include/llarp/timer.hpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename include/llarp/{common.h => common.hpp} (75%) diff --git a/include/llarp/bencode.h b/include/llarp/bencode.h index b93ba468d..128364309 100644 --- a/include/llarp/bencode.h +++ b/include/llarp/bencode.h @@ -1,7 +1,7 @@ #ifndef LLARP_BENCODE_H #define LLARP_BENCODE_H #include -#include +#include #include #include #include diff --git a/include/llarp/buffer.h b/include/llarp/buffer.h index 0bd6211b4..ee7d50bd7 100644 --- a/include/llarp/buffer.h +++ b/include/llarp/buffer.h @@ -1,6 +1,6 @@ #ifndef LLARP_BUFFER_H_ #define LLARP_BUFFER_H_ -#include +#include #include #include #include diff --git a/include/llarp/common.h b/include/llarp/common.hpp similarity index 75% rename from include/llarp/common.h rename to include/llarp/common.hpp index f7d741ad5..3ef490f75 100644 --- a/include/llarp/common.h +++ b/include/llarp/common.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_COMMON_H -#define LLARP_COMMON_H +#ifndef LLARP_COMMON_HPP +#define LLARP_COMMON_HPP #ifdef __STRICT_ANSI__ #define INLINE __inline__ #else diff --git a/include/llarp/crypto.h b/include/llarp/crypto.h index f1e0874fe..6b7211e9b 100644 --- a/include/llarp/crypto.h +++ b/include/llarp/crypto.h @@ -1,7 +1,7 @@ #ifndef LLARP_CRYPTO_H_ #define LLARP_CRYPTO_H_ #include -#include +#include #include #include diff --git a/include/llarp/nodedb.hpp b/include/llarp/nodedb.hpp index 61784b1f0..1c3ba4012 100644 --- a/include/llarp/nodedb.hpp +++ b/include/llarp/nodedb.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_NODEDB_HPP #define LLARP_NODEDB_HPP -#include +#include #include #include #include diff --git a/include/llarp/string.h b/include/llarp/string.h index 4b74b59f0..80aad1a70 100644 --- a/include/llarp/string.h +++ b/include/llarp/string.h @@ -1,6 +1,6 @@ #ifndef LLARP_STRING_H #define LLARP_STRING_H -#include +#include #ifndef __FreeBSD__ #if !(__APPLE__ && __MACH__) diff --git a/include/llarp/timer.hpp b/include/llarp/timer.hpp index 291b1f07f..c78e1e23d 100644 --- a/include/llarp/timer.hpp +++ b/include/llarp/timer.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_TIMER_HPP #define LLARP_TIMER_HPP -#include +#include #include #include From e39d02ddc2ad90b7c317e01704c9d1a309036f34 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 23:38:39 +0000 Subject: [PATCH 5/9] Rename version.h --- include/llarp.h | 2 +- include/llarp/{version.h => version.hpp} | 5 +++-- llarp/router_contact.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) rename include/llarp/{version.h => version.hpp} (92%) diff --git a/include/llarp.h b/include/llarp.h index 6607a25f1..7dc4079f2 100644 --- a/include/llarp.h +++ b/include/llarp.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #ifdef __cplusplus #include // for service::address diff --git a/include/llarp/version.h b/include/llarp/version.hpp similarity index 92% rename from include/llarp/version.h rename to include/llarp/version.hpp index b831571e3..56e807670 100644 --- a/include/llarp/version.h +++ b/include/llarp/version.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_VERSION_H -#define LLARP_VERSION_H +#ifndef LLARP_VERSION_HPP +#define LLARP_VERSION_HPP #ifndef LLARP_VERSION_MAJ #define LLARP_VERSION_MAJ "0" @@ -28,4 +28,5 @@ #ifndef LLARP_RELEASE_MOTTO #define LLARP_RELEASE_MOTTO "(dev build)" #endif + #endif diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index c3abbc656..dc60f93da 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "buffer.hpp" #include "logger.hpp" #include "mem.hpp" From f91d2b9e11ef0f744a90fd1fc9fbabe17663ac3a Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 23:40:38 +0000 Subject: [PATCH 6/9] Rename proto.h --- include/llarp/bencode.h | 2 +- include/llarp/{proto.h => proto.hpp} | 4 ++-- llarp/router.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename include/llarp/{proto.h => proto.hpp} (74%) diff --git a/include/llarp/bencode.h b/include/llarp/bencode.h index 128364309..1e2ab7b5d 100644 --- a/include/llarp/bencode.h +++ b/include/llarp/bencode.h @@ -2,7 +2,7 @@ #define LLARP_BENCODE_H #include #include -#include +#include #include #include diff --git a/include/llarp/proto.h b/include/llarp/proto.hpp similarity index 74% rename from include/llarp/proto.h rename to include/llarp/proto.hpp index c720622e1..d2067331c 100644 --- a/include/llarp/proto.h +++ b/include/llarp/proto.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_PROTO_H -#define LLARP_PROTO_H +#ifndef LLARP_PROTO_HPP +#define LLARP_PROTO_HPP #ifndef LLARP_PROTO_VERSION #define LLARP_PROTO_VERSION (0) diff --git a/llarp/router.cpp b/llarp/router.cpp index 18ea451c4..fe216b72d 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -1,5 +1,5 @@ #include "router.hpp" -#include +#include #include #include #include From 1c0cf72c021301c6c683df380361788455417891 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 23:47:22 +0000 Subject: [PATCH 7/9] Rename endian.h --- include/llarp/{endian.h => endian.hpp} | 4 ++-- llarp/buffer.cpp | 2 +- llarp/dns.cpp | 6 +++--- llarp/ip.cpp | 3 +-- llarp/link/utp.cpp | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) rename include/llarp/{endian.h => endian.hpp} (98%) diff --git a/include/llarp/endian.h b/include/llarp/endian.hpp similarity index 98% rename from include/llarp/endian.h rename to include/llarp/endian.hpp index 6405dd97b..fd859828a 100644 --- a/include/llarp/endian.h +++ b/include/llarp/endian.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_ENDIAN_H -#define LLARP_ENDIAN_H +#ifndef LLARP_ENDIAN_HPP +#define LLARP_ENDIAN_HPP // adapted from libi2pd diff --git a/llarp/buffer.cpp b/llarp/buffer.cpp index db5a6cf8c..2345e0e79 100644 --- a/llarp/buffer.cpp +++ b/llarp/buffer.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/llarp/dns.cpp b/llarp/dns.cpp index ae74d5229..5236ba1d2 100644 --- a/llarp/dns.cpp +++ b/llarp/dns.cpp @@ -1,4 +1,4 @@ -#include +#include #include // for llarp_handle_dnsd_recvfrom, dnsc #include @@ -212,7 +212,7 @@ extern "C" } */ question->name = m_qName; - + question->type = get16bits(moveable); (*pos) += 2; // printf("Now1 at [%d]\n", buffer - start); @@ -244,7 +244,7 @@ extern "C" //hexDump(moveable, 12); //hexDumpAt(buffer, *pos, 12); - + if(*moveable == '\xc0') { // hexDump(moveable, 2); diff --git a/llarp/ip.cpp b/llarp/ip.cpp index a3042a352..321e3bf16 100644 --- a/llarp/ip.cpp +++ b/llarp/ip.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "llarp/buffer.hpp" @@ -6,7 +6,6 @@ #ifndef _WIN32 #include #endif -#include #include #include diff --git a/llarp/link/utp.cpp b/llarp/link/utp.cpp index 50fbf7972..993e762f2 100644 --- a/llarp/link/utp.cpp +++ b/llarp/link/utp.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include From d750ec06053d8cb545d976ccc8d35976b5685098 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 19 Nov 2018 23:57:28 +0000 Subject: [PATCH 8/9] Rename logic.h --- include/llarp.h | 2 +- include/llarp/link/server.hpp | 2 +- include/llarp/{logic.h => logic.hpp} | 4 ++-- include/llarp/router.h | 2 +- libabyss/include/abyss/server.hpp | 2 +- llarp/ev.cpp | 2 +- llarp/logic.cpp | 2 +- llarp/nodedb.cpp | 2 +- test/test_dns_unit.cpp | 2 +- test/test_dnsc_unit.cpp | 2 +- test/test_dnsd_unit.cpp | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) rename include/llarp/{logic.h => logic.hpp} (95%) diff --git a/include/llarp.h b/include/llarp.h index 7dc4079f2..acfc7c749 100644 --- a/include/llarp.h +++ b/include/llarp.h @@ -2,7 +2,7 @@ #define LLARP_H_ #include #include -#include +#include #include #include diff --git a/include/llarp/link/server.hpp b/include/llarp/link/server.hpp index 09a755d35..ac15ea70f 100644 --- a/include/llarp/link/server.hpp +++ b/include/llarp/link/server.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include struct llarp_router; diff --git a/include/llarp/logic.h b/include/llarp/logic.hpp similarity index 95% rename from include/llarp/logic.h rename to include/llarp/logic.hpp index e293f3f42..6b2fbf832 100644 --- a/include/llarp/logic.h +++ b/include/llarp/logic.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_LOGIC_H -#define LLARP_LOGIC_H +#ifndef LLARP_LOGIC_HPP +#define LLARP_LOGIC_HPP #include #include #include diff --git a/include/llarp/router.h b/include/llarp/router.h index 7cf3497b6..f58a00472 100644 --- a/include/llarp/router.h +++ b/include/llarp/router.h @@ -2,7 +2,7 @@ #define LLARP_ROUTER_H_ #include #include -#include +#include #include #include diff --git a/libabyss/include/abyss/server.hpp b/libabyss/include/abyss/server.hpp index 8c069d251..2de7add48 100644 --- a/libabyss/include/abyss/server.hpp +++ b/libabyss/include/abyss/server.hpp @@ -2,7 +2,7 @@ #define __ABYSS_SERVER_HPP__ #include -#include +#include #include #include #include diff --git a/llarp/ev.cpp b/llarp/ev.cpp index 59aef067c..13a612aa3 100644 --- a/llarp/ev.cpp +++ b/llarp/ev.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/llarp/logic.cpp b/llarp/logic.cpp index 4d3cd42b1..e775bd7ca 100644 --- a/llarp/logic.cpp +++ b/llarp/logic.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "logger.hpp" diff --git a/llarp/nodedb.cpp b/llarp/nodedb.cpp index 7d1a3e3ce..46b72b4ad 100644 --- a/llarp/nodedb.cpp +++ b/llarp/nodedb.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/test/test_dns_unit.cpp b/test/test_dns_unit.cpp index adae07886..4536007ad 100644 --- a/test/test_dns_unit.cpp +++ b/test/test_dns_unit.cpp @@ -1,6 +1,6 @@ #include #include // for llarp_main_init -#include // for threadpool/llarp_logic +#include // for threadpool/llarp_logic #include "llarp/net.hpp" // for llarp::Addr #include "llarp/dns.hpp" #include "llarp/dnsc.hpp" diff --git a/test/test_dnsc_unit.cpp b/test/test_dnsc_unit.cpp index 9c6de37ea..e585fbea5 100644 --- a/test/test_dnsc_unit.cpp +++ b/test/test_dnsc_unit.cpp @@ -1,5 +1,5 @@ #include #include // for llarp_main_init -#include // for threadpool/llarp_logic +#include // for threadpool/llarp_logic #include "llarp/net.hpp" // for llarp::Addr #include "llarp/dnsc.hpp" diff --git a/test/test_dnsd_unit.cpp b/test/test_dnsd_unit.cpp index 7975de9d9..a038ccf79 100644 --- a/test/test_dnsd_unit.cpp +++ b/test/test_dnsd_unit.cpp @@ -1,6 +1,6 @@ #include #include // for llarp_main_init -#include // for threadpool/llarp_logic +#include // for threadpool/llarp_logic #include "llarp/net.hpp" // for llarp::Addr #include "llarp/dnsd.hpp" From d21af22ca365a947ac3b4d62f93091614d7fd41e Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 20 Nov 2018 00:51:03 +0000 Subject: [PATCH 9/9] Rename defaults.h --- include/llarp/{defaults.h => defaults.hpp} | 6 +++--- llarp/config.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename include/llarp/{defaults.h => defaults.hpp} (90%) diff --git a/include/llarp/defaults.h b/include/llarp/defaults.hpp similarity index 90% rename from include/llarp/defaults.h rename to include/llarp/defaults.hpp index 8e5fd4f83..863fd2190 100644 --- a/include/llarp/defaults.h +++ b/include/llarp/defaults.hpp @@ -1,5 +1,5 @@ -#ifndef LLARP_DEFAULTS_H -#define LLARP_DEFAULTS_H +#ifndef LLARP_DEFAULTS_HPP +#define LLARP_DEFAULTS_HPP #ifndef DEFAULT_RESOLVER_US #define DEFAULT_RESOLVER_US "1.1.1.1" @@ -27,4 +27,4 @@ #endif #endif -#endif \ No newline at end of file +#endif diff --git a/llarp/config.cpp b/llarp/config.cpp index 2d1b0e885..0c4d003fd 100644 --- a/llarp/config.cpp +++ b/llarp/config.cpp @@ -1,6 +1,6 @@ #include "config.hpp" #include -#include +#include #include #include "fs.hpp" #include "ini.hpp"