diff options
| author | Joseph Henry <[email protected]> | 2016-07-20 14:20:45 -0700 |
|---|---|---|
| committer | Joseph Henry <[email protected]> | 2016-07-20 14:20:45 -0700 |
| commit | 27c26b61b27bdb9068a9b7d331b69462060b22b6 (patch) | |
| tree | a0b6f7901ee53e1347de183506c6cf8bb81ae9f0 /src/SDK_JNI_Java_Wapper.java | |
| parent | d894077b81ed1ddb9185e2c39fffb566e48d2b7a (diff) | |
API usability update, normalized zt_ naming convention0.2.1
Diffstat (limited to 'src/SDK_JNI_Java_Wapper.java')
| -rw-r--r-- | src/SDK_JNI_Java_Wapper.java | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/SDK_JNI_Java_Wapper.java b/src/SDK_JNI_Java_Wapper.java index 7756ca6..d633a7e 100644 --- a/src/SDK_JNI_Java_Wapper.java +++ b/src/SDK_JNI_Java_Wapper.java @@ -24,29 +24,39 @@ * redistribute it in a modified binary form, please contact ZeroTier Networks * LLC. Start here: http://www.zerotier.com/ */ - package ZeroTier; + +import java.net.SocketAddress; + public class SDK { - // Loads JNI code + // Socket families + public int AF_UNIX = 1; + public int AF_INET = 2; + + // Socket types + public int SOCK_STREAM = 1; + public int SOCK_DGRAM = 2; + + // Loads JNI code static { System.loadLibrary("ZeroTierOneJNI"); } - - // ZeroTier service controls - public native void startOneService(String homeDir); - public native void joinNetwork(String nwid); - public native void leaveNetwork(String nwid); - public native boolean isRunning(); + + // ZeroTier service controls + public native void zt_start_service(String homeDir); + public native void zt_join_network(String nwid); + public native void zt_leave_network(String nwid); + public native boolean zt_running(); // Direct-call API - // --- These calls skip the intercept and interface directly via the RPC mechanism --- - public native int ztjniSocket(int family, int type, int protocol); - public native int ztjniConnect(int fd, SocketAddress addr, int addrlen); - public native int ztjniBind(int fd, SocketAddress addr, int addrlen); - public native int ztjniAccept4(int fd, SocketAddress addr, int addrlen); - public native int ztjniAccept(int fd, SocketAddress addr, int addrlen, int flags); - public native int ztjniListen(int fd, int backlog); - //public native int ztjniGetsockopt(int fd, int type, int protocol); - //public native int ztjniSetsockopt(int fd, int type, int protocol); - //public native int ztjniGetsockname(int fd, int type, int protocol); - public native int ztjniClose(int fd); + // --- These calls skip the intercept and interface directly via the RPC mechanism + public native int zt_socket(int family, int type, int protocol); + public native int zt_connect(int fd, String addr, int port); + public native int zt_bind(int fd, String addr, int port); + public native int zt_accept4(int fd, String addr, int port); + public native int zt_accept(int fd, String addr, int port, int flags); + public native int zt_listen(int fd, int backlog); + //public native int zt_getsockopt(int fd, int type, int protocol); + //public native int zt_setsockopt(int fd, int type, int protocol); + //public native int zt_getsockname(int fd, int type, int protocol); + public native int zt_close(int fd); }
\ No newline at end of file |
