Android build fixes
This commit is contained in:
@@ -326,8 +326,25 @@ endif ()
|
|||||||
if (SHOULD_BUILD_TESTS)
|
if (SHOULD_BUILD_TESTS)
|
||||||
add_executable (example ${PROJ_DIR}/test/example.cpp)
|
add_executable (example ${PROJ_DIR}/test/example.cpp)
|
||||||
target_link_libraries(example zt)
|
target_link_libraries(example zt)
|
||||||
|
|
||||||
add_executable (selftest ${PROJ_DIR}/test/selftest.cpp)
|
add_executable (selftest ${PROJ_DIR}/test/selftest.cpp)
|
||||||
target_link_libraries(selftest zt)
|
target_link_libraries(selftest zt)
|
||||||
set_target_properties (selftest PROPERTIES COMPILE_FLAGS "${SILENCE} -D__SELFTEST__")
|
set_target_properties (selftest PROPERTIES COMPILE_FLAGS "${SILENCE} -D__SELFTEST__")
|
||||||
|
|
||||||
|
# Simple client/server example using ZeroTier sockets
|
||||||
|
add_executable (client ${PROJ_DIR}/test/client.cpp)
|
||||||
|
target_link_libraries(client zt)
|
||||||
|
set_target_properties (client PROPERTIES COMPILE_FLAGS "${SILENCE} -D__SELFTEST__")
|
||||||
|
add_executable (server ${PROJ_DIR}/test/server.cpp)
|
||||||
|
target_link_libraries(server zt)
|
||||||
|
set_target_properties (server PROPERTIES COMPILE_FLAGS "${SILENCE} -D__SELFTEST__")
|
||||||
|
|
||||||
|
# Native client/server
|
||||||
|
add_executable (client_native ${PROJ_DIR}/test/client.cpp)
|
||||||
|
target_link_libraries(client_native zt)
|
||||||
|
set_target_properties (client_native PROPERTIES COMPILE_FLAGS "${SILENCE}")
|
||||||
|
set_target_properties (client_native PROPERTIES OUTPUT_NAME client_native)
|
||||||
|
add_executable (server_native ${PROJ_DIR}/test/server.cpp)
|
||||||
|
target_link_libraries(server_native zt)
|
||||||
|
set_target_properties (server_native PROPERTIES COMPILE_FLAGS "${SILENCE}")
|
||||||
|
set_target_properties (server_native PROPERTIES OUTPUT_NAME server_native)
|
||||||
endif ()
|
endif ()
|
||||||
@@ -166,16 +166,17 @@ void _process_callback_event_helper(struct zts_callback_msg *msg)
|
|||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
jint rs = jvm->AttachCurrentThread(&env, NULL);
|
jint rs = jvm->AttachCurrentThread(&env, NULL);
|
||||||
assert (rs == JNI_OK);
|
assert (rs == JNI_OK);
|
||||||
|
uint64_t arg = 0;
|
||||||
if (NODE_EVENT_TYPE(msg->eventCode)) {
|
if (NODE_EVENT_TYPE(msg->eventCode)) {
|
||||||
arg = msg->networkId;
|
arg = msg->node->address;
|
||||||
}
|
}
|
||||||
if (NODE_EVENT_TYPE(msg->eventCode)) {
|
if (NETWORK_EVENT_TYPE(msg->eventCode)) {
|
||||||
arg = msg->nodeId;
|
arg = msg->network->nwid;
|
||||||
}
|
}
|
||||||
if (NODE_EVENT_TYPE(msg->eventCode)) {
|
if (PEER_EVENT_TYPE(msg->eventCode)) {
|
||||||
arg = msg->nodeId;
|
arg = msg->peer->address;
|
||||||
}
|
}
|
||||||
env->CallVoidMethod(objRef, _userCallbackMethodRef, msg->networkId, msg->eventCode);
|
env->CallVoidMethod(objRef, _userCallbackMethodRef, arg, msg->eventCode);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (_userEventCallbackFunc) {
|
if (_userEventCallbackFunc) {
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ static void netif_status_callback(struct netif *n)
|
|||||||
struct zts_netif_details *ifd = new zts_netif_details;
|
struct zts_netif_details *ifd = new zts_netif_details;
|
||||||
ifd->nwid = tap->_nwid;
|
ifd->nwid = tap->_nwid;
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_UP, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_UP, (void*)ifd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ static void netif_status_callback(struct netif *n)
|
|||||||
struct zts_netif_details *ifd = new zts_netif_details;
|
struct zts_netif_details *ifd = new zts_netif_details;
|
||||||
ifd->nwid = tap->_nwid;
|
ifd->nwid = tap->_nwid;
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_DOWN, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_DOWN, (void*)ifd);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -433,7 +433,7 @@ static void netif_remove_callback(struct netif *n)
|
|||||||
struct zts_netif_details *ifd = new zts_netif_details;
|
struct zts_netif_details *ifd = new zts_netif_details;
|
||||||
ifd->nwid = tap->_nwid;
|
ifd->nwid = tap->_nwid;
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = lwip_htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_REMOVED, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_REMOVED, (void*)ifd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,14 +452,14 @@ static void netif_link_callback(struct netif *n)
|
|||||||
struct zts_netif_details *ifd = new zts_netif_details;
|
struct zts_netif_details *ifd = new zts_netif_details;
|
||||||
ifd->nwid = tap->_nwid;
|
ifd->nwid = tap->_nwid;
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = lwip_htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_LINK_UP, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_LINK_UP, (void*)ifd);
|
||||||
}
|
}
|
||||||
if (n->flags & NETIF_FLAG_LINK_UP) {
|
if (n->flags & NETIF_FLAG_LINK_UP) {
|
||||||
struct zts_netif_details *ifd = new zts_netif_details;
|
struct zts_netif_details *ifd = new zts_netif_details;
|
||||||
ifd->nwid = tap->_nwid;
|
ifd->nwid = tap->_nwid;
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = lwip_htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_LINK_DOWN, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_LINK_DOWN, (void*)ifd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ static void lwip_prepare_netif_status_msg(struct netif *n)
|
|||||||
ifd->mtu = n->mtu;
|
ifd->mtu = n->mtu;
|
||||||
// MAC
|
// MAC
|
||||||
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
memcpy(&(ifd->mac), n->hwaddr, n->hwaddr_len);
|
||||||
ifd->mac = htonll(ifd->mac) >> 16;
|
ifd->mac = lwip_htonl(ifd->mac) >> 16;
|
||||||
postEvent(ZTS_EVENT_NETIF_UP, (void*)ifd);
|
postEvent(ZTS_EVENT_NETIF_UP, (void*)ifd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user