2017-10-16 16:45:46 -07:00
|
|
|
/*
|
|
|
|
|
* ZeroTier SDK - Network Virtualization Everywhere
|
|
|
|
|
* Copyright (C) 2011-2017 ZeroTier, Inc. https://www.zerotier.com/
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
* --
|
|
|
|
|
*
|
|
|
|
|
* You can be released from the requirements of the license by purchasing
|
|
|
|
|
* a commercial license. Buying such a license is mandatory as soon as you
|
|
|
|
|
* develop commercial closed-source software that incorporates or links
|
|
|
|
|
* directly against ZeroTier software without disclosing the source code
|
|
|
|
|
* of your own application.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-10-16 14:27:25 -07:00
|
|
|
package zerotier;
|
2017-10-16 13:40:05 -07:00
|
|
|
|
|
|
|
|
class ZeroTier {
|
2017-10-16 15:12:37 -07:00
|
|
|
|
2017-10-16 16:45:46 -07:00
|
|
|
// socket families
|
|
|
|
|
// socket types
|
|
|
|
|
// basic service controls
|
|
|
|
|
@native def start(path: String, blocking: Boolean): Int
|
2017-11-21 15:24:51 -08:00
|
|
|
@native def startjoin(path: String, nwid: Long): Int
|
2017-10-16 15:34:43 -07:00
|
|
|
@native def stop(): Unit
|
|
|
|
|
@native def running(): Int
|
2017-11-21 15:24:51 -08:00
|
|
|
@native def join(nwid: Long): Unit
|
|
|
|
|
@native def leave(nwid: Long): Unit
|
2017-10-16 16:45:46 -07:00
|
|
|
// advanced service controls
|
|
|
|
|
//@native def get_path(): Unit
|
2017-11-21 15:24:51 -08:00
|
|
|
@native def get_node_id(): Long
|
2017-10-16 15:34:43 -07:00
|
|
|
//@native def get_6plane_addr(): Unit
|
|
|
|
|
//@native def get_rfc4193_addr(): Unit
|
2017-10-16 16:45:46 -07:00
|
|
|
// socket API
|
2017-10-16 15:34:43 -07:00
|
|
|
@native def socket(socket_family: Int, socket_type: Int, protocol: Int): Int
|
2017-10-16 16:45:46 -07:00
|
|
|
@native def connect(fd: Int, addr: String, port: Int): Int
|
|
|
|
|
@native def bind(fd: Int, addr: String, port: Int): Int
|
2017-10-16 15:34:43 -07:00
|
|
|
@native def listen(fd: Int, backlog: Int): Int
|
|
|
|
|
@native def accept(fd: Int, addr: Object, addrlen: Int): Int
|
|
|
|
|
@native def accept4(fd: Int, addr: Object, addrlen: Int, flags: Int): Int
|
2017-10-16 16:45:46 -07:00
|
|
|
@native def close(fd: Int): Int
|
2017-10-16 15:34:43 -07:00
|
|
|
@native def setsockopt(fd: Int, level: Int, optname: Int, optval: Object, optlen: Int): Int
|
|
|
|
|
@native def getsockopt(fd: Int, level: Int, optname: Int, optval: Object, optlen: Int): Int
|
2017-10-16 16:45:46 -07:00
|
|
|
@native def read(fd: Int, buf: Object, len: Int): Int
|
|
|
|
|
@native def write(fd: Int, buf: Object, len: Int): Int
|
|
|
|
|
@native def send(fd: Int, buf: Object, len: Int, flags: Int): Int
|
|
|
|
|
@native def sendto(fd: Int, buf: Object, len: Int, addr: Object, addrlen: Int): Int
|
|
|
|
|
@native def sendmsg(fd: Int, msg: Object, flags: Int): Int
|
|
|
|
|
@native def recv(fd: Int, buf: Object, len: Int, flags: Int): Int
|
|
|
|
|
@native def recvfrom(fd: Int, buf: Object, len: Int, addr: Object, addrlen: Int): Int
|
|
|
|
|
@native def recvmsg(fd: Int, msg: Object, flags: Int): Int
|
|
|
|
|
@native def shutdown(fd: Int, how: Int): Int
|
2017-10-16 15:34:43 -07:00
|
|
|
//@native def getsockname(): Int
|
|
|
|
|
//@native def getpeername(): Int
|
|
|
|
|
//@native def gethostname(): Int
|
|
|
|
|
//@native def sethostname(): Int
|
|
|
|
|
//@native def gethostbyname(): Object
|
|
|
|
|
//@native def poll(): Int
|
|
|
|
|
//@native def select(): Int
|
|
|
|
|
@native def fcntl(fd: Int, cmd: Int, flags: Int): Int
|
|
|
|
|
@native def ioctl(fd: Int, request: Long, argp: Object): Int
|
2017-10-16 16:45:46 -07:00
|
|
|
// stack controls
|
2017-10-16 15:34:43 -07:00
|
|
|
//@native def add_dns(): Int
|
|
|
|
|
//@native def del_dns(): Int
|
2017-10-16 13:40:05 -07:00
|
|
|
}
|