minor preprocessor symbol name change

This commit is contained in:
Joseph Henry
2016-12-07 10:28:40 -08:00
parent 7090c8fe5b
commit 7753bf3059
3 changed files with 35 additions and 37 deletions

View File

@@ -65,13 +65,12 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
//void (*_netif_init)(void); //void (*_netif_init)(void);
Mutex _lock; Mutex _lock;
Mutex _lock_mem; Mutex _lock_mem;
@@ -80,34 +79,34 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
//_netif_init = (void(*)(void))&netif_init; //_netif_init = (void(*)(void))&netif_init;
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());
@@ -124,7 +123,6 @@ namespace ZeroTier {
} }
//inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); } //inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); }
}; };
} // namespace ZeroTier } // namespace ZeroTier

View File

@@ -268,7 +268,7 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
@@ -334,38 +334,38 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
#if defined(SDK_IPV4) #if defined(SDK_IPV4)
_etharp_output = (err_t(*)(ETHARP_OUTPUT_SIG))&etharp_output; _etharp_output = (err_t(*)(ETHARP_OUTPUT_SIG))&etharp_output;
#endif #endif
#if defined(SDK_IPV6) #if defined(SDK_IPV6)
_nd6_tmr = (void(*)(void))&nd6_tmr; _nd6_tmr = (void(*)(void))&nd6_tmr;
_netif_ip6_addr_set_state = (void(*)(NETIF_IP6_ADDR_SET_STATE_SIG))&netif_ip6_addr_set_state; _netif_ip6_addr_set_state = (void(*)(NETIF_IP6_ADDR_SET_STATE_SIG))&netif_ip6_addr_set_state;
_netif_create_ip6_linklocal_address = (void(*)(NETIF_CREATE_IP6_LINKLOCAL_ADDRESS_SIG))&netif_create_ip6_linklocal_address; _netif_create_ip6_linklocal_address = (void(*)(NETIF_CREATE_IP6_LINKLOCAL_ADDRESS_SIG))&netif_create_ip6_linklocal_address;
_ethip6_output = (err_t(*)(ETHIP6_OUTPUT_SIG))&ethip6_output; _ethip6_output = (err_t(*)(ETHIP6_OUTPUT_SIG))&ethip6_output;
#endif #endif
_netif_init = (void(*)(void))&netif_init; _netif_init = (void(*)(void))&netif_init;
@@ -407,7 +407,7 @@ namespace ZeroTier {
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());
@@ -473,15 +473,15 @@ namespace ZeroTier {
} }
#if defined(SDK_IPV4) #if defined(SDK_IPV4)
inline struct netif * __netif_add(NETIF_ADD_SIG) throw() { Mutex::Lock _l(_lock); return _netif_add(netif,ipaddr,netmask,gw,state,init,input); } inline struct netif * __netif_add(NETIF_ADD_SIG) throw() { Mutex::Lock _l(_lock); return _netif_add(netif,ipaddr,netmask,gw,state,init,input); }
#endif #endif
#if defined(SDK_IPV6) #if defined(SDK_IPV6)
inline struct netif * __netif_add(NETIF_ADD_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _netif_add(netif,state,init,input); } inline struct netif * __netif_add(NETIF_ADD_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _netif_add(netif,state,init,input); }
inline void __nd6_tmr(void) throw() { /*DEBUG_STACK();*/ Mutex::Lock _l(_lock); _nd6_tmr(); } inline void __nd6_tmr(void) throw() { /*DEBUG_STACK();*/ Mutex::Lock _l(_lock); _nd6_tmr(); }
inline void __netif_ip6_addr_set_state(NETIF_IP6_ADDR_SET_STATE_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _netif_ip6_addr_set_state(netif, addr_idx, state); } inline void __netif_ip6_addr_set_state(NETIF_IP6_ADDR_SET_STATE_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _netif_ip6_addr_set_state(netif, addr_idx, state); }
inline void __netif_create_ip6_linklocal_address(NETIF_CREATE_IP6_LINKLOCAL_ADDRESS_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _netif_create_ip6_linklocal_address(netif, from_mac_48bit); } inline void __netif_create_ip6_linklocal_address(NETIF_CREATE_IP6_LINKLOCAL_ADDRESS_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _netif_create_ip6_linklocal_address(netif, from_mac_48bit); }
inline err_t __ethip6_output(ETHIP6_OUTPUT_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _ethip6_output(netif,q,ip6addr); } inline err_t __ethip6_output(ETHIP6_OUTPUT_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _ethip6_output(netif,q,ip6addr); }
#endif #endif
inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); } inline void __netif_init(void) throw() { Mutex::Lock _l(_lock); _netif_init(); }

View File

@@ -134,7 +134,7 @@ namespace ZeroTier {
void close() { void close() {
#if defined(__STATIC__LWIP__) #if defined(__STATIC__LWIP__)
return; return;
#elif defined(__DYNAMIC_LWIP__) #elif defined(__DYNAMIC_STACK__)
dlclose(_libref); dlclose(_libref);
#endif #endif
} }
@@ -173,28 +173,28 @@ namespace ZeroTier {
_libref(NULL) _libref(NULL)
{ {
#if defined(__ANDROID__) || defined(__UNITY_3D__) #if defined(__ANDROID__) || defined(__UNITY_3D__)
#define __STATIC_LWIP__ #define __STATIC_STACK__
#elif defined(__linux__) #elif defined(__linux__)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW); _libref = dlmopen(LM_ID_NEWLM, path, RTLD_NOW);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "TargetConditionals.h" #include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
#include "node/Mutex.hpp" #include "node/Mutex.hpp"
#define __STATIC_LWIP__ #define __STATIC_STACK__
// iOS Simulator or iOS device // iOS Simulator or iOS device
// Do nothing, symbols are statically-linked // Do nothing, symbols are statically-linked
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
#define __DYNAMIC_LWIP__ #define __DYNAMIC_STACK__
// Dynamically load liblwip.so // Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW); _libref = dlopen(path, RTLD_NOW);
#else #else
#define __STATIC_LWIP__ #define __STATIC_STACK__
#endif #endif
#endif #endif
#ifdef __STATIC_LWIP__ // Set static references (for use in iOS) #ifdef __STATIC_STACK__ // Set static references (for use in iOS)
_pico_stack_init = (void(*)(void))&pico_stack_init; _pico_stack_init = (void(*)(void))&pico_stack_init;
_pico_stack_tick = (void(*)(void))&pico_stack_tick; _pico_stack_tick = (void(*)(void))&pico_stack_tick;
@@ -225,7 +225,7 @@ namespace ZeroTier {
#endif #endif
#ifdef __DYNAMIC_LWIP__ // Use dynamically-loaded symbols (for use in normal desktop applications) #ifdef __DYNAMIC_STACK__ // Use dynamically-loaded symbols (for use in normal desktop applications)
if(_libref == NULL) if(_libref == NULL)
DEBUG_ERROR("dlerror(): %s", dlerror()); DEBUG_ERROR("dlerror(): %s", dlerror());