Package com.zerotier.sockets
Class ZeroTierNative
java.lang.Object
com.zerotier.sockets.ZeroTierNative
public class ZeroTierNative
extends java.lang.Object
Class that exposes the low-level C socket interface provided by libzt. This
can be used instead of the higher-level ZeroTierSocket API.
-
Field Summary
Fields Modifier and Type Field Description static intZTS_AF_INETIPv4 address familystatic intZTS_AF_INET6IPv6 address familystatic intZTS_EACCESPermission deniedstatic intZTS_EADDRINUSEAddress already in usestatic intZTS_EADDRNOTAVAILCannot assign requested addressstatic intZTS_EAFNOSUPPORTAddress family not supported by protocolstatic intZTS_EAGAINTry againstatic intZTS_EALREADYOperation already in progressstatic intZTS_EBADFBad file numberstatic intZTS_EBUSYDevice or resource busystatic intZTS_ECONNABORTEDSoftware caused connection abortstatic intZTS_ECONNRESETConnection reset by peerstatic intZTS_EDESTADDRREQDestination address requiredstatic intZTS_EEXISTFile existsstatic intZTS_EFAULTBad addressstatic intZTS_EHOSTUNREACHNo route to hoststatic intZTS_EINPROGRESSOperation now in progressstatic intZTS_EINTRInterrupted system callstatic intZTS_EINVALInvalid argumentstatic intZTS_EIOI/O errorstatic intZTS_EISCONNTransport endpoint is already connectedstatic intZTS_EMFILEToo many open filesstatic intZTS_EMSGSIZEMessage too longstatic intZTS_ENETDOWNNetwork is downstatic intZTS_ENETUNREACHNetwork is unreachablestatic intZTS_ENFILEFile table overflowstatic intZTS_ENOBUFSNo buffer space availablestatic intZTS_ENODEVNo such devicestatic intZTS_ENOENTNo such file or directorystatic intZTS_ENOMEMOut of memorystatic intZTS_ENOPROTOOPTProtocol not availablestatic intZTS_ENOSYSFunction not implementedstatic intZTS_ENOTCONNTransport endpoint is not connectedstatic intZTS_ENOTSOCKSocket operation on non-socketstatic intZTS_ENXIONo such device or addressstatic intZTS_EOPNOTSUPPOperation not supported on transport endpointstatic intZTS_EPERMOperation not permitted (`zts_errno` value)static intZTS_EPFNOSUPPORTProtocol family not supportedstatic intZTS_EPROTONOSUPPORTProtocol not supportedstatic intZTS_EPROTOTYPEProtocol wrong type for socketstatic intZTS_ERR_ARG(-3) Invalid argumentstatic intZTS_ERR_GENERAL(-5) Consider filing a bug reportstatic intZTS_ERR_OK(0) No errorstatic intZTS_ERR_RESULT(-4) No result (not necessarily an error)static intZTS_ERR_SERVICE(-2) You probably did something at the wrong timestatic intZTS_ERR_SOCKET(-1) Socket error, see zts_errnostatic intZTS_ESOCKTNOSUPPORTSocket type not supportedstatic intZTS_ESRCHNo such processstatic intZTS_ETIMEDOUTConnection timed outstatic intZTS_EVENT_ADDR_ADDED_IP4A new managed IPv4 address was assigned to this peerstatic intZTS_EVENT_ADDR_ADDED_IP6A new managed IPv4 address was assigned to this peerstatic intZTS_EVENT_ADDR_REMOVED_IP4A managed IPv4 address assignment was removed from this peerstatic intZTS_EVENT_ADDR_REMOVED_IP6A managed IPv6 address assignment was removed from this peerstatic intZTS_EVENT_NETIF_DOWNlwIP netif down (for debug purposes)static intZTS_EVENT_NETIF_LINK_DOWNlwIP netif link down (for debug purposes)static intZTS_EVENT_NETIF_LINK_UPlwIP netif link up (for debug purposes)static intZTS_EVENT_NETIF_REMOVEDlwIP netif removed (for debug purposes)static intZTS_EVENT_NETIF_UPlwIP netif up (for debug purposes)static intZTS_EVENT_NETWORK_ACCESS_DENIEDThe node is not allowed to join the network (you must authorize node)static intZTS_EVENT_NETWORK_CLIENT_TOO_OLDThe version of ZeroTier inside libzt is too oldstatic intZTS_EVENT_NETWORK_DOWNNetwork controller is unreachablestatic intZTS_EVENT_NETWORK_NOT_FOUNDNetwork ID does not correspond to a known networkstatic intZTS_EVENT_NETWORK_OKThe node joined the network successfully (no action needed)static intZTS_EVENT_NETWORK_READY_IP4The node has received an IPv4 address from the network controllerstatic intZTS_EVENT_NETWORK_READY_IP4_IP6Deprecatedstatic intZTS_EVENT_NETWORK_READY_IP6The node has received an IPv6 address from the network controllerstatic intZTS_EVENT_NETWORK_REQ_CONFIGThe configuration for a network has been requested (no action needed)static intZTS_EVENT_NETWORK_UPDATENetwork change received from controllerstatic intZTS_EVENT_NODE_DOWNNode is shutting down This is generated within Node's destructor when it is being shut down.static intZTS_EVENT_NODE_FATAL_ERRORA fatal error has occurred.static intZTS_EVENT_NODE_OFFLINENode is offline -- network does not seem to be reachable by any available strategystatic intZTS_EVENT_NODE_ONLINENode is online -- at least one upstream node appears reachablestatic intZTS_EVENT_NODE_UPNode has been initialized This is the first event generated; and is always sent.static intZTS_EVENT_PEER_DIRECTA direct P2P path to peer is knownstatic intZTS_EVENT_PEER_PATH_DEADA known path to a peer is now considered deadstatic intZTS_EVENT_PEER_PATH_DISCOVEREDA new path to a peer was discoveredstatic intZTS_EVENT_PEER_RELAYA direct P2P path to peer is NOT known.static intZTS_EVENT_PEER_UNREACHABLEA peer is unreachable.static intZTS_EVENT_ROUTE_ADDEDA new managed network route was addedstatic intZTS_EVENT_ROUTE_REMOVEDA managed network route was removedstatic intZTS_EVENT_STACK_DOWNTCP/IP stack (lwIP) id down (for debug purposes)static intZTS_EVENT_STACK_UPTCP/IP stack (lwIP) is up (for debug purposes)static intZTS_EVENT_STORE_IDENTITY_PUBLICThe node's public key (identity)static intZTS_EVENT_STORE_IDENTITY_SECRETThe node's secret key (identity)static intZTS_EVENT_STORE_NETWORKNew network configstatic intZTS_EVENT_STORE_PEERNew reachability hints and peer configurationstatic intZTS_EVENT_STORE_PLANETThe node has received an updated planet configstatic intZTS_EWOULDBLOCKOperation would blockstatic intZTS_F_GETFLstatic intZTS_F_SETFLstatic intZTS_FIONBIOstatic intZTS_FIONREADstatic intZTS_ID_STR_BUF_LENThe length of a human-friendly identity key pair stringstatic intZTS_INET_ADDRSTRLENMax length of human-readable IPv4 stringstatic intZTS_INET6_ADDRSTRLENMax length of human-readable IPv6 stringstatic intZTS_IP_MAX_STR_LENMaximum (and required) length of string buffers used to receive string-format IP addresses from the API.static intZTS_IP_TOSstatic intZTS_IP_TTLstatic intZTS_IPPROTO_ICMPstatic intZTS_IPPROTO_ICMPV6static intZTS_IPPROTO_IPstatic intZTS_IPPROTO_IPV6static intZTS_IPPROTO_RAWstatic intZTS_IPPROTO_TCPstatic intZTS_IPPROTO_UDPstatic intZTS_IPPROTO_UDPLITEstatic intZTS_MAC_ADDRSTRLENLength of human-readable MAC address stringstatic intZTS_MAX_ASSIGNED_ADDRESSESMaximum number of statically assigned IP addresses per network endpoint using ZT address management (not DHCP)static intZTS_MAX_MULTICAST_SUBSCRIPTIONSMaximum number of multicast groups a device / network interface can be subscribed to at oncestatic intZTS_MAX_NETWORK_ROUTESMaximum number of pushed routes on a networkstatic intZTS_MAX_NETWORK_SHORT_NAME_LENGTHMaximum length of network short namestatic intZTS_MAX_PEER_NETWORK_PATHSMaximum number of direct network paths to a given peerstatic intZTS_MSG_DONTWAITstatic intZTS_MSG_MOREstatic intZTS_MSG_OOBstatic intZTS_MSG_PEEKstatic intZTS_MSG_WAITALLstatic intZTS_O_NDELAYstatic intZTS_O_NONBLOCKstatic intZTS_PF_INETstatic intZTS_PF_INET6static intZTS_SHUT_RDstatic intZTS_SHUT_RDWRstatic intZTS_SHUT_WRstatic intZTS_SO_ACCEPTCONNstatic intZTS_SO_BROADCASTstatic intZTS_SO_CONTIMEOstatic intZTS_SO_DEBUGstatic intZTS_SO_DONTLINGERstatic intZTS_SO_DONTROUTEstatic intZTS_SO_ERRORstatic intZTS_SO_KEEPALIVEstatic intZTS_SO_LINGERstatic intZTS_SO_NO_CHECKstatic intZTS_SO_OOBINLINEstatic intZTS_SO_RCVBUFstatic intZTS_SO_RCVLOWATstatic intZTS_SO_RCVTIMEOstatic intZTS_SO_REUSEADDRstatic intZTS_SO_REUSEPORTstatic intZTS_SO_SNDBUFstatic intZTS_SO_SNDLOWATstatic intZTS_SO_SNDTIMEOstatic intZTS_SO_TYPEstatic intZTS_SO_USELOOPBACKstatic intZTS_SOCK_DGRAMDatagram socketstatic intZTS_SOCK_RAWstatic intZTS_SOCK_STREAMStream socketstatic intZTS_SOL_SOCKETstatic intZTS_STORE_DATA_LENRequired buffer length to safely receive data store itemsstatic intZTS_TCP_KEEPALIVEstatic intZTS_TCP_KEEPCNTstatic intZTS_TCP_KEEPIDLEstatic intZTS_TCP_KEEPINTVLstatic intZTS_TCP_NODELAY -
Constructor Summary
Constructors Constructor Description ZeroTierNative() -
Method Summary
Modifier and Type Method Description static intzts_addr_compute_6plane_str(long net_id, long node_id, java.lang.String dst, int len)static intzts_addr_compute_rfc4193_str(long net_id, long node_id, java.lang.String dst, int len)static java.lang.Stringzts_addr_get_str(long net_id, int family)static intzts_addr_is_assigned(long net_id, int family)static intzts_bind(int fd, java.lang.String ipstr, int port)static intzts_bsd_accept(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr)static intzts_bsd_close(int fd)static intzts_bsd_fcntl(int sock, int cmd, int flag)static intzts_bsd_getpeername(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr)static booleanzts_bsd_getsockname(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr)static intzts_bsd_listen(int fd, int backlog)static intzts_bsd_read(int fd, byte[] buf)static intzts_bsd_read_length(int fd, byte[] buf, int len)static intzts_bsd_read_offset(int fd, byte[] buf, int offset, int len)static intzts_bsd_recv(int fd, byte[] buf, int flags)static intzts_bsd_recvfrom(int fd, byte[] buf, int flags, com.zerotier.sockets.ZeroTierSocketAddress addr)static intzts_bsd_select(int nfds, com.zerotier.sockets.ZeroTierFileDescriptorSet readfds, com.zerotier.sockets.ZeroTierFileDescriptorSet writefds, com.zerotier.sockets.ZeroTierFileDescriptorSet exceptfds, int timeout_sec, int timeout_usec)static intzts_bsd_send(int fd, byte[] buf, int flags)static intzts_bsd_sendto(int fd, byte[] buf, int flags, com.zerotier.sockets.ZeroTierSocketAddress addr)static intzts_bsd_shutdown(int fd, int how)static intzts_bsd_socket(int family, int type, int protocol)static intzts_bsd_write(int fd, byte[] buf)static intzts_bsd_write_byte(int fd, byte b)static intzts_bsd_write_offset(int fd, byte[] buf, int offset, int len)static intzts_connect(int fd, java.lang.String ipstr, int port, int timeout_ms)static intzts_core_lock_obtain()static intzts_core_lock_release()static intzts_core_query_addr(long net_id, int idx, java.lang.String addr, int len)static intzts_core_query_addr_count(long net_id)static intzts_core_query_mc_count(long net_id)static intzts_core_query_path(long peer_id, int idx, java.lang.String dst, int len)static intzts_core_query_path_count(long peer_id)static intzts_core_query_route_count(long net_id)static intzts_get_blocking(int fd)static intzts_get_keepalive(int fd)static intzts_get_linger_enabled(int fd)static intzts_get_linger_value(int fd)static intzts_get_no_delay(int fd)static intzts_get_pending_data_size(int fd)static intzts_get_recv_buf_size(int fd)static intzts_get_recv_timeout(int fd)static intzts_get_reuse_addr(int fd)static intzts_get_send_buf_size(int fd)static intzts_get_send_timeout(int fd)static intzts_get_ttl(int fd)static intzts_init()static intzts_init_allow_id_cache(int allowed)static intzts_init_allow_net_cache(int allowed)static intzts_init_allow_peer_cache(int allowed)static intzts_init_allow_roots_cache(int allowed)static intzts_init_blacklist_if(java.lang.String prefix, int len)static intzts_init_from_storage(java.lang.String path)static intzts_init_set_event_handler(ZeroTierEventListener callbackClass)static intzts_init_set_port(short port)static intzts_moon_deorbit(long moon_roots_id)static intzts_moon_orbit(long moon_roots_id, long moon_seed)static longzts_net_compute_adhoc_id(short start_port, short end_port)static intzts_net_get_broadcast(long net_id)static longzts_net_get_mac(long net_id)static java.lang.Stringzts_net_get_mac_str(long net_id)static intzts_net_get_mtu(long net_id)static intzts_net_get_name(long net_id, java.lang.String dst, int len)static intzts_net_get_status(long net_id)static intzts_net_get_type(long net_id)static intzts_net_join(long net_id)static intzts_net_leave(long net_id)static intzts_net_transport_is_ready(long net_id)static intzts_node_free()static longzts_node_get_id()static intzts_node_get_port()static intzts_node_is_online()static intzts_node_start()static intzts_node_stop()static intzts_route_is_assigned(long net_id, int family)static intzts_set_blocking(int fd, int enabled)static intzts_set_keepalive(int fd, int enabled)static intzts_set_linger(int fd, int enabled, int value)static intzts_set_no_delay(int fd, int enabled)static intzts_set_recv_buf_size(int fd, int size)static intzts_set_recv_timeout(int fd, int seconds, int microseconds)static intzts_set_reuse_addr(int fd, int enabled)static intzts_set_send_buf_size(int fd, int size)static intzts_set_send_timeout(int fd, int seconds, int microseconds)static intzts_set_ttl(int fd, int ttl)static voidzts_util_delay(long milliseconds)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ZTS_EVENT_NODE_UP
public static int ZTS_EVENT_NODE_UPNode has been initialized This is the first event generated; and is always sent. It may occur before node's constructor returns. -
ZTS_EVENT_NODE_ONLINE
public static int ZTS_EVENT_NODE_ONLINENode is online -- at least one upstream node appears reachable -
ZTS_EVENT_NODE_OFFLINE
public static int ZTS_EVENT_NODE_OFFLINENode is offline -- network does not seem to be reachable by any available strategy -
ZTS_EVENT_NODE_DOWN
public static int ZTS_EVENT_NODE_DOWNNode is shutting down This is generated within Node's destructor when it is being shut down. It's done for convenience; since cleaning up other state in the event handler may appear more idiomatic. -
ZTS_EVENT_NODE_FATAL_ERROR
public static int ZTS_EVENT_NODE_FATAL_ERRORA fatal error has occurred. One possible reason is: Your identity has collided with another node's ZeroTier address This happens if two different public keys both hash (via the algorithm in Identity::generate()) to the same 40-bit ZeroTier address. This is something you should "never" see; where "never" is defined as once per 2^39 new node initializations / identity creations. If you do see it; you're going to see it very soon after a node is first initialized. This is reported as an event rather than a return code since it's detected asynchronously via error messages from authoritative nodes. If this occurs; you must shut down and delete the node; delete the identity.secret record/file from the data store; and restart to generate a new identity. If you don't do this; you will not be able to communicate with other nodes. We'd automate this process; but we don't think silently deleting private keys or changing our address without telling the calling code is good form. It violates the principle of least surprise. You can technically get away with not handling this; but we recommend doing so in a mature reliable application. Besides; handling this condition is a good way to make sure it never arises. It's like how umbrellas prevent rain and smoke detectors prevent fires. They do; right? Meta-data: none -
ZTS_EVENT_NETWORK_NOT_FOUND
public static int ZTS_EVENT_NETWORK_NOT_FOUNDNetwork ID does not correspond to a known network -
ZTS_EVENT_NETWORK_CLIENT_TOO_OLD
public static int ZTS_EVENT_NETWORK_CLIENT_TOO_OLDThe version of ZeroTier inside libzt is too old -
ZTS_EVENT_NETWORK_REQ_CONFIG
public static int ZTS_EVENT_NETWORK_REQ_CONFIGThe configuration for a network has been requested (no action needed) -
ZTS_EVENT_NETWORK_OK
public static int ZTS_EVENT_NETWORK_OKThe node joined the network successfully (no action needed) -
ZTS_EVENT_NETWORK_ACCESS_DENIED
public static int ZTS_EVENT_NETWORK_ACCESS_DENIEDThe node is not allowed to join the network (you must authorize node) -
ZTS_EVENT_NETWORK_READY_IP4
public static int ZTS_EVENT_NETWORK_READY_IP4The node has received an IPv4 address from the network controller -
ZTS_EVENT_NETWORK_READY_IP6
public static int ZTS_EVENT_NETWORK_READY_IP6The node has received an IPv6 address from the network controller -
ZTS_EVENT_NETWORK_READY_IP4_IP6
public static int ZTS_EVENT_NETWORK_READY_IP4_IP6Deprecated -
ZTS_EVENT_NETWORK_DOWN
public static int ZTS_EVENT_NETWORK_DOWNNetwork controller is unreachable -
ZTS_EVENT_NETWORK_UPDATE
public static int ZTS_EVENT_NETWORK_UPDATENetwork change received from controller -
ZTS_EVENT_STACK_UP
public static int ZTS_EVENT_STACK_UPTCP/IP stack (lwIP) is up (for debug purposes) -
ZTS_EVENT_STACK_DOWN
public static int ZTS_EVENT_STACK_DOWNTCP/IP stack (lwIP) id down (for debug purposes) -
ZTS_EVENT_NETIF_UP
public static int ZTS_EVENT_NETIF_UPlwIP netif up (for debug purposes) -
ZTS_EVENT_NETIF_DOWN
public static int ZTS_EVENT_NETIF_DOWNlwIP netif down (for debug purposes) -
ZTS_EVENT_NETIF_REMOVED
public static int ZTS_EVENT_NETIF_REMOVEDlwIP netif removed (for debug purposes) -
ZTS_EVENT_NETIF_LINK_UP
public static int ZTS_EVENT_NETIF_LINK_UPlwIP netif link up (for debug purposes) -
ZTS_EVENT_NETIF_LINK_DOWN
public static int ZTS_EVENT_NETIF_LINK_DOWNlwIP netif link down (for debug purposes) -
ZTS_EVENT_PEER_DIRECT
public static int ZTS_EVENT_PEER_DIRECTA direct P2P path to peer is known -
ZTS_EVENT_PEER_RELAY
public static int ZTS_EVENT_PEER_RELAYA direct P2P path to peer is NOT known. Traffic is now relayed -
ZTS_EVENT_PEER_UNREACHABLE
public static int ZTS_EVENT_PEER_UNREACHABLEA peer is unreachable. Check NAT/Firewall settings -
ZTS_EVENT_PEER_PATH_DISCOVERED
public static int ZTS_EVENT_PEER_PATH_DISCOVEREDA new path to a peer was discovered -
ZTS_EVENT_PEER_PATH_DEAD
public static int ZTS_EVENT_PEER_PATH_DEADA known path to a peer is now considered dead -
ZTS_EVENT_ROUTE_ADDED
public static int ZTS_EVENT_ROUTE_ADDEDA new managed network route was added -
ZTS_EVENT_ROUTE_REMOVED
public static int ZTS_EVENT_ROUTE_REMOVEDA managed network route was removed -
ZTS_EVENT_ADDR_ADDED_IP4
public static int ZTS_EVENT_ADDR_ADDED_IP4A new managed IPv4 address was assigned to this peer -
ZTS_EVENT_ADDR_REMOVED_IP4
public static int ZTS_EVENT_ADDR_REMOVED_IP4A managed IPv4 address assignment was removed from this peer -
ZTS_EVENT_ADDR_ADDED_IP6
public static int ZTS_EVENT_ADDR_ADDED_IP6A new managed IPv4 address was assigned to this peer -
ZTS_EVENT_ADDR_REMOVED_IP6
public static int ZTS_EVENT_ADDR_REMOVED_IP6A managed IPv6 address assignment was removed from this peer -
ZTS_EVENT_STORE_IDENTITY_SECRET
public static int ZTS_EVENT_STORE_IDENTITY_SECRETThe node's secret key (identity) -
ZTS_EVENT_STORE_IDENTITY_PUBLIC
public static int ZTS_EVENT_STORE_IDENTITY_PUBLICThe node's public key (identity) -
ZTS_EVENT_STORE_PLANET
public static int ZTS_EVENT_STORE_PLANETThe node has received an updated planet config -
ZTS_EVENT_STORE_PEER
public static int ZTS_EVENT_STORE_PEERNew reachability hints and peer configuration -
ZTS_EVENT_STORE_NETWORK
public static int ZTS_EVENT_STORE_NETWORKNew network config -
ZTS_SOCK_STREAM
public static int ZTS_SOCK_STREAMStream socket -
ZTS_SOCK_DGRAM
public static int ZTS_SOCK_DGRAMDatagram socket -
ZTS_SOCK_RAW
public static int ZTS_SOCK_RAW -
ZTS_AF_INET
public static int ZTS_AF_INETIPv4 address family -
ZTS_AF_INET6
public static int ZTS_AF_INET6IPv6 address family -
ZTS_PF_INET
public static int ZTS_PF_INET -
ZTS_PF_INET6
public static int ZTS_PF_INET6 -
ZTS_IPPROTO_IP
public static int ZTS_IPPROTO_IP -
ZTS_IPPROTO_ICMP
public static int ZTS_IPPROTO_ICMP -
ZTS_IPPROTO_TCP
public static int ZTS_IPPROTO_TCP -
ZTS_IPPROTO_UDP
public static int ZTS_IPPROTO_UDP -
ZTS_IPPROTO_IPV6
public static int ZTS_IPPROTO_IPV6 -
ZTS_IPPROTO_ICMPV6
public static int ZTS_IPPROTO_ICMPV6 -
ZTS_IPPROTO_UDPLITE
public static int ZTS_IPPROTO_UDPLITE -
ZTS_IPPROTO_RAW
public static int ZTS_IPPROTO_RAW -
ZTS_MSG_PEEK
public static int ZTS_MSG_PEEK -
ZTS_MSG_WAITALL
public static int ZTS_MSG_WAITALL -
ZTS_MSG_OOB
public static int ZTS_MSG_OOB -
ZTS_MSG_DONTWAIT
public static int ZTS_MSG_DONTWAIT -
ZTS_MSG_MORE
public static int ZTS_MSG_MORE -
ZTS_F_GETFL
public static int ZTS_F_GETFL -
ZTS_F_SETFL
public static int ZTS_F_SETFL -
ZTS_O_NONBLOCK
public static int ZTS_O_NONBLOCK -
ZTS_O_NDELAY
public static int ZTS_O_NDELAY -
ZTS_SHUT_RD
public static int ZTS_SHUT_RD -
ZTS_SHUT_WR
public static int ZTS_SHUT_WR -
ZTS_SHUT_RDWR
public static int ZTS_SHUT_RDWR -
ZTS_FIONREAD
public static int ZTS_FIONREAD -
ZTS_FIONBIO
public static int ZTS_FIONBIO -
ZTS_SOL_SOCKET
public static int ZTS_SOL_SOCKET -
ZTS_SO_REUSEADDR
public static int ZTS_SO_REUSEADDR -
ZTS_SO_KEEPALIVE
public static int ZTS_SO_KEEPALIVE -
ZTS_SO_BROADCAST
public static int ZTS_SO_BROADCAST -
ZTS_SO_DEBUG
public static int ZTS_SO_DEBUG -
ZTS_SO_ACCEPTCONN
public static int ZTS_SO_ACCEPTCONN -
ZTS_SO_DONTROUTE
public static int ZTS_SO_DONTROUTE -
ZTS_SO_USELOOPBACK
public static int ZTS_SO_USELOOPBACK -
ZTS_SO_LINGER
public static int ZTS_SO_LINGER -
ZTS_SO_DONTLINGER
public static int ZTS_SO_DONTLINGER -
ZTS_SO_OOBINLINE
public static int ZTS_SO_OOBINLINE -
ZTS_SO_REUSEPORT
public static int ZTS_SO_REUSEPORT -
ZTS_SO_SNDBUF
public static int ZTS_SO_SNDBUF -
ZTS_SO_RCVBUF
public static int ZTS_SO_RCVBUF -
ZTS_SO_SNDLOWAT
public static int ZTS_SO_SNDLOWAT -
ZTS_SO_RCVLOWAT
public static int ZTS_SO_RCVLOWAT -
ZTS_SO_SNDTIMEO
public static int ZTS_SO_SNDTIMEO -
ZTS_SO_RCVTIMEO
public static int ZTS_SO_RCVTIMEO -
ZTS_SO_ERROR
public static int ZTS_SO_ERROR -
ZTS_SO_TYPE
public static int ZTS_SO_TYPE -
ZTS_SO_CONTIMEO
public static int ZTS_SO_CONTIMEO -
ZTS_SO_NO_CHECK
public static int ZTS_SO_NO_CHECK -
ZTS_IP_TOS
public static int ZTS_IP_TOS -
ZTS_IP_TTL
public static int ZTS_IP_TTL -
ZTS_TCP_NODELAY
public static int ZTS_TCP_NODELAY -
ZTS_TCP_KEEPALIVE
public static int ZTS_TCP_KEEPALIVE -
ZTS_TCP_KEEPIDLE
public static int ZTS_TCP_KEEPIDLE -
ZTS_TCP_KEEPINTVL
public static int ZTS_TCP_KEEPINTVL -
ZTS_TCP_KEEPCNT
public static int ZTS_TCP_KEEPCNT -
ZTS_ERR_OK
public static int ZTS_ERR_OK(0) No error -
ZTS_ERR_SOCKET
public static int ZTS_ERR_SOCKET(-1) Socket error, see zts_errno -
ZTS_ERR_SERVICE
public static int ZTS_ERR_SERVICE(-2) You probably did something at the wrong time -
ZTS_ERR_ARG
public static int ZTS_ERR_ARG(-3) Invalid argument -
ZTS_ERR_RESULT
public static int ZTS_ERR_RESULT(-4) No result (not necessarily an error) -
ZTS_ERR_GENERAL
public static int ZTS_ERR_GENERAL(-5) Consider filing a bug report -
ZTS_EPERM
public static int ZTS_EPERMOperation not permitted (`zts_errno` value) -
ZTS_ENOENT
public static int ZTS_ENOENTNo such file or directory -
ZTS_ESRCH
public static int ZTS_ESRCHNo such process -
ZTS_EINTR
public static int ZTS_EINTRInterrupted system call -
ZTS_EIO
public static int ZTS_EIOI/O error -
ZTS_ENXIO
public static int ZTS_ENXIONo such device or address -
ZTS_EBADF
public static int ZTS_EBADFBad file number -
ZTS_EAGAIN
public static int ZTS_EAGAINTry again -
ZTS_EWOULDBLOCK
public static int ZTS_EWOULDBLOCKOperation would block -
ZTS_ENOMEM
public static int ZTS_ENOMEMOut of memory -
ZTS_EACCES
public static int ZTS_EACCESPermission denied -
ZTS_EFAULT
public static int ZTS_EFAULTBad address -
ZTS_EBUSY
public static int ZTS_EBUSYDevice or resource busy -
ZTS_EEXIST
public static int ZTS_EEXISTFile exists -
ZTS_ENODEV
public static int ZTS_ENODEVNo such device -
ZTS_EINVAL
public static int ZTS_EINVALInvalid argument -
ZTS_ENFILE
public static int ZTS_ENFILEFile table overflow -
ZTS_EMFILE
public static int ZTS_EMFILEToo many open files -
ZTS_ENOSYS
public static int ZTS_ENOSYSFunction not implemented -
ZTS_ENOTSOCK
public static int ZTS_ENOTSOCKSocket operation on non-socket -
ZTS_EDESTADDRREQ
public static int ZTS_EDESTADDRREQDestination address required -
ZTS_EMSGSIZE
public static int ZTS_EMSGSIZEMessage too long -
ZTS_EPROTOTYPE
public static int ZTS_EPROTOTYPEProtocol wrong type for socket -
ZTS_ENOPROTOOPT
public static int ZTS_ENOPROTOOPTProtocol not available -
ZTS_EPROTONOSUPPORT
public static int ZTS_EPROTONOSUPPORTProtocol not supported -
ZTS_ESOCKTNOSUPPORT
public static int ZTS_ESOCKTNOSUPPORTSocket type not supported -
ZTS_EOPNOTSUPP
public static int ZTS_EOPNOTSUPPOperation not supported on transport endpoint -
ZTS_EPFNOSUPPORT
public static int ZTS_EPFNOSUPPORTProtocol family not supported -
ZTS_EAFNOSUPPORT
public static int ZTS_EAFNOSUPPORTAddress family not supported by protocol -
ZTS_EADDRINUSE
public static int ZTS_EADDRINUSEAddress already in use -
ZTS_EADDRNOTAVAIL
public static int ZTS_EADDRNOTAVAILCannot assign requested address -
ZTS_ENETDOWN
public static int ZTS_ENETDOWNNetwork is down -
ZTS_ENETUNREACH
public static int ZTS_ENETUNREACHNetwork is unreachable -
ZTS_ECONNABORTED
public static int ZTS_ECONNABORTEDSoftware caused connection abort -
ZTS_ECONNRESET
public static int ZTS_ECONNRESETConnection reset by peer -
ZTS_ENOBUFS
public static int ZTS_ENOBUFSNo buffer space available -
ZTS_EISCONN
public static int ZTS_EISCONNTransport endpoint is already connected -
ZTS_ENOTCONN
public static int ZTS_ENOTCONNTransport endpoint is not connected -
ZTS_ETIMEDOUT
public static int ZTS_ETIMEDOUTConnection timed out -
ZTS_EHOSTUNREACH
public static int ZTS_EHOSTUNREACHNo route to host -
ZTS_EALREADY
public static int ZTS_EALREADYOperation already in progress -
ZTS_EINPROGRESS
public static int ZTS_EINPROGRESSOperation now in progress -
ZTS_MAC_ADDRSTRLEN
public static int ZTS_MAC_ADDRSTRLENLength of human-readable MAC address string -
ZTS_INET_ADDRSTRLEN
public static int ZTS_INET_ADDRSTRLENMax length of human-readable IPv4 string -
ZTS_INET6_ADDRSTRLEN
public static int ZTS_INET6_ADDRSTRLENMax length of human-readable IPv6 string -
ZTS_IP_MAX_STR_LEN
public static int ZTS_IP_MAX_STR_LENMaximum (and required) length of string buffers used to receive string-format IP addresses from the API. This is set to `ZTS_INET6_ADDRSTRLEN` to handle all cases: `ZTS_AF_INET` and `ZTS_AF_INET6` -
ZTS_STORE_DATA_LEN
public static int ZTS_STORE_DATA_LENRequired buffer length to safely receive data store items -
ZTS_MAX_NETWORK_SHORT_NAME_LENGTH
public static int ZTS_MAX_NETWORK_SHORT_NAME_LENGTHMaximum length of network short name -
ZTS_MAX_NETWORK_ROUTES
public static int ZTS_MAX_NETWORK_ROUTESMaximum number of pushed routes on a network -
ZTS_MAX_ASSIGNED_ADDRESSES
public static int ZTS_MAX_ASSIGNED_ADDRESSESMaximum number of statically assigned IP addresses per network endpoint using ZT address management (not DHCP) -
ZTS_MAX_PEER_NETWORK_PATHS
public static int ZTS_MAX_PEER_NETWORK_PATHSMaximum number of direct network paths to a given peer -
ZTS_MAX_MULTICAST_SUBSCRIPTIONS
public static int ZTS_MAX_MULTICAST_SUBSCRIPTIONSMaximum number of multicast groups a device / network interface can be subscribed to at once -
ZTS_ID_STR_BUF_LEN
public static int ZTS_ID_STR_BUF_LENThe length of a human-friendly identity key pair string
-
-
Constructor Details
-
ZeroTierNative
public ZeroTierNative()
-
-
Method Details
-
zts_init
public static int zts_init() -
zts_init_from_storage
public static int zts_init_from_storage(java.lang.String path) -
zts_init_set_event_handler
-
zts_init_set_port
public static int zts_init_set_port(short port) -
zts_init_blacklist_if
public static int zts_init_blacklist_if(java.lang.String prefix, int len) -
zts_init_allow_net_cache
public static int zts_init_allow_net_cache(int allowed) -
zts_init_allow_peer_cache
public static int zts_init_allow_peer_cache(int allowed) -
zts_init_allow_roots_cache
public static int zts_init_allow_roots_cache(int allowed) -
zts_init_allow_id_cache
public static int zts_init_allow_id_cache(int allowed) -
zts_addr_is_assigned
public static int zts_addr_is_assigned(long net_id, int family) -
zts_addr_get_str
public static java.lang.String zts_addr_get_str(long net_id, int family) -
zts_addr_compute_rfc4193_str
public static int zts_addr_compute_rfc4193_str(long net_id, long node_id, java.lang.String dst, int len) -
zts_addr_compute_6plane_str
public static int zts_addr_compute_6plane_str(long net_id, long node_id, java.lang.String dst, int len) -
zts_net_compute_adhoc_id
public static long zts_net_compute_adhoc_id(short start_port, short end_port) -
zts_net_join
public static int zts_net_join(long net_id) -
zts_net_leave
public static int zts_net_leave(long net_id) -
zts_net_transport_is_ready
public static int zts_net_transport_is_ready(long net_id) -
zts_net_get_mac
public static long zts_net_get_mac(long net_id) -
zts_net_get_mac_str
public static java.lang.String zts_net_get_mac_str(long net_id) -
zts_net_get_broadcast
public static int zts_net_get_broadcast(long net_id) -
zts_net_get_mtu
public static int zts_net_get_mtu(long net_id) -
zts_net_get_name
public static int zts_net_get_name(long net_id, java.lang.String dst, int len) -
zts_net_get_status
public static int zts_net_get_status(long net_id) -
zts_net_get_type
public static int zts_net_get_type(long net_id) -
zts_route_is_assigned
public static int zts_route_is_assigned(long net_id, int family) -
zts_node_start
public static int zts_node_start() -
zts_node_is_online
public static int zts_node_is_online() -
zts_node_get_id
public static long zts_node_get_id() -
zts_node_get_port
public static int zts_node_get_port() -
zts_node_stop
public static int zts_node_stop() -
zts_node_free
public static int zts_node_free() -
zts_moon_orbit
public static int zts_moon_orbit(long moon_roots_id, long moon_seed) -
zts_moon_deorbit
public static int zts_moon_deorbit(long moon_roots_id) -
zts_connect
public static int zts_connect(int fd, java.lang.String ipstr, int port, int timeout_ms) -
zts_bind
public static int zts_bind(int fd, java.lang.String ipstr, int port) -
zts_set_no_delay
public static int zts_set_no_delay(int fd, int enabled) -
zts_get_no_delay
public static int zts_get_no_delay(int fd) -
zts_set_linger
public static int zts_set_linger(int fd, int enabled, int value) -
zts_get_linger_enabled
public static int zts_get_linger_enabled(int fd) -
zts_get_linger_value
public static int zts_get_linger_value(int fd) -
zts_get_pending_data_size
public static int zts_get_pending_data_size(int fd) -
zts_set_reuse_addr
public static int zts_set_reuse_addr(int fd, int enabled) -
zts_get_reuse_addr
public static int zts_get_reuse_addr(int fd) -
zts_set_recv_timeout
public static int zts_set_recv_timeout(int fd, int seconds, int microseconds) -
zts_get_recv_timeout
public static int zts_get_recv_timeout(int fd) -
zts_set_send_timeout
public static int zts_set_send_timeout(int fd, int seconds, int microseconds) -
zts_get_send_timeout
public static int zts_get_send_timeout(int fd) -
zts_set_send_buf_size
public static int zts_set_send_buf_size(int fd, int size) -
zts_get_send_buf_size
public static int zts_get_send_buf_size(int fd) -
zts_set_recv_buf_size
public static int zts_set_recv_buf_size(int fd, int size) -
zts_get_recv_buf_size
public static int zts_get_recv_buf_size(int fd) -
zts_set_ttl
public static int zts_set_ttl(int fd, int ttl) -
zts_get_ttl
public static int zts_get_ttl(int fd) -
zts_set_blocking
public static int zts_set_blocking(int fd, int enabled) -
zts_get_blocking
public static int zts_get_blocking(int fd) -
zts_set_keepalive
public static int zts_set_keepalive(int fd, int enabled) -
zts_get_keepalive
public static int zts_get_keepalive(int fd) -
zts_core_lock_obtain
public static int zts_core_lock_obtain() -
zts_core_lock_release
public static int zts_core_lock_release() -
zts_core_query_addr_count
public static int zts_core_query_addr_count(long net_id) -
zts_core_query_addr
public static int zts_core_query_addr(long net_id, int idx, java.lang.String addr, int len) -
zts_core_query_route_count
public static int zts_core_query_route_count(long net_id) -
zts_core_query_path_count
public static int zts_core_query_path_count(long peer_id) -
zts_core_query_path
public static int zts_core_query_path(long peer_id, int idx, java.lang.String dst, int len) -
zts_core_query_mc_count
public static int zts_core_query_mc_count(long net_id) -
zts_util_delay
public static void zts_util_delay(long milliseconds) -
zts_bsd_socket
public static int zts_bsd_socket(int family, int type, int protocol) -
zts_bsd_listen
public static int zts_bsd_listen(int fd, int backlog) -
zts_bsd_accept
public static int zts_bsd_accept(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr) -
zts_bsd_read
public static int zts_bsd_read(int fd, byte[] buf) -
zts_bsd_read_offset
public static int zts_bsd_read_offset(int fd, byte[] buf, int offset, int len) -
zts_bsd_read_length
public static int zts_bsd_read_length(int fd, byte[] buf, int len) -
zts_bsd_recv
public static int zts_bsd_recv(int fd, byte[] buf, int flags) -
zts_bsd_recvfrom
public static int zts_bsd_recvfrom(int fd, byte[] buf, int flags, com.zerotier.sockets.ZeroTierSocketAddress addr) -
zts_bsd_write
public static int zts_bsd_write(int fd, byte[] buf) -
zts_bsd_write_byte
public static int zts_bsd_write_byte(int fd, byte b) -
zts_bsd_write_offset
public static int zts_bsd_write_offset(int fd, byte[] buf, int offset, int len) -
zts_bsd_sendto
public static int zts_bsd_sendto(int fd, byte[] buf, int flags, com.zerotier.sockets.ZeroTierSocketAddress addr) -
zts_bsd_send
public static int zts_bsd_send(int fd, byte[] buf, int flags) -
zts_bsd_shutdown
public static int zts_bsd_shutdown(int fd, int how) -
zts_bsd_close
public static int zts_bsd_close(int fd) -
zts_bsd_getsockname
public static boolean zts_bsd_getsockname(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr) -
zts_bsd_getpeername
public static int zts_bsd_getpeername(int fd, com.zerotier.sockets.ZeroTierSocketAddress addr) -
zts_bsd_fcntl
public static int zts_bsd_fcntl(int sock, int cmd, int flag) -
zts_bsd_select
public static int zts_bsd_select(int nfds, com.zerotier.sockets.ZeroTierFileDescriptorSet readfds, com.zerotier.sockets.ZeroTierFileDescriptorSet writefds, com.zerotier.sockets.ZeroTierFileDescriptorSet exceptfds, int timeout_sec, int timeout_usec)
-