summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-24 16:21:36 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-24 16:21:36 -0700
commitf69454ec9879a0b0a424f743ca144d1123ef7e99 (patch)
treea53bd7f8ebc2d164ead7d530a8e9ef17ffe73ddb /java
parent0e5aac6a117c28fde63f4cdb94e6c9fc415ca098 (diff)
downloadinfinitytier-f69454ec9879a0b0a424f743ca144d1123ef7e99.tar.gz
infinitytier-f69454ec9879a0b0a424f743ca144d1123ef7e99.zip
(1) Make ZT_ naming convention consistent (get rid of ZT1_), (2) Make local interface a full sockaddr_storage instead of an int identifier, which turns out to be better for multi-homing and other uses.
Diffstat (limited to 'java')
-rw-r--r--java/CMakeLists.txt4
-rw-r--r--java/jni/Android.mk4
-rw-r--r--java/jni/ZT1_jnicache.cpp4
-rw-r--r--java/jni/ZT1_jnicache.h4
-rw-r--r--java/jni/ZT1_jniutils.cpp86
-rw-r--r--java/jni/ZT1_jniutils.h24
-rw-r--r--java/jni/com_zerotierone_sdk_Node.cpp164
-rw-r--r--java/src/com/zerotier/sdk/VirtualNetworkConfig.java2
8 files changed, 146 insertions, 146 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index db3eec1c..25e32638 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -53,8 +53,8 @@ set(src_files
../osdep/Http.cpp
../osdep/OSUtils.cpp
jni/com_zerotierone_sdk_Node.cpp
- jni/ZT1_jniutils.cpp
- jni/ZT1_jnicache.cpp
+ jni/ZT_jniutils.cpp
+ jni/ZT_jnicache.cpp
)
set(include_dirs
diff --git a/java/jni/Android.mk b/java/jni/Android.mk
index bbf14348..4dd4a57a 100644
--- a/java/jni/Android.mk
+++ b/java/jni/Android.mk
@@ -38,7 +38,7 @@ LOCAL_SRC_FILES := \
# JNI Files
LOCAL_SRC_FILES += \
com_zerotierone_sdk_Node.cpp \
- ZT1_jniutils.cpp \
- ZT1_jnicache.cpp
+ ZT_jniutils.cpp \
+ ZT_jnicache.cpp
include $(BUILD_SHARED_LIBRARY) \ No newline at end of file
diff --git a/java/jni/ZT1_jnicache.cpp b/java/jni/ZT1_jnicache.cpp
index 8d6305cb..d8141058 100644
--- a/java/jni/ZT1_jnicache.cpp
+++ b/java/jni/ZT1_jnicache.cpp
@@ -25,8 +25,8 @@
* LLC. Start here: http://www.zerotier.com/
*/
-#include "ZT1_jnicache.h"
-#include "ZT1_jniutils.h"
+#include "ZT_jnicache.h"
+#include "ZT_jniutils.h"
JniCache::JniCache()
: m_jvm(NULL)
diff --git a/java/jni/ZT1_jnicache.h b/java/jni/ZT1_jnicache.h
index 43f43a08..001c13fe 100644
--- a/java/jni/ZT1_jnicache.h
+++ b/java/jni/ZT1_jnicache.h
@@ -25,8 +25,8 @@
* LLC. Start here: http://www.zerotier.com/
*/
-#ifndef ZT1_JNICACHE_H_
-#define ZT1_JNICACHE_H_
+#ifndef ZT_JNICACHE_H_
+#define ZT_JNICACHE_H_
#include <jni.h>
#include <map>
diff --git a/java/jni/ZT1_jniutils.cpp b/java/jni/ZT1_jniutils.cpp
index 8779c3c3..794a0624 100644
--- a/java/jni/ZT1_jniutils.cpp
+++ b/java/jni/ZT1_jniutils.cpp
@@ -1,5 +1,5 @@
-#include "ZT1_jniutils.h"
-#include "ZT1_jnicache.h"
+#include "ZT_jniutils.h"
+#include "ZT_jnicache.h"
#include <string>
#include <assert.h>
@@ -9,7 +9,7 @@ extern JniCache cache;
extern "C" {
#endif
-jobject createResultObject(JNIEnv *env, ZT1_ResultCode code)
+jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
{
jclass resultClass = NULL;
@@ -25,23 +25,23 @@ jobject createResultObject(JNIEnv *env, ZT1_ResultCode code)
std::string fieldName;
switch(code)
{
- case ZT1_RESULT_OK:
- LOGV("ZT1_RESULT_OK");
+ case ZT_RESULT_OK:
+ LOGV("ZT_RESULT_OK");
fieldName = "RESULT_OK";
break;
- case ZT1_RESULT_FATAL_ERROR_OUT_OF_MEMORY:
- LOGV("ZT1_RESULT_FATAL_ERROR_OUT_OF_MEMORY");
+ case ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY:
+ LOGV("ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY");
fieldName = "RESULT_FATAL_ERROR_OUT_OF_MEMORY";
break;
- case ZT1_RESULT_FATAL_ERROR_DATA_STORE_FAILED:
+ case ZT_RESULT_FATAL_ERROR_DATA_STORE_FAILED:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED");
fieldName = "RESULT_FATAL_ERROR_DATA_STORE_FAILED";
break;
- case ZT1_RESULT_ERROR_NETWORK_NOT_FOUND:
+ case ZT_RESULT_ERROR_NETWORK_NOT_FOUND:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED");
fieldName = "RESULT_ERROR_NETWORK_NOT_FOUND";
break;
- case ZT1_RESULT_FATAL_ERROR_INTERNAL:
+ case ZT_RESULT_FATAL_ERROR_INTERNAL:
default:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED");
fieldName = "RESULT_FATAL_ERROR_INTERNAL";
@@ -64,7 +64,7 @@ jobject createResultObject(JNIEnv *env, ZT1_ResultCode code)
}
-jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status)
+jobject createVirtualNetworkStatus(JNIEnv *env, ZT_VirtualNetworkStatus status)
{
jobject statusObject = NULL;
@@ -77,22 +77,22 @@ jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status)
std::string fieldName;
switch(status)
{
- case ZT1_NETWORK_STATUS_REQUESTING_CONFIGURATION:
+ case ZT_NETWORK_STATUS_REQUESTING_CONFIGURATION:
fieldName = "NETWORK_STATUS_REQUESTING_CONFIGURATION";
break;
- case ZT1_NETWORK_STATUS_OK:
+ case ZT_NETWORK_STATUS_OK:
fieldName = "NETWORK_STATUS_OK";
break;
- case ZT1_NETWORK_STATUS_ACCESS_DENIED:
+ case ZT_NETWORK_STATUS_ACCESS_DENIED:
fieldName = "NETWORK_STATUS_ACCESS_DENIED";
break;
- case ZT1_NETWORK_STATUS_NOT_FOUND:
+ case ZT_NETWORK_STATUS_NOT_FOUND:
fieldName = "NETWORK_STATUS_NOT_FOUND";
break;
- case ZT1_NETWORK_STATUS_PORT_ERROR:
+ case ZT_NETWORK_STATUS_PORT_ERROR:
fieldName = "NETWORK_STATUS_PORT_ERROR";
break;
- case ZT1_NETWORK_STATUS_CLIENT_TOO_OLD:
+ case ZT_NETWORK_STATUS_CLIENT_TOO_OLD:
fieldName = "NETWORK_STATUS_CLIENT_TOO_OLD";
break;
}
@@ -104,7 +104,7 @@ jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status)
return statusObject;
}
-jobject createEvent(JNIEnv *env, ZT1_Event event)
+jobject createEvent(JNIEnv *env, ZT_Event event)
{
jclass eventClass = NULL;
jobject eventObject = NULL;
@@ -118,31 +118,31 @@ jobject createEvent(JNIEnv *env, ZT1_Event event)
std::string fieldName;
switch(event)
{
- case ZT1_EVENT_UP:
+ case ZT_EVENT_UP:
fieldName = "EVENT_UP";
break;
- case ZT1_EVENT_OFFLINE:
+ case ZT_EVENT_OFFLINE:
fieldName = "EVENT_OFFLINE";
break;
- case ZT1_EVENT_ONLINE:
+ case ZT_EVENT_ONLINE:
fieldName = "EVENT_ONLINE";
break;
- case ZT1_EVENT_DOWN:
+ case ZT_EVENT_DOWN:
fieldName = "EVENT_DOWN";
break;
- case ZT1_EVENT_FATAL_ERROR_IDENTITY_COLLISION:
+ case ZT_EVENT_FATAL_ERROR_IDENTITY_COLLISION:
fieldName = "EVENT_FATAL_ERROR_IDENTITY_COLLISION";
break;
- case ZT1_EVENT_SAW_MORE_RECENT_VERSION:
+ case ZT_EVENT_SAW_MORE_RECENT_VERSION:
fieldName = "EVENT_SAW_MORE_RECENT_VERSION";
break;
- case ZT1_EVENT_AUTHENTICATION_FAILURE:
+ case ZT_EVENT_AUTHENTICATION_FAILURE:
fieldName = "EVENT_AUTHENTICATION_FAILURE";
break;
- case ZT1_EVENT_INVALID_PACKET:
+ case ZT_EVENT_INVALID_PACKET:
fieldName = "EVENT_INVALID_PACKET";
break;
- case ZT1_EVENT_TRACE:
+ case ZT_EVENT_TRACE:
fieldName = "EVENT_TRACE";
break;
}
@@ -154,7 +154,7 @@ jobject createEvent(JNIEnv *env, ZT1_Event event)
return eventObject;
}
-jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role)
+jobject createPeerRole(JNIEnv *env, ZT_PeerRole role)
{
jclass peerRoleClass = NULL;
jobject peerRoleObject = NULL;
@@ -168,13 +168,13 @@ jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role)
std::string fieldName;
switch(role)
{
- case ZT1_PEER_ROLE_LEAF:
+ case ZT_PEER_ROLE_LEAF:
fieldName = "PEER_ROLE_LEAF";
break;
- case ZT1_PEER_ROLE_HUB:
+ case ZT_PEER_ROLE_HUB:
fieldName = "PEER_ROLE_HUB";
break;
- case ZT1_PEER_ROLE_ROOTSERVER:
+ case ZT_PEER_ROLE_ROOTSERVER:
fieldName = "PEER_ROLE_ROOTSERVER";
break;
}
@@ -186,7 +186,7 @@ jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role)
return peerRoleObject;
}
-jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type)
+jobject createVirtualNetworkType(JNIEnv *env, ZT_VirtualNetworkType type)
{
jclass vntypeClass = NULL;
jobject vntypeObject = NULL;
@@ -200,10 +200,10 @@ jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type)
std::string fieldName;
switch(type)
{
- case ZT1_NETWORK_TYPE_PRIVATE:
+ case ZT_NETWORK_TYPE_PRIVATE:
fieldName = "NETWORK_TYPE_PRIVATE";
break;
- case ZT1_NETWORK_TYPE_PUBLIC:
+ case ZT_NETWORK_TYPE_PUBLIC:
fieldName = "NETWORK_TYPE_PUBLIC";
break;
}
@@ -213,7 +213,7 @@ jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type)
return vntypeObject;
}
-jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfigOperation op)
+jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT_VirtualNetworkConfigOperation op)
{
jclass vnetConfigOpClass = NULL;
jobject vnetConfigOpObject = NULL;
@@ -227,16 +227,16 @@ jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfi
std::string fieldName;
switch(op)
{
- case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_UP:
+ case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP:
fieldName = "VIRTUAL_NETWORK_CONFIG_OPERATION_UP";
break;
- case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
+ case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
fieldName = "VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE";
break;
- case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
+ case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
fieldName = "VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN";
break;
- case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
+ case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
fieldName = "VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY";
break;
}
@@ -372,7 +372,7 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
return inetSocketAddressObject;
}
-jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc)
+jobject newMulticastGroup(JNIEnv *env, const ZT_MulticastGroup &mc)
{
jclass multicastGroupClass = NULL;
jmethodID multicastGroup_constructor = NULL;
@@ -417,7 +417,7 @@ jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc)
return multicastGroupObj;
}
-jobject newPeerPhysicalPath(JNIEnv *env, const ZT1_PeerPhysicalPath &ppp)
+jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
{
LOGV("newPeerPhysicalPath Called");
jclass pppClass = NULL;
@@ -514,7 +514,7 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT1_PeerPhysicalPath &ppp)
return pppObject;
}
-jobject newPeer(JNIEnv *env, const ZT1_Peer &peer)
+jobject newPeer(JNIEnv *env, const ZT_Peer &peer)
{
LOGV("newPeer called");
@@ -656,7 +656,7 @@ jobject newPeer(JNIEnv *env, const ZT1_Peer &peer)
return peerObject;
}
-jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &vnetConfig)
+jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
{
jclass vnetConfigClass = NULL;
jmethodID vnetConfig_constructor = NULL;
diff --git a/java/jni/ZT1_jniutils.h b/java/jni/ZT1_jniutils.h
index 880f67d7..b76a28c2 100644
--- a/java/jni/ZT1_jniutils.h
+++ b/java/jni/ZT1_jniutils.h
@@ -1,5 +1,5 @@
-#ifndef ZT1_jniutils_h_
-#define ZT1_jniutils_h_
+#ifndef ZT_jniutils_h_
+#define ZT_jniutils_h_
#include <stdio.h>
#include <jni.h>
#include <ZeroTierOne.h>
@@ -23,22 +23,22 @@ extern "C" {
#define LOGE(...) fprintf(stdout, __VA_ARGS__)
#endif
-jobject createResultObject(JNIEnv *env, ZT1_ResultCode code);
-jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status);
-jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type);
-jobject createEvent(JNIEnv *env, ZT1_Event event);
-jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role);
-jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfigOperation op);
+jobject createResultObject(JNIEnv *env, ZT_ResultCode code);
+jobject createVirtualNetworkStatus(JNIEnv *env, ZT_VirtualNetworkStatus status);
+jobject createVirtualNetworkType(JNIEnv *env, ZT_VirtualNetworkType type);
+jobject createEvent(JNIEnv *env, ZT_Event event);
+jobject createPeerRole(JNIEnv *env, ZT_PeerRole role);
+jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT_VirtualNetworkConfigOperation op);
jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr);
jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr);
-jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc);
+jobject newMulticastGroup(JNIEnv *env, const ZT_MulticastGroup &mc);
-jobject newPeer(JNIEnv *env, const ZT1_Peer &peer);
-jobject newPeerPhysicalPath(JNIEnv *env, const ZT1_PeerPhysicalPath &ppp);
+jobject newPeer(JNIEnv *env, const ZT_Peer &peer);
+jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp);
-jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &config);
+jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &config);
jobject newVersion(JNIEnv *env, int major, int minor, int rev, long featureFlags);
diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp
index f0405813..ff12708a 100644
--- a/java/jni/com_zerotierone_sdk_Node.cpp
+++ b/java/jni/com_zerotierone_sdk_Node.cpp
@@ -26,8 +26,8 @@
*/
#include "com_zerotierone_sdk_Node.h"
-#include "ZT1_jniutils.h"
-#include "ZT1_jnicache.h"
+#include "ZT_jniutils.h"
+#include "ZT_jnicache.h"
#include <ZeroTierOne.h>
@@ -74,7 +74,7 @@ namespace {
JavaVM *jvm;
- ZT1_Node *node;
+ ZT_Node *node;
jobject dataStoreGetListener;
jobject dataStorePutListener;
@@ -86,11 +86,11 @@ namespace {
int VirtualNetworkConfigFunctionCallback(
- ZT1_Node *node,
+ ZT_Node *node,
void *userData,
uint64_t nwid,
- enum ZT1_VirtualNetworkConfigOperation operation,
- const ZT1_VirtualNetworkConfig *config)
+ enum ZT_VirtualNetworkConfigOperation operation,
+ const ZT_VirtualNetworkConfig *config)
{
LOGD("VritualNetworkConfigFunctionCallback");
JniRef *ref = (JniRef*)userData;
@@ -133,7 +133,7 @@ namespace {
(jlong)nwid, operationObject, networkConfigObject);
}
- void VirtualNetworkFrameFunctionCallback(ZT1_Node *node,void *userData,
+ void VirtualNetworkFrameFunctionCallback(ZT_Node *node,void *userData,
uint64_t nwid,
uint64_t sourceMac,
uint64_t destMac,
@@ -186,7 +186,7 @@ namespace {
}
- void EventCallback(ZT1_Node *node,void *userData,enum ZT1_Event event, const void *data)
+ void EventCallback(ZT_Node *node,void *userData,enum ZT_Event event, const void *data)
{
LOGD("EventCallback");
JniRef *ref = (JniRef*)userData;
@@ -245,18 +245,18 @@ namespace {
switch(event)
{
- case ZT1_EVENT_UP:
- case ZT1_EVENT_OFFLINE:
- case ZT1_EVENT_ONLINE:
- case ZT1_EVENT_DOWN:
- case ZT1_EVENT_FATAL_ERROR_IDENTITY_COLLISION:
+ case ZT_EVENT_UP:
+ case ZT_EVENT_OFFLINE:
+ case ZT_EVENT_ONLINE:
+ case ZT_EVENT_DOWN:
+ case ZT_EVENT_FATAL_ERROR_IDENTITY_COLLISION:
{
LOGV("Regular Event");
// call onEvent()
env->CallVoidMethod(ref->eventListener, onEventMethod, eventObject);
}
break;
- case ZT1_EVENT_SAW_MORE_RECENT_VERSION:
+ case ZT_EVENT_SAW_MORE_RECENT_VERSION:
{
LOGV("Version Event");
// call onOutOfDate()
@@ -268,8 +268,8 @@ namespace {
}
}
break;
- case ZT1_EVENT_AUTHENTICATION_FAILURE:
- case ZT1_EVENT_INVALID_PACKET:
+ case ZT_EVENT_AUTHENTICATION_FAILURE:
+ case ZT_EVENT_INVALID_PACKET:
{
LOGV("Network Error Event");
// call onNetworkError()
@@ -281,7 +281,7 @@ namespace {
}
}
break;
- case ZT1_EVENT_TRACE:
+ case ZT_EVENT_TRACE:
{
LOGV("Trace Event");
// call onTrace()
@@ -296,7 +296,7 @@ namespace {
}
}
- long DataStoreGetFunction(ZT1_Node *node,void *userData,
+ long DataStoreGetFunction(ZT_Node *node,void *userData,
const char *objectName,
void *buffer,
unsigned long bufferSize,
@@ -368,7 +368,7 @@ namespace {
return retval;
}
- int DataStorePutFunction(ZT1_Node *node,void *userData,
+ int DataStorePutFunction(ZT_Node *node,void *userData,
const char *objectName,
const void *buffer,
unsigned long bufferSize,
@@ -426,7 +426,7 @@ namespace {
}
}
- int WirePacketSendFunction(ZT1_Node *node,void *userData,\
+ int WirePacketSendFunction(ZT_Node *node,void *userData,\
const struct sockaddr_storage *address,
const void *buffer,
unsigned int bufferSize)
@@ -466,7 +466,7 @@ namespace {
typedef std::map<uint64_t, JniRef*> NodeMap;
static NodeMap nodeMap;
- ZT1_Node* findNode(uint64_t nodeId)
+ ZT_Node* findNode(uint64_t nodeId)
{
NodeMap::iterator found = nodeMap.find(nodeId);
if(found != nodeMap.end())
@@ -498,10 +498,10 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
JNIEnv *env, jobject obj, jlong now)
{
- LOGV("Creating ZT1_Node struct");
- jobject resultObject = createResultObject(env, ZT1_RESULT_OK);
+ LOGV("Creating ZT_Node struct");
+ jobject resultObject = createResultObject(env, ZT_RESULT_OK);
- ZT1_Node *node;
+ ZT_Node *node;
JniRef *ref = new JniRef;
ref->id = (uint64_t)now;
env->GetJavaVM(&ref->jvm);
@@ -593,7 +593,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
}
ref->eventListener = env->NewGlobalRef(tmp);
- ZT1_ResultCode rc = ZT1_Node_new(
+ ZT_ResultCode rc = ZT_Node_new(
&node,
ref,
(uint64_t)now,
@@ -604,13 +604,13 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
&VirtualNetworkConfigFunctionCallback,
&EventCallback);
- if(rc != ZT1_RESULT_OK)
+ if(rc != ZT_RESULT_OK)
{
LOGE("Error creating Node: %d", rc);
resultObject = createResultObject(env, rc);
if(node)
{
- ZT1_Node_delete(node);
+ ZT_Node_delete(node);
node = NULL;
}
delete ref;
@@ -632,7 +632,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
JNIEXPORT void JNICALL Java_com_zerotier_sdk_Node_node_1delete(
JNIEnv *env, jobject obj, jlong id)
{
- LOGV("Destroying ZT1_Node struct");
+ LOGV("Destroying ZT_Node struct");
uint64_t nodeId = (uint64_t)id;
NodeMap::iterator found = nodeMap.find(nodeId);
@@ -641,7 +641,7 @@ JNIEXPORT void JNICALL Java_com_zerotier_sdk_Node_node_1delete(
JniRef *ref = found->second;
nodeMap.erase(found);
- ZT1_Node_delete(ref->node);
+ ZT_Node_delete(ref->node);
delete ref;
ref = NULL;
@@ -671,18 +671,18 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processVirtualNetworkFrame(
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
unsigned int nbtd_len = env->GetArrayLength(out_nextBackgroundTaskDeadline);
if(nbtd_len < 1)
{
// array for next background task length has 0 elements!
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t now = (uint64_t)in_now;
@@ -697,7 +697,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processVirtualNetworkFrame(
uint64_t nextBackgroundTaskDeadline = 0;
- ZT1_ResultCode rc = ZT1_Node_processVirtualNetworkFrame(
+ ZT_ResultCode rc = ZT_Node_processVirtualNetworkFrame(
node,
now,
nwid,
@@ -732,17 +732,17 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
jlongArray out_nextBackgroundTaskDeadline)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
unsigned int nbtd_len = env->GetArrayLength(out_nextBackgroundTaskDeadline);
if(nbtd_len < 1)
{
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t now = (uint64_t)in_now;
@@ -752,7 +752,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(inetAddressClass == NULL)
{
// can't find java.net.InetAddress
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
jmethodID getAddressMethod = cache.findMethod(
@@ -760,13 +760,13 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(getAddressMethod == NULL)
{
// cant find InetAddress.getAddres()
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
jclass InetSocketAddressClass = cache.findClass("java/net/InetSocketAddress");
if(InetSocketAddressClass == NULL)
{
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
jmethodID inetSockGetAddressMethod = cache.findMethod(
@@ -776,7 +776,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(addrObject == NULL)
{
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
jmethodID inetSock_getPort = cache.findMethod(
@@ -785,7 +785,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(env->ExceptionCheck() || inetSock_getPort == NULL)
{
LOGE("Couldn't find getPort method on InetSocketAddress");
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
// call InetSocketAddress.getPort()
@@ -793,7 +793,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(env->ExceptionCheck())
{
LOGE("Exception calling InetSocketAddress.getPort()");
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
// Call InetAddress.getAddress()
@@ -801,7 +801,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
if(addressArray == NULL)
{
// unable to call getAddress()
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
unsigned int addrSize = env->GetArrayLength(addressArray);
@@ -833,7 +833,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
{
// unknown address type
env->ReleaseByteArrayElements(addressArray, addr, 0);
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
@@ -842,7 +842,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processWirePacket(
uint64_t nextBackgroundTaskDeadline = 0;
- ZT1_ResultCode rc = ZT1_Node_processWirePacket(
+ ZT_ResultCode rc = ZT_Node_processWirePacket(
node,
now,
&remoteAddress,
@@ -872,23 +872,23 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_processBackgroundTasks(
jlongArray out_nextBackgroundTaskDeadline)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
unsigned int nbtd_len = env->GetArrayLength(out_nextBackgroundTaskDeadline);
if(nbtd_len < 1)
{
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t now = (uint64_t)in_now;
uint64_t nextBackgroundTaskDeadline = 0;
- ZT1_ResultCode rc = ZT1_Node_processBackgroundTasks(node, now, &nextBackgroundTaskDeadline);
+ ZT_ResultCode rc = ZT_Node_processBackgroundTasks(node, now, &nextBackgroundTaskDeadline);
jlong *outDeadline = env->GetLongArrayElements(out_nextBackgroundTaskDeadline, NULL);
outDeadline[0] = (jlong)nextBackgroundTaskDeadline;
@@ -906,16 +906,16 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_join(
JNIEnv *env, jobject obj, jlong id, jlong in_nwid)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t nwid = (uint64_t)in_nwid;
- ZT1_ResultCode rc = ZT1_Node_join(node, nwid);
+ ZT_ResultCode rc = ZT_Node_join(node, nwid);
return createResultObject(env, rc);
}
@@ -929,16 +929,16 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_leave(
JNIEnv *env, jobject obj, jlong id, jlong in_nwid)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t nwid = (uint64_t)in_nwid;
- ZT1_ResultCode rc = ZT1_Node_leave(node, nwid);
+ ZT_ResultCode rc = ZT_Node_leave(node, nwid);
return createResultObject(env, rc);
}
@@ -956,18 +956,18 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_multicastSubscribe(
jlong in_multicastAdi)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t nwid = (uint64_t)in_nwid;
uint64_t multicastGroup = (uint64_t)in_multicastGroup;
unsigned long multicastAdi = (unsigned long)in_multicastAdi;
- ZT1_ResultCode rc = ZT1_Node_multicastSubscribe(
+ ZT_ResultCode rc = ZT_Node_multicastSubscribe(
node, nwid, multicastGroup, multicastAdi);
return createResultObject(env, rc);
@@ -986,18 +986,18 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_multicastUnsubscribe(
jlong in_multicastAdi)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
- return createResultObject(env, ZT1_RESULT_FATAL_ERROR_INTERNAL);
+ return createResultObject(env, ZT_RESULT_FATAL_ERROR_INTERNAL);
}
uint64_t nwid = (uint64_t)in_nwid;
uint64_t multicastGroup = (uint64_t)in_multicastGroup;
unsigned long multicastAdi = (unsigned long)in_multicastAdi;
- ZT1_ResultCode rc = ZT1_Node_multicastUnsubscribe(
+ ZT_ResultCode rc = ZT_Node_multicastUnsubscribe(
node, nwid, multicastGroup, multicastAdi);
return createResultObject(env, rc);
@@ -1012,14 +1012,14 @@ JNIEXPORT jlong JNICALL Java_com_zerotier_sdk_Node_address(
JNIEnv *env , jobject obj, jlong id)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
return 0;
}
- uint64_t address = ZT1_Node_address(node);
+ uint64_t address = ZT_Node_address(node);
return (jlong)address;
}
@@ -1032,7 +1032,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_status
(JNIEnv *env, jobject obj, jlong id)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
@@ -1062,8 +1062,8 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_status
return NULL;
}
- ZT1_NodeStatus nodeStatus;
- ZT1_Node_status(node, &nodeStatus);
+ ZT_NodeStatus nodeStatus;
+ ZT_Node_status(node, &nodeStatus);
jfieldID addressField = NULL;
jfieldID publicIdentityField = NULL;
@@ -1124,18 +1124,18 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_networkConfig(
JNIEnv *env, jobject obj, jlong id, jlong nwid)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
return 0;
}
- ZT1_VirtualNetworkConfig *vnetConfig = ZT1_Node_networkConfig(node, nwid);
+ ZT_VirtualNetworkConfig *vnetConfig = ZT_Node_networkConfig(node, nwid);
jobject vnetConfigObject = newNetworkConfig(env, *vnetConfig);
- ZT1_Node_freeQueryResult(node, vnetConfig);
+ ZT_Node_freeQueryResult(node, vnetConfig);
return vnetConfigObject;
}
@@ -1153,7 +1153,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_version(
int revision = 0;
unsigned long featureFlags = 0;
- ZT1_version(&major, &minor, &revision, &featureFlags);
+ ZT_version(&major, &minor, &revision, &featureFlags);
return newVersion(env, major, minor, revision, featureFlags);
}
@@ -1167,18 +1167,18 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
JNIEnv *env, jobject obj, jlong id)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
return 0;
}
- ZT1_PeerList *peerList = ZT1_Node_peers(node);
+ ZT_PeerList *peerList = ZT_Node_peers(node);
if(peerList == NULL)
{
- LOGE("ZT1_Node_peers returned NULL");
+ LOGE("ZT_Node_peers returned NULL");
return NULL;
}
@@ -1187,7 +1187,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
if(env->EnsureLocalCapacity(peerCount))
{
LOGE("EnsureLocalCapacity failed!!");
- ZT1_Node_freeQueryResult(node, peerList);
+ ZT_Node_freeQueryResult(node, peerList);
return NULL;
}
@@ -1195,7 +1195,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
if(env->ExceptionCheck() || peerClass == NULL)
{
LOGE("Error finding Peer class");
- ZT1_Node_freeQueryResult(node, peerList);
+ ZT_Node_freeQueryResult(node, peerList);
return NULL;
}
@@ -1205,7 +1205,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
if(env->ExceptionCheck() || peerArrayObj == NULL)
{
LOGE("Error creating Peer[] array");
- ZT1_Node_freeQueryResult(node, peerList);
+ ZT_Node_freeQueryResult(node, peerList);
return NULL;
}
@@ -1221,7 +1221,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
}
}
- ZT1_Node_freeQueryResult(node, peerList);
+ ZT_Node_freeQueryResult(node, peerList);
peerList = NULL;
return peerArrayObj;
@@ -1236,14 +1236,14 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_networks(
JNIEnv *env, jobject obj, jlong id)
{
uint64_t nodeId = (uint64_t) id;
- ZT1_Node *node = findNode(nodeId);
+ ZT_Node *node = findNode(nodeId);
if(node == NULL)
{
// cannot find valid node. We should never get here.
return 0;
}
- ZT1_VirtualNetworkList *networkList = ZT1_Node_networks(node);
+ ZT_VirtualNetworkList *networkList = ZT_Node_networks(node);
if(networkList == NULL)
{
return NULL;
@@ -1253,7 +1253,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_networks(
if(env->ExceptionCheck() || vnetConfigClass == NULL)
{
LOGE("Error finding VirtualNetworkConfig class");
- ZT1_Node_freeQueryResult(node, networkList);
+ ZT_Node_freeQueryResult(node, networkList);
return NULL;
}
@@ -1262,7 +1262,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_networks(
if(env->ExceptionCheck() || networkListObject == NULL)
{
LOGE("Error creating VirtualNetworkConfig[] array");
- ZT1_Node_freeQueryResult(node, networkList);
+ ZT_Node_freeQueryResult(node, networkList);
return NULL;
}
@@ -1277,7 +1277,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_networks(
}
}
- ZT1_Node_freeQueryResult(node, networkList);
+ ZT_Node_freeQueryResult(node, networkList);
return networkListObject;
}
diff --git a/java/src/com/zerotier/sdk/VirtualNetworkConfig.java b/java/src/com/zerotier/sdk/VirtualNetworkConfig.java
index 2be03acb..78ac9da5 100644
--- a/java/src/com/zerotier/sdk/VirtualNetworkConfig.java
+++ b/java/src/com/zerotier/sdk/VirtualNetworkConfig.java
@@ -33,7 +33,7 @@ import java.net.InetSocketAddress;
public final class VirtualNetworkConfig {
public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096;
- public static final int ZT1_MAX_ZT_ASSIGNED_ADDRESSES = 16;
+ public static final int ZT_MAX_ZT_ASSIGNED_ADDRESSES = 16;
private long nwid;
private long mac;