Updated ZeroTier.java to match recent API changes

This commit is contained in:
Joseph Henry
2019-02-26 16:39:39 -08:00
parent 9a8dc5c8ea
commit 019e569713

View File

@@ -37,13 +37,25 @@ public class ZeroTier
init();
}
public static int ZTS_ERR_OK = 0; // Everything is ok
public static int ZTS_ERR_INVALID_ARG = -1; // A parameter provided by the user application is invalid (e.g. our of range, NULL, etc)
public static int ZTS_ERR_SERVICE = -2; // The service isn't initialized or is for some other reason currently unavailable
public static int ZTS_ERR_INVALID_OP = -3; // For some reason this API operation is not permitted (perhaps the service is still starting?)
//////////////////////////////////////////////////////////////////////////////
// Control API error codes //
//////////////////////////////////////////////////////////////////////////////
// Everything is ok
public static int ZTS_ERR_OK = 0;
// A argument provided by the user application is invalid (e.g. out of range, NULL, etc)
public static int ZTS_ERR_INVALID_ARG = -1;
// The service isn't initialized or is for some reason currently unavailable. Try again.
public static int ZTS_ERR_SERVICE = -2;
// For some reason this API operation is not permitted or doesn't make sense at this time.
public static int ZTS_ERR_INVALID_OP = -3;
// The call succeeded, but no object or relevant result was available
public static int ZTS_ERR_NO_RESULT = -4;
//////////////////////////////////////////////////////////////////////////////
// Control API event codes //
//////////////////////////////////////////////////////////////////////////////
// Events generated by ZeroTier service or by libzt
// See ext/ZeroTierOne/include/ZeroTierOne.h
public static int EVENT_NONE = -1;
// Node-specific events
public static int EVENT_NODE_UP = 0;
@@ -62,7 +74,8 @@ public class ZeroTier
public static int EVENT_NETWORK_ACCESS_DENIED = 36;
public static int EVENT_NETWORK_READY_IP4 = 37;
public static int EVENT_NETWORK_READY_IP6 = 38;
public static int EVENT_NETWORK_DOWN = 39;
public static int EVENT_NETWORK_READY_IP4_IP6 = 39;
public static int EVENT_NETWORK_DOWN = 40;
// lwIP netif events
public static int EVENT_NETIF_UP_IP4 = 64;
public static int EVENT_NETIF_UP_IP6 = 65;
@@ -149,6 +162,10 @@ public class ZeroTier
public static int TCP_KEEPINTVL = 0x00000004;
public static int TCP_KEEPCNT = 0x00000005;
//////////////////////////////////////////////////////////////////////////////
// ZeroTier Service Controls //
//////////////////////////////////////////////////////////////////////////////
public static native void start(String path, ZeroTierEventListener callbackClass, int port);
public static native void stop();
public static native int join(long nwid);
@@ -157,7 +174,13 @@ public class ZeroTier
public static native int get_num_assigned_addresses(long nwid);
public static native void get_6plane_addr(long nwid, long nodeId, ZeroTierSocketAddress addr);
public static native void get_rfc4193_addr(long nwid, long nodeId, ZeroTierSocketAddress addr);
public static native int get_peer_status(long nodeId);
public static native int get_node_status();
public static native int get_network_status(long networkId);
public static native int get_peer_status(long peerId);
//////////////////////////////////////////////////////////////////////////////
// Socket API //
//////////////////////////////////////////////////////////////////////////////
public static native int socket(int family, int type, int protocol);
public static native int connect(int fd, ZeroTierSocketAddress addr);
@@ -190,5 +213,9 @@ public class ZeroTier
public static native int ioctl(int fd, long request, ZeroTierIoctlArg arg);
public static native int select(int nfds, ZeroTierFileDescriptorSet readfds, ZeroTierFileDescriptorSet writefds, ZeroTierFileDescriptorSet exceptfds, int timeout_sec, int timeout_usec);
//////////////////////////////////////////////////////////////////////////////
// Internal - Do not call //
//////////////////////////////////////////////////////////////////////////////
public static native void init(); // Only to be called by static initializer of this class
}