Modification to blocking bahavior of zts_start, is now settable. Improved address family handling in JNI

This commit is contained in:
Joseph Henry
2017-10-16 16:45:46 -07:00
parent ce22940f57
commit 45260c4e69
13 changed files with 199 additions and 242 deletions

View File

@@ -26,22 +26,12 @@
package zerotier;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.zip.ZipError;
public class ZeroTier {
public static String Version() {
return "1.1.5";
}
// Socket families
// socket families
public static int AF_UNIX = 1;
public static int AF_INET = 2;
// Socket types
// socket types
public static int SOCK_STREAM = 1;
public static int SOCK_DGRAM = 2;
// fcntl flags
@@ -53,23 +43,44 @@ public class ZeroTier {
// fcntl cmds
public static int F_GETFL = 3;
public static int F_SETFL = 4;
public native void start(String homeDir);
// basic service controls
public native void start(String homeDir, boolean blocking);
public native void startjoin(String homeDir, String nwid);
public native void stop();
public native boolean running();
public native void join(String nwid);
public native void leave(String nwid);
// advanced service controls
public native void get_path();
public native int get_id();
public native void get_6plane_addr();
public native void get_rfc4193_addr();
// socket API
public native int socket(int family, int type, int protocol);
public native int connect(int fd, String addr, int port);
public native int bind(int fd, String addr, int port);
public native int accept4(int fd, String addr, int port);
public native int accept(int fd, Address addr);
public native int listen(int fd, int backlog);
public native int accept(int fd, Address addr);
public native int accept4(int fd, String addr, int port);
public native int close(int fd);
//public native int setsockopt();
//public native int getsockopt();
public native int read(int fd, byte[] buf, int len);
public native int write(int fd, byte[] buf, int len);
public native int sendto(int fd, byte[] buf, int len, int flags, Address addr);
public native int send(int fd, byte[] buf, int len, int flags);
public native int recvfrom(int fd, byte[] buf, int len, int flags, Address addr);
public native int shutdown(int fd, int how);
//public native int getsockname();
//public native int getpeername();
//public native int gethostname();
///public native int sethostname();
//public native int gethostbyname();
//public native int poll();
//public native int select();
public native int fcntl(int sock, int cmd, int flag);
//public native int ioctl(int fd, long request, ? );
// stack controls
public native int add_dns();
public native int del_dns();
}