macOS static lib build target update, minor android/unity3d updates
This commit is contained in:
@@ -95,6 +95,8 @@ extern "C" {
|
||||
#if defined(__ANDROID__)
|
||||
#define DEBUG_INFO(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%20s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_BLANK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:" fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_ATTN(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||
#define DEBUG_STACK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_STACK: %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||
#else
|
||||
#define DEBUG_INFO(fmt, args...) fprintf(stderr, "ZT_INFO : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args)
|
||||
#define DEBUG_ATTN(fmt, args...) fprintf(stderr, CYN "ZT_INFO : %14s:%4d:%25s: " fmt "\n" RESET, __FILENAME__, __LINE__, __FUNCTION__, ##args)
|
||||
|
||||
@@ -163,7 +163,10 @@ void zts_stop_service() {
|
||||
|
||||
bool zts_has_address(const char *nwid)
|
||||
{
|
||||
DEBUG_ERROR();
|
||||
char ipv4_addr[64], ipv6_addr[64];
|
||||
memset(ipv4_addr, 0, 64);
|
||||
memset(ipv6_addr, 0, 64);
|
||||
zts_get_ipv4_address(nwid, ipv4_addr);
|
||||
zts_get_ipv6_address(nwid, ipv6_addr);
|
||||
if(!strcmp(ipv4_addr, "-1.-1.-1.-1/-1") && !strcmp(ipv4_addr, "-1.-1.-1.-1/-1")) {
|
||||
@@ -363,7 +366,7 @@ void zts_start_service(const char *path)
|
||||
const char *nwid_str = env->GetStringUTFChars(nwid, NULL);
|
||||
char address_string[32];
|
||||
memset(address_string, 0, 32);
|
||||
zts_get_addresses(nwid_str, address_string);
|
||||
zts_get_ipv4_address(nwid_str, address_string);
|
||||
jclass clazz = (*env).FindClass("java/util/ArrayList");
|
||||
jobject addresses = (*env).NewObject(clazz, (*env).GetMethodID(clazz, "<init>", "()V"));
|
||||
jstring _str = (*env).NewStringUTF(address_string);
|
||||
@@ -375,7 +378,7 @@ void zts_start_service(const char *path)
|
||||
const char *nwid_str = env->GetStringUTFChars(nwid, NULL);
|
||||
char address_string[32];
|
||||
memset(address_string, 0, 32);
|
||||
zts_get_addresses(nwid_str, address_string);
|
||||
zts_get_ipv6_address(nwid_str, address_string);
|
||||
jclass clazz = (*env).FindClass("java/util/ArrayList");
|
||||
jobject addresses = (*env).NewObject(clazz, (*env).GetMethodID(clazz, "<init>", "()V"));
|
||||
jstring _str = (*env).NewStringUTF(address_string);
|
||||
@@ -436,11 +439,8 @@ void zts_start_service(const char *path)
|
||||
void *zts_start_core_service(void *thread_id) {
|
||||
|
||||
#if defined(SDK_BUNDLED)
|
||||
homeDir = std::string((char*)thread_id);
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
DEBUG_INFO("ZTSDK_BUILD_VERSION = %d", ZTSDK_BUILD_VERSION);
|
||||
if(thread_id)
|
||||
homeDir = std::string((char*)thread_id);
|
||||
#endif
|
||||
|
||||
char current_dir[MAX_DIR_SZ];
|
||||
@@ -510,7 +510,8 @@ void *zts_start_core_service(void *thread_id) {
|
||||
#if defined(__UNITY_3D__)
|
||||
DEBUG_INFO("starting service...");
|
||||
#endif
|
||||
|
||||
DEBUG_INFO("starting service...");
|
||||
|
||||
// Initialize RPC
|
||||
// TODO: remove?
|
||||
if(rpcEnabled) {
|
||||
|
||||
@@ -130,7 +130,7 @@ int (*realclose)(CLOSE_SIG);
|
||||
DEBUG_ATTN("waiting for service to assign address to network stack");
|
||||
// wait for zt service to assign the network stack an address
|
||||
sleep(1);
|
||||
while(!zts_has_address(nwid)) { }
|
||||
while(!zts_has_address(nwid)) { usleep(1000); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -350,8 +350,10 @@ namespace ZeroTier {
|
||||
#define __DYNAMIC_STACK__
|
||||
// Dynamically load liblwip.so
|
||||
_libref = dlopen(path, RTLD_NOW);
|
||||
#else
|
||||
#define __STATIC_STACK__
|
||||
#elif TARGET_OS_MAC && defined(SDK_BUNDLED)
|
||||
#define __DYNAMIC_STACK__ // TODO: Implement static version
|
||||
// Dynamically load liblwip.so
|
||||
_libref = dlopen(path, RTLD_NOW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -137,7 +137,6 @@ namespace ZeroTier {
|
||||
void (*_pico_stack_tick)(void);
|
||||
int (*_pico_string_to_ipv4)(PICO_STRING_TO_IPV4_SIG);
|
||||
int (*_pico_ipv4_to_string)(PICO_IPV4_TO_STRING_SIG);
|
||||
struct pico_device* (*_pico_tap_create)(PICO_TAP_CREATE_SIG);
|
||||
int (*_pico_ipv4_link_add)(PICO_IPV4_LINK_ADD_SIG);
|
||||
int (*_pico_device_init)(PICO_DEVICE_INIT_SIG);
|
||||
int32_t (*_pico_stack_recv)(PICO_STACK_RECV_SIG);
|
||||
@@ -200,7 +199,6 @@ namespace ZeroTier {
|
||||
|
||||
_pico_stack_init = (void(*)(void))&pico_stack_init;
|
||||
_pico_stack_tick = (void(*)(void))&pico_stack_tick;
|
||||
_pico_tap_create = (struct pico_device*(*)(PICO_TAP_CREATE_SIG))&pico_tap_create;
|
||||
_pico_string_to_ipv4 = (int(*)(PICO_STRING_TO_IPV4_SIG))&pico_string_to_ipv4;
|
||||
_pico_ipv4_to_string = (int(*)(PICO_IPV4_TO_STRING_SIG))&pico_ipv4_to_string;
|
||||
_pico_ipv4_link_add = (int(*)(PICO_IPV4_LINK_ADD_SIG))&pico_ipv4_link_add;
|
||||
@@ -234,7 +232,6 @@ namespace ZeroTier {
|
||||
|
||||
_pico_stack_init = (void(*)(void))dlsym(_libref, "pico_stack_init");
|
||||
_pico_stack_tick = (void(*)(void))dlsym(_libref, "pico_stack_tick");
|
||||
_pico_tap_create = (struct pico_device*(*)(PICO_TAP_CREATE_SIG))dlsym(_libref, "pico_tap_create");
|
||||
_pico_string_to_ipv4 = (int(*)(PICO_STRING_TO_IPV4_SIG))dlsym(_libref, "pico_string_to_ipv4");
|
||||
_pico_ipv4_to_string = (int(*)(PICO_IPV4_TO_STRING_SIG))dlsym(_libref, "pico_ipv4_to_string");
|
||||
_pico_ipv4_link_add = (int(*)(PICO_IPV4_LINK_ADD_SIG))dlsym(_libref, "pico_ipv4_link_add");
|
||||
@@ -270,7 +267,6 @@ namespace ZeroTier {
|
||||
|
||||
inline void __pico_stack_init(void) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _pico_stack_init(); }
|
||||
inline void __pico_stack_tick(void) throw() { /*DEBUG_STACK();*/ Mutex::Lock _l(_lock); _pico_stack_tick(); }
|
||||
inline struct pico_device * __pico_tap_create(PICO_TAP_CREATE_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_tap_create(name); }
|
||||
inline int __pico_ipv4_to_string(PICO_IPV4_TO_STRING_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_ipv4_to_string(ipbuf, ip); }
|
||||
inline int __pico_ipv4_link_add(PICO_IPV4_LINK_ADD_SIG) throw() { DEBUG_STACK(); /*Mutex::Lock _l(_lock);*/ return _pico_ipv4_link_add(dev, address, netmask); }
|
||||
inline int __pico_device_init(PICO_DEVICE_INIT_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_device_init(dev, name, mac); }
|
||||
|
||||
@@ -46,13 +46,11 @@
|
||||
|
||||
#include "defs.h"
|
||||
#include "rpc.h"
|
||||
|
||||
|
||||
#if defined(SDK_LWIP)
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip.hpp"
|
||||
#endif
|
||||
|
||||
#if defined(SDK_PICOTCP)
|
||||
#elif defined(SDK_PICOTCP)
|
||||
#include "picotcp.hpp"
|
||||
#include "pico_protocol.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user