diff --git a/ports/android/app/src/main/java/com/zerotier/libzt/ZeroTier.java b/ports/android/app/src/main/java/com/zerotier/libzt/ZeroTier.java index c53b40c..8eccfd8 100644 --- a/ports/android/app/src/main/java/com/zerotier/libzt/ZeroTier.java +++ b/ports/android/app/src/main/java/com/zerotier/libzt/ZeroTier.java @@ -90,6 +90,16 @@ public class ZeroTier public static int EVENT_PEER_RELAY = 97; public static int EVENT_PEER_UNREACHABLE = 98; + ////////////////////////////////////////////////////////////////////////////// + // ZeroTier Constants // + ////////////////////////////////////////////////////////////////////////////// + + public static int ZT_MAX_PEER_NETWORK_PATHS = 16; + + ////////////////////////////////////////////////////////////////////////////// + // Socket API Constants // + ////////////////////////////////////////////////////////////////////////////// + // Socket protocol types public static int SOCK_STREAM = 0x00000001; public static int SOCK_DGRAM = 0x00000002; @@ -166,8 +176,8 @@ public class ZeroTier // ZeroTier Service Controls // ////////////////////////////////////////////////////////////////////////////// - public static native void start(String path, ZeroTierEventListener callbackClass, int port); - public static native void stop(); + public static native int start(String path, ZeroTierEventListener callbackClass, int port); + public static native int stop(); public static native int join(long nwid); public static native int leave(long nwid); public static native long get_node_id(); diff --git a/src/Controls.cpp b/src/Controls.cpp index 5719f28..4ffc118 100644 --- a/src/Controls.cpp +++ b/src/Controls.cpp @@ -576,7 +576,7 @@ zts_err_t zts_start(const char *path, void (*callback)(struct zts_callback_msg*) } #ifdef SDK_JNI -JNIEXPORT void JNICALL Java_com_zerotier_libzt_ZeroTier_start( +JNIEXPORT int JNICALL Java_com_zerotier_libzt_ZeroTier_start( JNIEnv *env, jobject thisObj, jstring path, jobject callback, jint port) { if (!path) { @@ -595,8 +595,9 @@ JNIEXPORT void JNICALL Java_com_zerotier_libzt_ZeroTier_start( objRef = env->NewGlobalRef(callback); // Reference used for later calls _userCallbackMethodRef = eventListenerCallbackMethod; const char* utf_string = env->GetStringUTFChars(path, NULL); - zts_start(utf_string, NULL, port); // using _userCallbackMethodRef + int retval = zts_start(utf_string, NULL, port); // using _userCallbackMethodRef env->ReleaseStringUTFChars(path, utf_string); + return retval; } #endif