lokinet/llarp/net/ip.hpp
Jeff 49b9ad7197
tun code refactor (#1495)
* partial tun code refactor

* take out the trash

* move vpn platform code into llarp/vpn/platform.cpp

* fix hive build

* fix win32

* fix memory leak on win32

* reduce cpu use

* make macos compile

* win32 patches:

* use wepoll for zmq
* use all cores on windows iocp read loop

* fix zmq patch for windows

* clean up cmake for win32

* add uninstall before reinstall option to win32 installer

* more ipv6 stuff

* make it compile

* fix up route poker

* remove an unneeded code block in macos wtf

* always use call to system

* fix route poker behavior on macos

* disable ipv6 on windows for now

* cpu perf improvement:

* colease calls to Router::PumpLL to 1 per event loop wakeup

* set up THEN add addresses

* emulate proactor event loop on win32

* remove excessively verbose error message

* fix issue #1499

* exclude uv_poll from win32 so that it can start up

* update logtag to include directory

* create minidump on windows if there was a crash

* make windows happy

* use dmp suffix on minidump files

* typo fix

* address feedback from jason
* use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
* quote $@ in apply-patches in case path has spaces in it

* address feedback from tom

* remove llarp/ev/pipe
* add comments for clairification
* make event loop queue size constant named
2021-01-11 18:13:22 -05:00

34 lines
610 B
C++

#pragma once
#include <net/net_int.hpp>
#include <cstdint>
namespace llarp::net
{
huint128_t
In6ToHUInt(in6_addr addr);
in6_addr
HUIntToIn6(huint128_t x);
constexpr huint128_t
ExpandV4(huint32_t x)
{
return huint128_t{0x0000'ffff'0000'0000UL} | huint128_t{x.h};
}
constexpr huint128_t
ExpandV4Lan(huint32_t x)
{
return huint128_t{uint128_t{0xfe80'0000'0000'0000UL, 0UL}} | huint128_t{x.h};
}
constexpr huint32_t
TruncateV6(huint128_t x)
{
huint32_t ret = {0};
ret.h = (uint32_t)(x.h & 0x0000'0000'ffff'ffffUL);
return ret;
}
} // namespace llarp::net