Commit Graph

143 Commits

Author SHA1 Message Date
Grant Limberg
d063f583ee Added VirtualNetworkRoute class and added it to VirtualNetworkConfig 2016-09-05 13:52:29 -07:00
Grant Limberg
8a15b42dab switch to GCC for Android 2016-07-14 19:29:00 -07:00
Grant Limberg
be0af135bc update JNI code for 1.1.6 2016-07-07 20:07:07 -07:00
Grant Limberg
3993dfa2a5 Fix JNI for API changes in 1.1.4 2016-01-22 18:06:58 -08:00
Grant Limberg
399b2e9e26 forgot to submit this. Add DeferredPackets.cpp to the android makefile 2015-11-17 19:16:10 -08:00
Grant Limberg
0508a41afd added ttl parameter to WirePacketSendFunction 2015-11-14 17:40:17 -08:00
Grant Limberg
eadeac0a42 logging of events 2015-11-03 19:14:11 -08:00
Grant Limberg
b7df177f33 updates for origin/edge 2015-11-02 19:18:55 -08:00
Grant Limberg
75a191a856 don't create an InetSocketAddress on local address if it's equal to ZT_SOCKADDR_NULL 2015-09-26 14:10:45 -07:00
Grant Limberg
7c3be2b5c1 fix function signature in lookup for onSendPacketRequested function 2015-09-26 14:10:16 -07:00
Grant Limberg
e8cdff3eaf Merge branch 'adamierymenko-dev' into android-jni-dev
also update for changed function calls that now accept a local address

