summaryrefslogtreecommitdiff
path: root/src/SDK_Service.cpp
diff options
context:
space:
mode:
authorJoseph Henry <[email protected]>2016-08-29 14:47:28 -0700
committerJoseph Henry <[email protected]>2016-08-29 14:47:28 -0700
commit0ea3df14f8fffb67331ed77e733b99a03d70f799 (patch)
treea2a69998872964434f5254c9d43a63743585e6b6 /src/SDK_Service.cpp
parent15199791b4ad8af6cd2a8dd334f48fd391e4b3ad (diff)
API unit test script
Diffstat (limited to 'src/SDK_Service.cpp')
-rw-r--r--src/SDK_Service.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/SDK_Service.cpp b/src/SDK_Service.cpp
index bd481cd..a45698c 100644
--- a/src/SDK_Service.cpp
+++ b/src/SDK_Service.cpp
@@ -198,6 +198,22 @@ char *zts_get_homepath() {
}
#endif
+//
+#if (defined(__APPLE__) || defined(__linux__)) && (!defined(__IOS__) && !defined(__ANDROID__))
+ void zt_start_service(const char * path, const char *nwid) {
+ printf("path = %s\n", path);
+ if(path)
+ homeDir = path;
+ zts_start_service(NULL);
+ }
+ void zt_join_network(const char * nwid) {
+ zts_join_network(nwid);
+ }
+ void zt_leave_network(const char * nwid) {
+ zts_leave_network(nwid);
+ }
+#endif
+
// Android JNI wrapper
// JNI naming convention: Java_PACKAGENAME_CLASSNAME_METHODNAME
@@ -345,7 +361,6 @@ char *zts_get_homepath() {
// Starts a ZeroTier service in the background
void *zts_start_service(void *thread_id) {
-
#ifdef defined(__ANDROID__)
dwr(MSG_DEBUG, "ZTSDK_BUILD_VERSION = %d\n", ZTSDK_BUILD_VERSION);
LOGV("ZTSDK_BUILD_VERSION = %d\n", ZTSDK_BUILD_VERSION);
@@ -356,7 +371,6 @@ void *zts_start_service(void *thread_id) {
#endif
#if defined(__UNITY_3D__)
- int MAX_DIR_SZ = 256;
char current_dir[MAX_DIR_SZ];
getcwd(current_dir, MAX_DIR_SZ);
chdir(service_path.c_str());
@@ -375,11 +389,10 @@ void *zts_start_service(void *thread_id) {
#endif
#if defined(__APPLE__) && !defined(__IOS__)
- homeDir = givenHomeDir;
- localHomeDir = givenHomeDir; // Used for RPC and *can* differ from homeDir on some platforms
+ localHomeDir = homeDir; // Used for RPC and *can* differ from homeDir on some platforms
#endif
- dwr(MSG_DEBUG, "homeDir = %s\n", givenHomeDir.c_str());
+ dwr(MSG_DEBUG, "homeDir = %s\n", homeDir.c_str());
// Where network .conf files will be stored
netDir = homeDir + "/networks.d";
zt1Service = (ZeroTier::OneService *)0;