Rename JniCache to JniLookup
Removed caching capabilities as the cached methods, fields, and objects appears to be broken on Android
This commit is contained in:
parent
7e84f5a7db
commit
472206dfb2
7 changed files with 266 additions and 361 deletions
|
@ -1,9 +1,9 @@
|
|||
#include "ZT1_jniutils.h"
|
||||
#include "ZT1_jnicache.h"
|
||||
#include "ZT1_jnilookup.h"
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
extern JniCache cache;
|
||||
extern JniLookup lookup;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -15,7 +15,7 @@ jobject createResultObject(JNIEnv *env, ZT1_ResultCode code)
|
|||
|
||||
jobject resultObject = NULL;
|
||||
|
||||
resultClass = cache.findClass("com/zerotier/sdk/ResultCode");
|
||||
resultClass = lookup.findClass("com/zerotier/sdk/ResultCode");
|
||||
if(resultClass == NULL)
|
||||
{
|
||||
LOGE("Couldnt find ResultCode class");
|
||||
|
@ -48,7 +48,7 @@ jobject createResultObject(JNIEnv *env, ZT1_ResultCode code)
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(resultClass, fieldName.c_str(), "Lcom/zerotier/sdk/ResultCode;");
|
||||
jfieldID enumField = lookup.findStaticField(resultClass, fieldName.c_str(), "Lcom/zerotier/sdk/ResultCode;");
|
||||
if(env->ExceptionCheck() || enumField == NULL)
|
||||
{
|
||||
LOGE("Error on FindStaticField");
|
||||
|
@ -68,7 +68,7 @@ jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status)
|
|||
{
|
||||
jobject statusObject = NULL;
|
||||
|
||||
jclass statusClass = cache.findClass("com/zerotier/sdk/VirtualNetworkStatus");
|
||||
jclass statusClass = lookup.findClass("com/zerotier/sdk/VirtualNetworkStatus");
|
||||
if(statusClass == NULL)
|
||||
{
|
||||
return NULL; // exception thrown
|
||||
|
@ -97,7 +97,7 @@ jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status)
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(statusClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkStatus;");
|
||||
jfieldID enumField = lookup.findStaticField(statusClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkStatus;");
|
||||
|
||||
statusObject = env->GetStaticObjectField(statusClass, enumField);
|
||||
|
||||
|
@ -109,7 +109,7 @@ jobject createEvent(JNIEnv *env, ZT1_Event event)
|
|||
jclass eventClass = NULL;
|
||||
jobject eventObject = NULL;
|
||||
|
||||
eventClass = cache.findClass("com/zerotier/sdk/Event");
|
||||
eventClass = lookup.findClass("com/zerotier/sdk/Event");
|
||||
if(eventClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -147,7 +147,7 @@ jobject createEvent(JNIEnv *env, ZT1_Event event)
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(eventClass, fieldName.c_str(), "Lcom/zerotier/sdk/Event;");
|
||||
jfieldID enumField = lookup.findStaticField(eventClass, fieldName.c_str(), "Lcom/zerotier/sdk/Event;");
|
||||
|
||||
eventObject = env->GetStaticObjectField(eventClass, enumField);
|
||||
|
||||
|
@ -159,7 +159,7 @@ jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role)
|
|||
jclass peerRoleClass = NULL;
|
||||
jobject peerRoleObject = NULL;
|
||||
|
||||
peerRoleClass = cache.findClass("com/zerotier/sdk/PeerRole");
|
||||
peerRoleClass = lookup.findClass("com/zerotier/sdk/PeerRole");
|
||||
if(peerRoleClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -179,7 +179,7 @@ jobject createPeerRole(JNIEnv *env, ZT1_PeerRole role)
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(peerRoleClass, fieldName.c_str(), "Lcom/zerotier/sdk/PeerRole;");
|
||||
jfieldID enumField = lookup.findStaticField(peerRoleClass, fieldName.c_str(), "Lcom/zerotier/sdk/PeerRole;");
|
||||
|
||||
peerRoleObject = env->GetStaticObjectField(peerRoleClass, enumField);
|
||||
|
||||
|
@ -191,7 +191,7 @@ jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type)
|
|||
jclass vntypeClass = NULL;
|
||||
jobject vntypeObject = NULL;
|
||||
|
||||
vntypeClass = cache.findClass("com/zerotier/sdk/VirtualNetworkType");
|
||||
vntypeClass = lookup.findClass("com/zerotier/sdk/VirtualNetworkType");
|
||||
if(env->ExceptionCheck() || vntypeClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -208,7 +208,7 @@ jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type)
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(vntypeClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkType;");
|
||||
jfieldID enumField = lookup.findStaticField(vntypeClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkType;");
|
||||
vntypeObject = env->GetStaticObjectField(vntypeClass, enumField);
|
||||
return vntypeObject;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfi
|
|||
jclass vnetConfigOpClass = NULL;
|
||||
jobject vnetConfigOpObject = NULL;
|
||||
|
||||
vnetConfigOpClass = cache.findClass("com/zerotier/sdk/VirtualNetworkConfigOperation");
|
||||
vnetConfigOpClass = lookup.findClass("com/zerotier/sdk/VirtualNetworkConfigOperation");
|
||||
if(env->ExceptionCheck() || vnetConfigOpClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -241,7 +241,7 @@ jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT1_VirtualNetworkConfi
|
|||
break;
|
||||
}
|
||||
|
||||
jfieldID enumField = cache.findStaticField(vnetConfigOpClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkConfigOperation;");
|
||||
jfieldID enumField = lookup.findStaticField(vnetConfigOpClass, fieldName.c_str(), "Lcom/zerotier/sdk/VirtualNetworkConfigOperation;");
|
||||
vnetConfigOpObject = env->GetStaticObjectField(vnetConfigOpClass, enumField);
|
||||
return vnetConfigOpObject;
|
||||
}
|
||||
|
@ -252,14 +252,14 @@ jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
jclass inetAddressClass = NULL;
|
||||
jmethodID inetAddress_getByAddress = NULL;
|
||||
|
||||
inetAddressClass = cache.findClass("java/net/InetAddress");
|
||||
inetAddressClass = lookup.findClass("java/net/InetAddress");
|
||||
if(env->ExceptionCheck() || inetAddressClass == NULL)
|
||||
{
|
||||
LOGE("Error finding InetAddress class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inetAddress_getByAddress = cache.findStaticMethod(
|
||||
inetAddress_getByAddress = lookup.findStaticMethod(
|
||||
inetAddressClass, "getByAddress", "([B)Ljava/net/InetAddress;");
|
||||
if(env->ExceptionCheck() || inetAddress_getByAddress == NULL)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
jclass inetSocketAddressClass = NULL;
|
||||
jmethodID inetSocketAddress_constructor = NULL;
|
||||
|
||||
inetSocketAddressClass = cache.findClass("java/net/InetSocketAddress");
|
||||
inetSocketAddressClass = lookup.findClass("java/net/InetSocketAddress");
|
||||
if(env->ExceptionCheck() || inetSocketAddressClass == NULL)
|
||||
{
|
||||
LOGE("Error finding InetSocketAddress Class");
|
||||
|
@ -330,7 +330,7 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
inetSocketAddress_constructor = cache.findMethod(
|
||||
inetSocketAddress_constructor = lookup.findMethod(
|
||||
inetSocketAddressClass, "<init>", "(Ljava/net/InetAddress;I)V");
|
||||
if(env->ExceptionCheck() || inetSocketAddress_constructor == NULL)
|
||||
{
|
||||
|
@ -380,13 +380,13 @@ jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc)
|
|||
jfieldID macField = NULL;
|
||||
jfieldID adiField = NULL;
|
||||
|
||||
multicastGroupClass = cache.findClass("com/zerotier/sdk/MulticastGroup");
|
||||
multicastGroupClass = lookup.findClass("com/zerotier/sdk/MulticastGroup");
|
||||
if(env->ExceptionCheck() || multicastGroupClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
multicastGroup_constructor = cache.findMethod(
|
||||
multicastGroup_constructor = lookup.findMethod(
|
||||
multicastGroupClass, "<init>", "()V");
|
||||
if(env->ExceptionCheck() || multicastGroup_constructor == NULL)
|
||||
{
|
||||
|
@ -399,13 +399,13 @@ jobject newMulticastGroup(JNIEnv *env, const ZT1_MulticastGroup &mc)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
macField = cache.findField(multicastGroupClass, "mac", "J");
|
||||
macField = lookup.findField(multicastGroupClass, "mac", "J");
|
||||
if(env->ExceptionCheck() || macField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
adiField = cache.findField(multicastGroupClass, "adi", "J");
|
||||
adiField = lookup.findField(multicastGroupClass, "adi", "J");
|
||||
if(env->ExceptionCheck() || adiField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -431,56 +431,56 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT1_PeerPhysicalPath &ppp)
|
|||
|
||||
jmethodID ppp_constructor = NULL;
|
||||
|
||||
pppClass = cache.findClass("com/zerotier/sdk/PeerPhysicalPath");
|
||||
pppClass = lookup.findClass("com/zerotier/sdk/PeerPhysicalPath");
|
||||
if(env->ExceptionCheck() || pppClass == NULL)
|
||||
{
|
||||
LOGE("Error finding PeerPhysicalPath class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
addressField = cache.findField(pppClass, "address", "Ljava/net/InetSocketAddress;");
|
||||
addressField = lookup.findField(pppClass, "address", "Ljava/net/InetSocketAddress;");
|
||||
if(env->ExceptionCheck() || addressField == NULL)
|
||||
{
|
||||
LOGE("Error finding address field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lastSendField = cache.findField(pppClass, "lastSend", "J");
|
||||
lastSendField = lookup.findField(pppClass, "lastSend", "J");
|
||||
if(env->ExceptionCheck() || lastSendField == NULL)
|
||||
{
|
||||
LOGE("Error finding lastSend field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lastReceiveField = cache.findField(pppClass, "lastReceive", "J");
|
||||
lastReceiveField = lookup.findField(pppClass, "lastReceive", "J");
|
||||
if(env->ExceptionCheck() || lastReceiveField == NULL)
|
||||
{
|
||||
LOGE("Error finding lastReceive field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fixedField = cache.findField(pppClass, "fixed", "Z");
|
||||
fixedField = lookup.findField(pppClass, "fixed", "Z");
|
||||
if(env->ExceptionCheck() || fixedField == NULL)
|
||||
{
|
||||
LOGE("Error finding fixed field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
activeField = cache.findField(pppClass, "active", "Z");
|
||||
activeField = lookup.findField(pppClass, "active", "Z");
|
||||
if(env->ExceptionCheck() || activeField == NULL)
|
||||
{
|
||||
LOGE("Error finding active field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
preferredField = cache.findField(pppClass, "preferred", "Z");
|
||||
preferredField = lookup.findField(pppClass, "preferred", "Z");
|
||||
if(env->ExceptionCheck() || preferredField == NULL)
|
||||
{
|
||||
LOGE("Error finding preferred field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ppp_constructor = cache.findMethod(pppClass, "<init>", "()V");
|
||||
ppp_constructor = lookup.findMethod(pppClass, "<init>", "()V");
|
||||
if(env->ExceptionCheck() || ppp_constructor == NULL)
|
||||
{
|
||||
LOGE("Error finding PeerPhysicalPath constructor");
|
||||
|
@ -532,77 +532,77 @@ jobject newPeer(JNIEnv *env, const ZT1_Peer &peer)
|
|||
|
||||
jmethodID peer_constructor = NULL;
|
||||
|
||||
peerClass = cache.findClass("com/zerotier/sdk/Peer");
|
||||
peerClass = lookup.findClass("com/zerotier/sdk/Peer");
|
||||
if(env->ExceptionCheck() || peerClass == NULL)
|
||||
{
|
||||
LOGE("Error finding Peer class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
addressField = cache.findField(peerClass, "address", "J");
|
||||
addressField = lookup.findField(peerClass, "address", "J");
|
||||
if(env->ExceptionCheck() || addressField == NULL)
|
||||
{
|
||||
LOGE("Error finding address field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lastUnicastFrameField = cache.findField(peerClass, "lastUnicastFrame", "J");
|
||||
lastUnicastFrameField = lookup.findField(peerClass, "lastUnicastFrame", "J");
|
||||
if(env->ExceptionCheck() || lastUnicastFrameField == NULL)
|
||||
{
|
||||
LOGE("Error finding lastUnicastFrame field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lastMulticastFrameField = cache.findField(peerClass, "lastMulticastFrame", "J");
|
||||
lastMulticastFrameField = lookup.findField(peerClass, "lastMulticastFrame", "J");
|
||||
if(env->ExceptionCheck() || lastMulticastFrameField == NULL)
|
||||
{
|
||||
LOGE("Error finding lastMulticastFrame field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
versionMajorField = cache.findField(peerClass, "versionMajor", "I");
|
||||
versionMajorField = lookup.findField(peerClass, "versionMajor", "I");
|
||||
if(env->ExceptionCheck() || versionMajorField == NULL)
|
||||
{
|
||||
LOGE("Error finding versionMajor field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
versionMinorField = cache.findField(peerClass, "versionMinor", "I");
|
||||
versionMinorField = lookup.findField(peerClass, "versionMinor", "I");
|
||||
if(env->ExceptionCheck() || versionMinorField == NULL)
|
||||
{
|
||||
LOGE("Error finding versionMinor field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
versionRevField = cache.findField(peerClass, "versionRev", "I");
|
||||
versionRevField = lookup.findField(peerClass, "versionRev", "I");
|
||||
if(env->ExceptionCheck() || versionRevField == NULL)
|
||||
{
|
||||
LOGE("Error finding versionRev field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
latencyField = cache.findField(peerClass, "latency", "I");
|
||||
latencyField = lookup.findField(peerClass, "latency", "I");
|
||||
if(env->ExceptionCheck() || latencyField == NULL)
|
||||
{
|
||||
LOGE("Error finding latency field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
roleField = cache.findField(peerClass, "role", "Lcom/zerotier/sdk/PeerRole;");
|
||||
roleField = lookup.findField(peerClass, "role", "Lcom/zerotier/sdk/PeerRole;");
|
||||
if(env->ExceptionCheck() || roleField == NULL)
|
||||
{
|
||||
LOGE("Error finding role field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pathsField = cache.findField(peerClass, "paths", "[Lcom/zerotier/sdk/PeerPhysicalPath;");
|
||||
pathsField = lookup.findField(peerClass, "paths", "[Lcom/zerotier/sdk/PeerPhysicalPath;");
|
||||
if(env->ExceptionCheck() || pathsField == NULL)
|
||||
{
|
||||
LOGE("Error finding paths field of Peer object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
peer_constructor = cache.findMethod(peerClass, "<init>", "()V");
|
||||
peer_constructor = lookup.findMethod(peerClass, "<init>", "()V");
|
||||
if(env->ExceptionCheck() || peer_constructor == NULL)
|
||||
{
|
||||
LOGE("Error finding Peer constructor");
|
||||
|
@ -625,7 +625,7 @@ jobject newPeer(JNIEnv *env, const ZT1_Peer &peer)
|
|||
env->SetIntField(peerObject, latencyField, peer.latency);
|
||||
env->SetObjectField(peerObject, roleField, createPeerRole(env, peer.role));
|
||||
|
||||
jclass peerPhysicalPathClass = cache.findClass("com/zerotier/sdk/PeerPhysicalPath");
|
||||
jclass peerPhysicalPathClass = lookup.findClass("com/zerotier/sdk/PeerPhysicalPath");
|
||||
if(env->ExceptionCheck() || peerPhysicalPathClass == NULL)
|
||||
{
|
||||
LOGE("Error finding PeerPhysicalPath class");
|
||||
|
@ -675,14 +675,14 @@ jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &vnetConfig
|
|||
jfieldID multicastSubscriptionsField = NULL;
|
||||
jfieldID assignedAddressesField = NULL;
|
||||
|
||||
vnetConfigClass = cache.findClass("com/zerotier/sdk/VirtualNetworkConfig");
|
||||
vnetConfigClass = lookup.findClass("com/zerotier/sdk/VirtualNetworkConfig");
|
||||
if(vnetConfigClass == NULL)
|
||||
{
|
||||
LOGE("Couldn't find com.zerotier.sdk.VirtualNetworkConfig");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vnetConfig_constructor = cache.findMethod(
|
||||
vnetConfig_constructor = lookup.findMethod(
|
||||
vnetConfigClass, "<init>", "()V");
|
||||
if(env->ExceptionCheck() || vnetConfig_constructor == NULL)
|
||||
{
|
||||
|
@ -697,98 +697,98 @@ jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &vnetConfig
|
|||
return NULL;
|
||||
}
|
||||
|
||||
nwidField = cache.findField(vnetConfigClass, "nwid", "J");
|
||||
nwidField = lookup.findField(vnetConfigClass, "nwid", "J");
|
||||
if(env->ExceptionCheck() || nwidField == NULL)
|
||||
{
|
||||
LOGE("Error getting nwid field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
macField = cache.findField(vnetConfigClass, "mac", "J");
|
||||
macField = lookup.findField(vnetConfigClass, "mac", "J");
|
||||
if(env->ExceptionCheck() || macField == NULL)
|
||||
{
|
||||
LOGE("Error getting mac field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nameField = cache.findField(vnetConfigClass, "name", "Ljava/lang/String;");
|
||||
nameField = lookup.findField(vnetConfigClass, "name", "Ljava/lang/String;");
|
||||
if(env->ExceptionCheck() || nameField == NULL)
|
||||
{
|
||||
LOGE("Error getting name field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
statusField = cache.findField(vnetConfigClass, "status", "Lcom/zerotier/sdk/VirtualNetworkStatus;");
|
||||
statusField = lookup.findField(vnetConfigClass, "status", "Lcom/zerotier/sdk/VirtualNetworkStatus;");
|
||||
if(env->ExceptionCheck() || statusField == NULL)
|
||||
{
|
||||
LOGE("Error getting status field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typeField = cache.findField(vnetConfigClass, "type", "Lcom/zerotier/sdk/VirtualNetworkType;");
|
||||
typeField = lookup.findField(vnetConfigClass, "type", "Lcom/zerotier/sdk/VirtualNetworkType;");
|
||||
if(env->ExceptionCheck() || typeField == NULL)
|
||||
{
|
||||
LOGE("Error getting type field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mtuField = cache.findField(vnetConfigClass, "mtu", "I");
|
||||
mtuField = lookup.findField(vnetConfigClass, "mtu", "I");
|
||||
if(env->ExceptionCheck() || mtuField == NULL)
|
||||
{
|
||||
LOGE("Error getting mtu field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dhcpField = cache.findField(vnetConfigClass, "dhcp", "Z");
|
||||
dhcpField = lookup.findField(vnetConfigClass, "dhcp", "Z");
|
||||
if(env->ExceptionCheck() || dhcpField == NULL)
|
||||
{
|
||||
LOGE("Error getting dhcp field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bridgeField = cache.findField(vnetConfigClass, "bridge", "Z");
|
||||
bridgeField = lookup.findField(vnetConfigClass, "bridge", "Z");
|
||||
if(env->ExceptionCheck() || bridgeField == NULL)
|
||||
{
|
||||
LOGE("Error getting bridge field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
broadcastEnabledField = cache.findField(vnetConfigClass, "broadcastEnabled", "Z");
|
||||
broadcastEnabledField = lookup.findField(vnetConfigClass, "broadcastEnabled", "Z");
|
||||
if(env->ExceptionCheck() || broadcastEnabledField == NULL)
|
||||
{
|
||||
LOGE("Error getting broadcastEnabled field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
portErrorField = cache.findField(vnetConfigClass, "portError", "I");
|
||||
portErrorField = lookup.findField(vnetConfigClass, "portError", "I");
|
||||
if(env->ExceptionCheck() || portErrorField == NULL)
|
||||
{
|
||||
LOGE("Error getting portError field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enabledField = cache.findField(vnetConfigClass, "enabled", "Z");
|
||||
enabledField = lookup.findField(vnetConfigClass, "enabled", "Z");
|
||||
if(env->ExceptionCheck() || enabledField == NULL)
|
||||
{
|
||||
LOGE("Error getting enabled field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
netconfRevisionField = cache.findField(vnetConfigClass, "netconfRevision", "J");
|
||||
netconfRevisionField = lookup.findField(vnetConfigClass, "netconfRevision", "J");
|
||||
if(env->ExceptionCheck() || netconfRevisionField == NULL)
|
||||
{
|
||||
LOGE("Error getting netconfRevision field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
multicastSubscriptionsField = cache.findField(vnetConfigClass, "multicastSubscriptions", "[Lcom/zerotier/sdk/MulticastGroup;");
|
||||
multicastSubscriptionsField = lookup.findField(vnetConfigClass, "multicastSubscriptions", "[Lcom/zerotier/sdk/MulticastGroup;");
|
||||
if(env->ExceptionCheck() || multicastSubscriptionsField == NULL)
|
||||
{
|
||||
LOGE("Error getting multicastSubscriptions field");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
assignedAddressesField = cache.findField(vnetConfigClass, "assignedAddresses", "[Ljava/net/InetSocketAddress;");
|
||||
assignedAddressesField = lookup.findField(vnetConfigClass, "assignedAddresses", "[Ljava/net/InetSocketAddress;");
|
||||
if(env->ExceptionCheck() || assignedAddressesField == NULL)
|
||||
{
|
||||
LOGE("Error getting assignedAddresses field");
|
||||
|
@ -825,7 +825,7 @@ jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &vnetConfig
|
|||
env->SetBooleanField(vnetConfigObj, enabledField, vnetConfig.enabled);
|
||||
env->SetIntField(vnetConfigObj, portErrorField, vnetConfig.portError);
|
||||
|
||||
jclass multicastGroupClass = cache.findClass("com/zerotier/sdk/MulticastGroup");
|
||||
jclass multicastGroupClass = lookup.findClass("com/zerotier/sdk/MulticastGroup");
|
||||
if(env->ExceptionCheck() || multicastGroupClass == NULL)
|
||||
{
|
||||
LOGE("Error finding MulticastGroup class");
|
||||
|
@ -850,7 +850,7 @@ jobject newNetworkConfig(JNIEnv *env, const ZT1_VirtualNetworkConfig &vnetConfig
|
|||
}
|
||||
env->SetObjectField(vnetConfigObj, multicastSubscriptionsField, mcastSubsArrayObj);
|
||||
|
||||
jclass inetSocketAddressClass = cache.findClass("java/net/InetSocketAddress");
|
||||
jclass inetSocketAddressClass = lookup.findClass("java/net/InetSocketAddress");
|
||||
if(env->ExceptionCheck() || inetSocketAddressClass == NULL)
|
||||
{
|
||||
LOGE("Error finding InetSocketAddress class");
|
||||
|
@ -887,13 +887,13 @@ jobject newVersion(JNIEnv *env, int major, int minor, int rev, long featureFlags
|
|||
jclass versionClass = NULL;
|
||||
jmethodID versionConstructor = NULL;
|
||||
|
||||
versionClass = cache.findClass("com/zerotier/sdk/Version");
|
||||
versionClass = lookup.findClass("com/zerotier/sdk/Version");
|
||||
if(env->ExceptionCheck() || versionClass == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
versionConstructor = cache.findMethod(
|
||||
versionConstructor = lookup.findMethod(
|
||||
versionClass, "<init>", "()V");
|
||||
if(env->ExceptionCheck() || versionConstructor == NULL)
|
||||
{
|
||||
|
@ -912,25 +912,25 @@ jobject newVersion(JNIEnv *env, int major, int minor, int rev, long featureFlags
|
|||
jfieldID revisionField = NULL;
|
||||
jfieldID featureFlagsField = NULL;
|
||||
|
||||
majorField = cache.findField(versionClass, "major", "I");
|
||||
majorField = lookup.findField(versionClass, "major", "I");
|
||||
if(env->ExceptionCheck() || majorField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
minorField = cache.findField(versionClass, "minor", "I");
|
||||
minorField = lookup.findField(versionClass, "minor", "I");
|
||||
if(env->ExceptionCheck() || minorField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
revisionField = cache.findField(versionClass, "revision", "I");
|
||||
revisionField = lookup.findField(versionClass, "revision", "I");
|
||||
if(env->ExceptionCheck() || revisionField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
featureFlagsField = cache.findField(versionClass, "featureFlags", "J");
|
||||
featureFlagsField = lookup.findField(versionClass, "featureFlags", "J");
|
||||
if(env->ExceptionCheck() || featureFlagsField == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue