blob: 6103ceaccff0a69721c436b2786e98d705b0bfd9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package externs;
import cpp.Void;
import cpp.SizeT;
import cpp.Star;
import cpp.Int32;
import cpp.ConstStar;
import cpp.ConstCharStar;
@:include("sys/socket.h")
@:native("struct sockaddr")
@:structAccess
extern class SockAddr {}
@:include("sys/un.h")
@:native("struct sockaddr_un")
@:structAccess
extern class SockAddrUnix {}
@:buildXml("<include name='${haxelib:haxe-unix-sockets}/src/externs/Build.xml'/>")
@:include("unistd.h")
@:include("sys/socket.h")
extern class Socket {
@:native("socket") static function socket(domain:Int32, type:Int32, protocol:Int32):Int32;
@:native("bind") static function bind(sockfd:Int32, addr:ConstStar<SockAddr>, addrlen:Int32):Int32;
@:native("listen") static function listen(sockfd:Int32, backlog:Int32):Int32;
@:native("accept") static function accept(sockfd:Int32, addr:Star<SockAddr>, addrlen:Star<Int32>):Int32;
@:native("connect") static function connect(sockfd:Int32, addr:ConstStar<SockAddr>, addrlen:Int32):Int32;
@:native("read") static function read(fd:Int32, buf:Star<Void>, count:SizeT):SizeT;
@:native("write") static function write(fd:Int32, buf:ConstStar<Void>, count:SizeT):SizeT;
@:native("close") static function close(fd:Int32):Int32;
}
|