# Conflicts:
#	include/ZeroTierOne.h
#	java/CMakeLists.txt
#	java/jni/Android.mk
#	java/jni/ZT1_jnicache.cpp
#	java/jni/ZT1_jnilookup.h
#	java/jni/ZT1_jniutils.cpp
#	java/jni/com_zerotierone_sdk_Node.cpp
2015-09-26 13:47:55 -07:00
Adam Ierymenko
f69454ec98 (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. 2015-09-24 16:21:36 -07:00
Grant Limberg
a408e5f685 set ZT_NO_TYPE_PUNNING and -O3 for Android builds 2015-07-08 18:00:13 -07:00
Grant Limberg
ab34884e3e Set -O0
anything above that currently goes kaboom on ARM platforms
2015-07-03 18:14:50 -07:00
Grant Limberg
0b7cd2f40a change some build settings. add a lock 2015-07-01 20:26:14 -07:00
Grant Limberg
f803dd5ff4 ... 2015-07-01 18:13:39 -07:00
Grant Limberg
aee8e95d49 logging 2015-06-30 19:21:46 -07:00
Grant Limberg
c9919cc5ba reflect changes to ZT1_PeerRole in JNI 2015-06-26 18:26:57 -07:00
Grant Limberg
bfb152f53f configure the NDK to build all supported ABIs and package them up in the jar 2015-06-24 20:31:22 -07:00
Grant Limberg
dfdd46db80 Merge branch 'adamierymenko-dev' into android-jni 2015-06-17 18:42:23 -07:00
Grant Limberg
472206dfb2 Rename JniCache to JniLookup
Removed caching capabilities as the cached methods, fields, and objects appears to be broken on Android
2015-06-10 20:16:13 -07:00
Grant Limberg
7e84f5a7db killing whitespace 2015-06-09 23:24:54 -07:00
Grant Limberg
6889fcfc28 Looks like it was the JNI cash causing the crash.
Forcing it to look up classes and methods instead of caching them stopped the crashes in the GC.  Will investigate more later.
2015-06-09 23:24:47 -07:00
Grant Limberg
4dc0ff8f13 Replace calls to Get<Type>ArrayElements with GetPrimitiveArrayCritical.
This puts code accessing the data in a critical section so that the GC cannot run while JNI has access to the array.  This helps with stability somewhat, but I'm still getting some crashes in the GC
2015-06-09 23:12:44 -07:00
Grant Limberg
ced040c503 Logging and adding .equals() methods to MulticastGroup and VirtualNetworkCofnig 2015-06-09 19:38:05 -07:00
Grant Limberg
7cc64c5cb6 Might help to set the enabled field on a VirtualNetworkConfig object :) 2015-06-03 21:29:19 -07:00
Grant Limberg
b84dba3ecb more logging 2015-06-03 21:29:07 -07:00
Grant Limberg
fb0bf52b1b Fixed sending a port number of 0 to ZT1.
Fixed VirtualNetworkConfigFunction (creating array to send to Java)
Fixed the creating InetAddress instead of InetSocketAddress in virtual network config callback
2015-06-01 20:03:28 -07:00
Grant Limberg
74f7d5377d Enable ZT_TRACE and more verbose build output 2015-06-01 20:01:37 -07:00
Grant Limberg
5015c0ae78 more logging 2015-05-28 21:03:37 -07:00
Grant Limberg
b6196a53de Fix DataStoreGetFunction. 2015-05-28 20:37:16 -07:00
Grant Limberg
58ca657da6 Use object arrays rather than ArrayList. JNI side 2015-05-28 20:36:54 -07:00
Grant Limberg
4c680e3126 LOTS more error checking and logging.
Running into a wall attempting to add items to an ArrayList from the JNI side
2015-05-27 20:42:54 -07:00
Grant Limberg
09631ad382 fix datastore get call in JNI
Just delete the local reference rather than do an array delete.  Array delete was causing a crash on loading network config files.  Deleting the local ref works fine, though, as it still lets the JVM garbage collecter know that the native code is done with the array
2015-05-26 21:32:56 -07:00
Grant Limberg
2d67196667 added the android verbose log level and moved most jni debug messages to verbose 2015-05-26 21:31:34 -07:00
Grant Limberg
9755dad7ff add a missing break from a switch 2015-05-26 21:30:33 -07:00
Grant Limberg
1e043a3f66 Remove link desperation from java API 2015-05-21 19:34:19 -07:00
Kees Bos
a425bbc673 Renamed supernode to rootserver 2015-05-06 12:05:20 +02:00
Grant Limberg
742c59a7c7 Refactor package name from com.zerotierone.sdk to com.zerotier.sdk 2015-05-02 16:54:00 -07:00
Grant Limberg
818339f966 replace old direct calls to FindClass, GetMethodID, etc with calls that use the cache 2015-05-02 12:05:40 -07:00
Grant Limberg
079d248eab added a JniCache objectet for caching jclass, jmethodID, and jfieldID objects 2015-05-02 12:05:02 -07:00
Grant Limberg
02b33e3763 Yeah it helps to byte swap the port back to little-endian before sending the port off to Java 2015-04-30 22:07:14 -07:00
Grant Limberg
0a15eae00f Setup native build for Windows Java.
Still need to do Mac & Linux
2015-04-30 21:50:28 -07:00
Grant Limberg
9464504e4a DataStoreGet and Put and EventListener appear to work 2015-04-29 21:20:50 -07:00
Grant Limberg
7e0cc28a89 Fixes for bugs pointed out by updating warnings 2015-04-29 19:29:35 -07:00
Grant Limberg
9bf9670ff9 add more warnings to the JNI build 2015-04-29 19:14:52 -07:00
Grant Limberg
5983b4367b jclass pointers aren't as cacheable as originally thought.
There is a way to do it.  We can try it later if we determine it's needed for performance reasons.  Otherwise, don't use static to cache them
2015-04-27 18:38:13 -07:00
Grant Limberg
d1ed269537 Switch to InetSockAddress instead of InetAddress so we can send the port # to java as well 2015-04-27 17:48:37 -07:00
Grant Limberg
4c71e92a67 It's now possible to actually create a Node object in Java/Android!!! 2015-04-25 20:47:21 -07:00
Grant Limberg
3bdbc6390f Added logging to Android logcat 2015-04-25 20:46:56 -07:00
Grant Limberg
db80070ccb fix strings pointing to enum fields in ResultCode java class 2015-04-25 19:19:58 -07:00
Grant Limberg
56f8160af8 generate javadocs for the Java SDK 2015-04-25 17:29:07 -07:00
Grant Limberg
0d4283a3fa Cache jclass and jmethod instances for callbacks on the JniRef struct.
This is safe to cache as none of the instantiated callback interfaces can be changed once a Node object is created.
2015-04-24 20:34:36 -07:00
Grant Limberg
9c62ce9e6f implemented EventCallback
All callback methods are now implemented
2015-04-24 20:13:21 -07:00
Grant Limberg
f2eed5a65f implemented WirePacketSendFunction 2015-04-24 19:43:17 -07:00
Grant Limberg
5e1fb4e253 Realized that the jclass and jmethodID variables in the callbacks cannot be static
There's no guarantee that ALL calls to the callbacks will be on the same class as they're just interfaces and user defined
2015-04-24 19:35:18 -07:00
Grant Limberg
dc00ce4f44 added DataStorePutFunction implementation
updated  DataStorePutListener to also have an onDelete() method
2015-04-24 19:28:44 -07:00
Grant Limberg
53ebd5a9a5 don't need to pass buffer size because java arrays have a .length member 2015-04-24 19:14:59 -07:00
Grant Limberg
d5fc2b39aa implemented DataStoreGetFunction callback 2015-04-24 19:11:49 -07:00
Grant Limberg
4137246653 implemented VirtualNetworkFrameFunctionCallback 2015-04-24 18:49:52 -07:00
Grant Limberg
28168fa673 implement VirtualNetworkConfigFunctionCallback 2015-04-24 18:39:17 -07:00
Grant Limberg
99af0f3a88 moved creation of VirtualNetworkConfig objects to ZT1_jniutils
added implementation of networks() method
2015-04-24 18:20:10 -07:00
Grant Limberg
6f07a476a6 create and return the peer array 2015-04-24 18:06:26 -07:00
Grant Limberg
52a20b4b0f create PeerRole and PeerPhysicalPath objects 2015-04-24 17:58:59 -07:00
Grant Limberg
6dd3c07b25 removing unneeded jni headers
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 23:09:42 -07:00
Grant Limberg
1df6bc6bc3 just adjusting some alignment
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 23:09:30 -07:00
Grant Limberg
9ab7280703 added infrastructure for Node.peers() and Node.networks() functions
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 23:08:28 -07:00
Grant Limberg
7f6556eba0 node.networkConfig() now creates ArrayLists of multicast subscriptions and assigned addresses
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 22:48:56 -07:00
Grant Limberg
1bea940323 fix field ID signatures
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 22:47:56 -07:00
Grant Limberg
6ff2e6ecfe move findNode method back
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 22:46:54 -07:00
Grant Limberg
d66f2cd54d Node.networkConfig now only needs to populate the lists of assigned addresses and multicast subscriptions and then it's finished
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 21:43:16 -07:00
Grant Limberg
46adf870a1 move utility functions from anon namespace to ZT1_jniutils
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 21:39:07 -07:00
Grant Limberg
4906f8e848 added stub utility functions for creating ArrayLists, appending items to ArrayLists, creating InetAddress objects, and MulticastGroup objects
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 21:36:33 -07:00
Grant Limberg
fa9d42b7e5 finished the JNI implementation of the status() method on Node
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 20:52:47 -07:00
Grant Limberg
667a103a6a added functions to create Event, and VirtualNetworkStatus objects
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-23 19:16:45 -07:00
Grant Limberg
32a35e6808 scaffolding for implementation of status() and networkConfig()
They should be able to be called, but will not return valid objects yet

Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 21:31:17 -07:00
Grant Limberg
34028aa7c8 Added implemenation for node.address()
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 21:30:37 -07:00
Grant Limberg
3ccaef88b7 Added implementation for Node.version()
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 21:29:45 -07:00
Grant Limberg
f5bb57d5aa fix call to networkConfig to pass the network id
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 21:28:42 -07:00
Grant Limberg
a1a35e0279 Can't instantiate enum objects. Fix createResultObject() function so that it still works properly
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 21:14:55 -07:00
Grant Limberg
1308f02b93 multicastSubscribe() and multicastUnsubscribe()
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 20:33:38 -07:00
Grant Limberg
b078d69372 join() and leave() functions
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 20:29:34 -07:00
Grant Limberg
e31e54483c added processBackgroundTasks function
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 20:25:35 -07:00
Grant Limberg
3c499777c8 added implementation for processWirePacket
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 20:21:12 -07:00
Grant Limberg
9c038d3ecd added a few missing function calls in the ZT1 Node API
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 19:36:46 -07:00
Grant Limberg
6187a91f4c delete the ZT1_Node object when calling Java_com_zerotierone_sdk_Node_node_1delete
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 19:29:45 -07:00
Grant Limberg
321b67c73c add a findNode() function to reduce copypasta
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 19:29:13 -07:00
Grant Limberg
5df253fa69 added implementation for processVirtualNetworkFrame
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 19:19:45 -07:00
Grant Limberg
787b4a8e50 * Change a few method signatures from java.lang.Long to long[] so that values can be passed back.
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-22 19:18:49 -07:00
Grant Limberg
bd4049fdc0 Added JNI code for construction/destruction of ZT1_Node objects
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-20 20:33:42 -07:00
Grant Limberg
5f314f209e Updated Java Node class native methods to pass the node ID
This is so that we know which C-based ZT1_Node struct is being operated on

Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-20 20:32:29 -07:00
Grant Limberg
99a1a4e65b Generated header files for JNI
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-20 18:31:42 -07:00
Grant Limberg
f40eb665c5 Add build files for compiling ZeroTier One SDK for Android targets
Signed-off-by: Grant Limberg <glimberg@gmail.com>
2015-04-20 18:26:23 -07:00