Added ant build script. Requires NDK_BUILD_LOC environment variable pointing to the ndk-build script

fixed compile erros in Node and VirutalNetworkConfig

Signed-off-by: Grant Limberg <glimberg@gmail.com>
This commit is contained in:
Grant Limberg 2015-04-23 20:17:29 -07:00
parent 667a103a6a
commit 407e2fc7de
4 changed files with 120 additions and 14 deletions

1
.gitignore vendored
View File

@ -46,3 +46,4 @@
/netconf/netconf.db
java/obj/
java/libs/
java/bin/

46
java/build.xml Normal file
View File

@ -0,0 +1,46 @@
<project default="android" name="ZeroTierOneSDK">
<property environment="env"/>
<target name="clean">
<delete dir="bin"/>
<delete dir="libs"/>
<delete dir="obj"/>
<delete>
<fileset dir="jni" includes="*.so"/>
</delete>
</target>
<target name="build">
<echo message="os.name = ${os.name}"/>
<echo message="os.arch = ${os.arch}"/>
<echo message="ant.java.version = ${ant.java.version}"/>
<echo message="java.version = ${java.version}"/>
<javac srcdir="src"
destdir="bin"
classpath="${env.ANDROID_PLATFORM}/android.jar"
includeantruntime="false"/>
<exec dir="jni" executable="${env.NDK_BUILD_LOC}" failonerror="true">
<arg value="ZT1=${user.dir}/../"/>
</exec>
<jar destfile="bin/ZeroTierOneSDK.jar" basedir="bin"/>
</target>
<!-- <target name="android" depends="build">
<echo message="OS is Android, installing..."/>
<copy file="libs/armeabi/libZeroTierOneJNI.so"
tofile="${aproj_loc}/libs/armeabi/libZeroTierOneJNI.so"
overwrite="true"/>
<copy file="libs/arm64-v8a/libZeroTierOneJNI.so"
tofile="${aproj_loc}/libs/arm64-v8a/libZeroTierOneJNI.so"
overwrite="true"/>
<copy file="libs/armeabi-v7a/libZeroTierOneJNI.so"
tofile="${aproj_loc}/libs/armeabi-v7a/libZeroTierOneJNI.so"
overwrite="true"/>
<copy file="libs/x86/libZeroTierOneJNI.so"
tofile="${aproj_loc}/libs/x86/libZeroTierOneJNI.so"
overwrite="true"/>
<copy file="bin/ZeroTierOneSDK.jar"
tofile="${aproj_loc}/libs/ZeroTierOneSDK.jar"
overwrite="true"/>
</target> -->
</project>

View File

@ -44,7 +44,7 @@ public class Node {
*
* -1 if the node has already been closed
*/
private final long nodeId;
private long nodeId;
private final DataStoreGetListener getListener;
private final DataStorePutListener putListener;
@ -68,7 +68,7 @@ public class Node {
this.configListener = configListener;
ResultCode rc = node_init(now);
if(rc.getValue() != ResultCode.RESULT_OK)
if(rc != ResultCode.RESULT_OK)
{
// TODO: Throw Exception
}
@ -97,7 +97,7 @@ public class Node {
long[] nextBackgroundTaskDeadline) {
return processVirtualNetworkFrame(
nodeId, now, nwid, sourceMac, destMac, etherType, vlanId,
frameData, frameLength, nextBackgroundTaskDeadline);
frameData, nextBackgroundTaskDeadline);
}
public ResultCode processWirePacket(
@ -111,7 +111,7 @@ public class Node {
nextBackgroundTaskDeadline);
}
public ResultCode processBackgroundTasks(long now, long nextBackgroundTaskDeadline) {
public ResultCode processBackgroundTasks(long now, long[] nextBackgroundTaskDeadline) {
return processBackgroundTasks(nodeId, now, nextBackgroundTaskDeadline);
}
@ -159,14 +159,14 @@ public class Node {
// TODO: ZT1_Node_peers
public VirtualNetworkConfig networkConfig() {
return networkConfig(nodeId);
public VirtualNetworkConfig networkConfig(long nwid) {
return networkConfig(nodeId, nwid);
}
// TODO: ZT1_Node_networks
public Version version() {
return version(nodeId);
public Version getVersion() {
return version();
}
/**

View File

@ -29,7 +29,7 @@ package com.zerotierone.sdk;
import java.lang.String;
import java.util.ArrayList;
import java.net.InetAddresss;
import java.net.InetAddress;
public class VirtualNetworkConfig {
public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096;
@ -41,13 +41,72 @@ public class VirtualNetworkConfig {
private VirtualNetworkStatus status;
private VirtualNetworkType type;
private int mtu;
private int dhcp;
private int bridge;
private int broadcastEnabled;
private int portError;
private boolean dhcp;
private boolean bridge;
private boolean broadcastEnabled;
private boolean portError;
private boolean enabled;
private long netconfRevision;
private int multicastSubscriptionCount;
private ArrayList<MulticastGroup> multicastSubscriptions;
private ArrayList<InetAddress> assignedAddresses;
}
private VirtualNetworkConfig() {
}
public final long networkId() {
return nwid;
}
public final long macAddress() {
return mac;
}
public final String name() {
return name;
}
public final VirtualNetworkStatus networkStatus() {
return status;
}
public final VirtualNetworkType networkType() {
return type;
}
public final int mtu() {
return mtu;
}
public final boolean isDhcpAvailable() {
return dhcp;
}
public final boolean isBridgeEnabled() {
return bridge;
}
public final boolean broadcastEnabled() {
return broadcastEnabled;
}
public final boolean portError() {
return portError;
}
public final boolean isEnabled() {
return enabled;
}
public final long netconfRevision() {
return netconfRevision;
}
public final ArrayList<MulticastGroup> multicastSubscriptions() {
return multicastSubscriptions;
}
public final ArrayList<InetAddress> assignedAddresses() {
return assignedAddresses;
}
}