Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Async extends Handle {
static function new_async():Async;
@:native("new_async") function new():Void;
function send():Int;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Check extends Handle {
static function new_check():Check;
@:native("new_check") function new():Void;
function start(handle:Handle):Int;
function stop():Int;
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Handle {
function is_active():Bool;
function is_closing():Bool;
function close():Void;
function ref():Void;
function unref():Void;
function has_ref():Bool;
function send_buffer_size(size:Int):Int;
function recv_buffer_size(size:Int):Int;
function fileno():Int;
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Idle extends Handle {
static function new_idle():Idle;
@:native("new_idle") function new():Void;
function start(cb:Void->Void):Int;
function stop(cb:Void->Void):Int;
}

View File

@ -0,0 +1,14 @@
package lua.lib.luv;
@:luaRequire("luv")
extern class Loop {
static function loop_close():Bool;
static function run(?mode:String):Bool;
static function loop_alive():Bool;
static function stop():Void;
static function backend_fd():Int;
static function backend_timeout():Int;
static function now():Int;
static function update_time():Void;
static function walk(cb:Handle->Void):Void;
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Misc {
static function chdir(path:String):Bool;
static function cpu_info():Table<Int, CpuInfo>;
static function cwd():String;
static function exepath():String;
static function get_process_title():String;
static function get_total_memory():Int;
static function get_free_memory():Int;
static function getpid():Int;
static function getrusage():ResourceUsage;
static function guess_handle(handle:Int):String;
static function hrtime():Float;
static function gettimeofday() : TimeOfDay;
// TODO: implement this
static function interface_addresses() : Dynamic;
static function loadavg():Float;
static function resident_set_memory():Int;
static function set_process_title(title:String):Bool;
static function uptime():Int;
static function version():Int;
static function version_string():String;
// Windows only
static function getuid():Int;
static function setuid(from:Int, to:Int):String;
static function getgid():Int;
static function setgid(from:Int, to:Int):Void;
// Windows only
static function print_all_handles():Table<Int, String>;
static function print_active_handles():Table<Int, String>;
}
typedef CpuInfo = {
model:String,
times:CpuTimes,
speed:Int
}
typedef CpuTimes = {
sys:Int,
idle:Int,
irq:Int,
user:Int
}
typedef ResourceUsage = {
nivcsw:Int,
maxrss:Int,
msgrcv:Int,
isrss:Int,
inblock:Int,
ixrss:Int,
nvcsw:Int,
nsignals:Int,
minflt:Int,
nswap:Int,
msgsnd:Int,
oublock:Int,
majflt:Int,
stime:MicroTimeStamp,
idrss:Int,
utime:MicroTimeStamp
}
typedef MicroTimeStamp = {
usec:Int,
sec:Int
}
@:multiReturn
extern class TimeOfDay {
var seconds : Int;
var microseconds : Int;
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Os {
@:native("os_homedir")
static function homedir():String;
@:native("os_tmpdir")
static function tmpdir():String;
@:native("os_get_passwd")
static function get_passwd():String;
@:native("os_getenv")
static function getenv(env:String):String;
@:native("os_setenv")
static function setenv(env:String, value:String):Void;
@:native("os_unsetenv")
static function unsetenv(env:String):Void;
@:native("os_gethostname")
static function gethostname():String;
@:native("os_environ")
static function environ():Table<String, String>;
@:native("os_uname")
static function uname():Uname;
@:native("os_getpid")
static function getpid():Int;
@:native("os_getppid")
static function getppid():Int;
@:native("os_getpriority")
static function getpriority(pid:Int):Int;
@:native("os_setpriority")
static function setpriority(pid:Int, priority:Int):Bool;
}
typedef Uname = {
sysname:String,
release:String,
version:String,
machine:String
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
import haxe.extern.EitherType;
@:luaRequire("luv")
extern class Pipe extends Stream {
static function new_pipe(ipc:Bool):Pipe;
@:native("new_pipe") function new(ipc:Bool):Void;
function open(file:EitherType<FileHandle, Handle>):Pipe;
function bind(name:String):Pipe;
function connect(name:String, cb:String->Bool->Void):Int;
function getsockname():String;
function pending_instances(count:Int):Int;
function pending_count():Int;
function pending_type():Int;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Poll extends Handle {
static function new_poll():Async;
@:native("new_poll") function new():Void;
function start(?type:Int, ?cb:Void->Void):Int;
function stop():Int;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Prepare extends Handle {
static function new_prepare():Prepare;
@:native("new_prepare") function new():Void;
function start():Int;
function stop():Int;
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Process extends Handle {
static function disable_stdio_inheritance():Void;
static function spawn(path:String, options:Dynamic, cb:Int->Signal->Void):LuvSpawn;
function kill(sig:String):Int;
}
typedef ProcessOptions = {
args:Table<Int, String>,
stdio:Table<Int, Pipe>
}
@:multiReturn extern class LuvSpawn {
var handle:Process;
var pid:Int;
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Request {
function cancel():Bool;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Signal extends Handle {
static function new_signal():Signal;
@:native("new_signal") function new():Void;
function start(sigtype:haxe.extern.EitherType<Int, String>, ?cb:Void->Void):Int;
function stop():Int;
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
import lua.lib.luv.net.Tcp;
@:luaRequire("luv")
extern class Stream extends Handle {
function shutdown(?cb:Void->Void):Int;
function listen(backlog:Int, cb:String->String->Void):Int;
function accept(client_stream:Stream):Int;
function read_start(cb:String->String->Void):Int;
function read_stop():Int;
function write(data:StreamData, ?cb:String->Bool->Void):Int;
function write2(data:StreamData, send_handle:Tcp, cb:String->Bool->Void):Int;
function try_write(data:StreamData):Int;
function is_readable():Bool;
function is_writable():Bool;
function set_blocking(blocking:Bool):Int;
}
typedef StreamData = haxe.extern.EitherType<String, Table<Int, String>>;

View File

@ -0,0 +1,34 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Thread {
static function new_thread():Timer;
@:native("new_thread") function new():Void;
static function self():Thread;
static function sleep(msec:Int):Void;
function equal(t:Thread):Bool;
function join(t:Thread):Bool;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Timer extends Handle {
static function new_timer():Timer;
@:native("new_timer") function new():Void;
function start(timeout:Int, repeat:Int, cb:Void->Void):Int;
function stop():Int;
function again():Int;
function set_repeat(repeat:Int):Void;
function get_repeat():Int;
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Tty extends Stream {
static function new_tty(fd:Int, readable:Bool):Tty;
@:native("new_tty") function new(fd:Int, readable:Bool):Void;
static function reset_mode():Int;
function set_mode(mode:Int):Int;
function get_winsize():WidthHeight;
}
@:multiReturn
extern class WidthHeight {
var width:Int;
var height:Int;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv;
@:luaRequire("luv")
extern class Work {
static function new_work():Work;
@:native("new_work") function new():Void;
static function queue_work(work:Work):Bool;
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.fs;
typedef FileDescriptor = Int;

View File

@ -0,0 +1,215 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.fs;
import lua.lib.luv.fs.Open;
import lua.Result;
@:luaRequire("luv")
extern class FileSystem {
@:native("fs_close")
@:overload(function(file:FileDescriptor, cb:String->Bool->Void):Request {})
static function close(file:FileDescriptor):Result<Bool>;
@:native("fs_open")
@:overload(function(path:String, flags:Open, mode:Int, ?cb:String->FileDescriptor->Void):Request {})
static function open(path:String, flags:Open, mode:Int):Result<FileDescriptor>;
@:native("fs_read")
@:overload(function(file:FileDescriptor, len:Int, offset:Int, ?cb:String->String->Void):Request {})
static function read(file:FileDescriptor, len:Int, offset:Int):Result<String>;
@:native("fs_unlink")
@:overload(function(file:FileDescriptor, ?cb:String->String->Void):Request {})
static function unlink(file:FileDescriptor, content:String):Result<String>;
@:native("fs_write")
@:overload(function(file:FileDescriptor, content:String, offset:Int, ?cb:String->Bool->Void):Int {})
static function write(file:FileDescriptor, content:String, offset:Int):Result<Bool>;
@:native("fs_mkdir")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function mkdir(path:String, mode:Int):Result<Bool>;
@:native("fs_mkdtemp")
@:overload(function(data:String, cb:String->Bool->Void):Request {})
static function mkdtemp(data:String):Result<Bool>;
@:native("fs_rmdir")
@:overload(function(path:String, cb:String->Bool->Void):Request {})
static function rmdir(path:String):Result<Int>;
@:native("fs_scandir")
@:overload(function(path:String, cb:String->Bool->Void):Request {})
static function scandir(path:String):ScanDirMarker;
@:native("fs_scandir_next")
static function scandir_next(scandir:ScanDirMarker):ScandirNext;
@:native("fs_stat")
@:overload(function(path:String, cb:String->Stat->Void):Request {})
static function stat(path:String):Result<Stat>;
@:native("fs_fstat")
@:overload(function(descriptor:FileDescriptor, cb:String->Stat->Void):Request {})
static function fstat(descriptor:FileDescriptor):Result<Stat>;
@:native("fs_lstat")
@:overload(function(path:String, cb:String->Stat->Void):Request {})
static function lstat(path:String):Result<Stat>;
@:native("fs_rename")
@:overload(function(path:String, newpath:String, cb:String->Bool->Void):Request {})
static function rename(path:String, newpath:String):Result<Bool>;
@:native("fs_fsync")
@:overload(function(descriptor:FileDescriptor, cb:String->Bool->Void):Request {})
static function fsync(descriptor:FileDescriptor):Result<Bool>;
@:native("fs_fdatasync")
@:overload(function(descriptor:FileDescriptor, cb:String->Bool->Void):Request {})
static function fdatasync(descriptor:FileDescriptor):Result<Bool>;
@:native("fs_ftruncate")
@:overload(function(descriptor:FileDescriptor, offset:Int, cb:String->Bool->Void):Request {})
static function ftruncate(descriptor:FileDescriptor, offset:Int):Result<Bool>;
@:native("fs_sendfile")
@:overload(function(fin:FileDescriptor, fout:FileDescriptor, cb:String->Int->Void):Request {})
static function sendfile(fin:FileDescriptor, fout:FileDescriptor):Result<Int>;
@:native("fs_access")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function access(path:String, mode:Int):Result<Bool>;
@:native("fs_chmod")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function chmod(path:String, mode:Int):Result<Bool>;
@:native("fs_fchmod")
@:overload(function(descriptor:FileDescriptor, mode:Int, cb:String->Bool->Void):Request {})
static function fchmod(descriptor:FileDescriptor, mode:Int):Result<Bool>;
@:native("fs_futime")
@:overload(function(descriptor:FileDescriptor, actime:Int, modtime:Int, cb:String->Bool->Void):Request {})
static function futime(descriptor:FileDescriptor, actime:Int, modtime:Int):Result<Bool>;
@:native("fs_utime")
@:overload(function(path:String, actime:Int, modtime:Int, cb:String->Bool->Void):Request {})
static function utime(path:String, actime:Int, modtime:Int):Result<Bool>;
@:native("fs_link")
@:overload(function(oldpath:String, newpath:String, cb:String->Bool->Void):Request {})
static function link(oldpath:String, newpath:String):Result<Bool>;
@:native("fs_symlink")
@:overload(function(oldpath:String, newpath:String, flags:Int, cb:String->Bool->Void):Request {})
static function symlink(oldpath:String, newpath:String, flags:Int):Bool;
@:native("fs_readlink")
@:overload(function(path:String, cb:String->String->Void):Request {})
static function readlink(path:String):String;
@:native("fs_realpath")
@:overload(function(path:String, cb:String->String->Void):Request {})
static function realpath(path:String):String;
@:native("fs_chown")
@:overload(function(path:String, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function chown(path:String, uid:Int, gid:Int):Bool;
@:native("fs_fchown")
@:overload(function(descriptor:FileDescriptor, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function fchown(descriptor:FileDescriptor, uid:Int, gid:Int):Bool;
/**
Not available on windows
**/
@:native("fs_lchown")
@:overload(function(descriptor:FileDescriptor, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function lchown(descriptor:FileDescriptor, uid:Int, gid:Int):Bool;
@:native("fs_statfs")
@:overload(function(path:String, cb:StatFs->Bool->Void):Request {})
static function statfs(path:String):StatFs;
@:native("fs_opendir")
@:overload(function(path:String, cb:Handle->Bool->Void):Request {})
static function opendir(path:String):Handle;
@:native("fs_readdir")
@:overload(function(dir:Handle, cb:Table<Int, NameType>->Bool->Void):Request {})
static function readdir(path:String):Table<Int, NameType>;
@:native("fs_closedir")
@:overload(function(dir:Handle, cb:Bool->Void):Request {})
static function closedir(dir:Handle):Bool;
}
extern class ScanDirMarker {}
@:multiReturn
extern class ScandirNext {
var name:String;
var type:String;
}
typedef NameType = {
name:String,
type:String
}
typedef Stat = {
ino:Int,
ctime:TimeStamp,
uid:Int,
dev:Int,
nlink:Int,
mode:Int,
size:Int,
birthtime:TimeStamp,
gid:Int,
type:String,
rdev:Int,
gen:Int,
blocks:Int,
mtime:TimeStamp,
atime:TimeStamp,
blksize:Int,
flags:Int
}
typedef TimeStamp = {
sec:Int,
nsec:Int
}
typedef StatFs = {
type:Int,
bsize:Int,
blocks:Int,
bfree:Int,
bavail:Int,
files:Int,
ffree:Int
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.fs;
@:luaRequire("luv")
extern class FileSystemEvent {
static function new_fs_event():FileSystemEvent;
@:native("new_fs_event") function new():Void;
function start(path:String, options:StartOptions, cb:String->Bool->Void):Int;
function stop():Int;
function getpath():String;
}
typedef StartOptions = {
watch_entry:Bool,
stat:Bool,
recursive:Bool
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.fs;
@:luaRequire("luv")
extern class FileSystemPoll {
static function new_fs_poll():FileSystemPoll;
@:native("new_fs_poll") function new():Void;
function start(path:String, interval:Int, cb:String->Bool->Void):Bool;
function stop():Bool;
function getpath():String;
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.fs;
enum abstract Open(String) {
var ReadOnly = "r";
var ReadOnlySync = "rs";
var ReadWrite = "r+";
var ReadWriteSync = "rs+";
var ReadWriteAppend = "a+";
var ReadWriteTruncate = "w+";
var ReadWriteTruncateNewFile = "wx+";
var ReadWriteAppendNewFile = "ax+";
var WriteOnly = "w";
var WriteNewFile = "wx";
var Append = "a";
var AppendNewFile = "ax";
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.net;
@:luaRequire("luv")
extern class Dns {
@:overload(function(node:String, ?service:String, ?hints:AddrInfo, cb:String->Table<Int, AddrInfo>->Void):Request {})
static function getaddrinfo(node:String, ?service:String, ?hints:AddrInfo):Result<Table<Int, AddrInfo>>;
@:overload(function(ip:String, ?port:Int, ?family:String, ?cb:String->AddrInfo->Void):Request {})
static function getnameinfo(info:AddrInfo):Result<String>;
}
typedef AddrInfo = {
?ip:String,
?addr:String,
?port:Int,
?family:String,
?socktype:String
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.net;
@:luaRequire("luv")
extern class Tcp extends Stream {
static function new_tcp():Tcp;
@:native("new_tcp") function new():Void;
function open(sock:Int):Int;
function nodelay(enable:Bool):Int;
function keepalive(enable:Bool, ?delay:Int):Int;
function simultaneous_accepts(enable:Bool):Int;
function bind(address:String, port:Int):Int;
function getsockname():Int;
function getpeername():String;
function connect(host:String, port:Int, cb:String->Bool->Void):Int;
function write_queue_size():Int;
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luv.net;
@:luaRequire("luv")
extern class Udp extends Handle {
static function new_udp():Udp;
@:native("new_udp") function new():Void;
function open(fd:Int):Int;
function bind(host:String, port:Int):Int;
function getsockname():String;
function set_membership(multicast_addr:String, interface_addr:String, membership:String):Int;
function set_multicast_loop(on:Bool):Int;
function set_multicast_ttl(ttl:Int):Int;
function set_multicast_interface(interface_addr:String):Int;
function set_broadcast(on:Bool):Int;
function set_ttl(ttl:Int):Int;
function send(data:String, host:String, port:Int, cb:Bool->Void):Int;
function try_send(data:String, host:String, port:Int):Int;
function recv_start(cb:String->Bool->Void):Int;
function recv_stop():Int;
}