make NodeStatus a plain data class

This commit is contained in:
Brenton Bostick 2023-01-31 13:40:17 -05:00
parent acf5b3579b
commit 4861ec5a40
6 changed files with 75 additions and 63 deletions

View file

@ -428,3 +428,34 @@ jobject newVirtualNetworkDNS(JNIEnv *env, const ZT_VirtualNetworkDNS &dns)
}
return NULL;
}
jobject newNodeStatus(JNIEnv *env, const ZT_NodeStatus &status) {
jstring pubIdentStr = env->NewStringUTF(status.publicIdentity);
if(env->ExceptionCheck() || pubIdentStr == NULL)
{
LOGE("Exception creating new string");
return NULL;
}
jstring secIdentStr = env->NewStringUTF(status.secretIdentity);
if(env->ExceptionCheck() || secIdentStr == NULL)
{
LOGE("Exception creating new string");
return NULL;
}
jobject nodeStatusObj = env->NewObject(
NodeStatus_class,
NodeStatus_ctor,
status.address,
pubIdentStr,
secIdentStr,
status.online);
if(env->ExceptionCheck() || nodeStatusObj == NULL) {
LOGE("Exception creating new NodeStatus");
return NULL;
}
return nodeStatusObj;
}