-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port
Socket::Address
to win32 (#10610)
- Loading branch information
1 parent
3e2c6d3
commit a7544b5
Showing
13 changed files
with
250 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lib LibC | ||
alias AddressFamily = UShort | ||
|
||
struct SockaddrUn | ||
sun_family : AddressFamily | ||
sun_path : Char[108] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,52 @@ | ||
lib LibC | ||
# source https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr | ||
EPERM = 1 | ||
ENOENT = 2 | ||
ESRCH = 3 | ||
EINTR = 4 | ||
EIO = 5 | ||
ENXIO = 6 | ||
E2BIG = 7 | ||
ENOEXEC = 8 | ||
EBADF = 9 | ||
ECHILD = 10 | ||
EAGAIN = 11 | ||
ENOMEM = 12 | ||
EACCES = 13 | ||
EFAULT = 14 | ||
EBUSY = 16 | ||
EEXIST = 17 | ||
EXDEV = 18 | ||
ENODEV = 19 | ||
ENOTDIR = 20 | ||
EISDIR = 21 | ||
EINVAL = 22 | ||
ENFILE = 23 | ||
EMFILE = 24 | ||
ENOTTY = 25 | ||
EFBIG = 27 | ||
ENOSPC = 28 | ||
ESPIPE = 29 | ||
EROFS = 30 | ||
EMLINK = 31 | ||
EPIPE = 32 | ||
EDOM = 33 | ||
ERANGE = 34 | ||
EDEADLK = 36 | ||
ENAMETOOLONG = 38 | ||
ENOLCK = 39 | ||
ENOSYS = 40 | ||
ENOTEMPTY = 41 | ||
EILSEQ = 42 | ||
STRUNCATE = 80 | ||
EPERM = 1 | ||
ENOENT = 2 | ||
ESRCH = 3 | ||
EINTR = 4 | ||
EIO = 5 | ||
ENXIO = 6 | ||
E2BIG = 7 | ||
ENOEXEC = 8 | ||
EBADF = 9 | ||
ECHILD = 10 | ||
EAGAIN = 11 | ||
ENOMEM = 12 | ||
EACCES = 13 | ||
EFAULT = 14 | ||
EBUSY = 16 | ||
EEXIST = 17 | ||
EXDEV = 18 | ||
ENODEV = 19 | ||
ENOTDIR = 20 | ||
EISDIR = 21 | ||
EINVAL = 22 | ||
ENFILE = 23 | ||
EMFILE = 24 | ||
ENOTTY = 25 | ||
EFBIG = 27 | ||
ENOSPC = 28 | ||
ESPIPE = 29 | ||
EROFS = 30 | ||
EMLINK = 31 | ||
EPIPE = 32 | ||
EDOM = 33 | ||
ERANGE = 34 | ||
EDEADLK = 36 | ||
ENAMETOOLONG = 38 | ||
ENOLCK = 39 | ||
ENOSYS = 40 | ||
ENOTEMPTY = 41 | ||
EILSEQ = 42 | ||
STRUNCATE = 80 | ||
EADDRINUSE = 100 | ||
EALREADY = 103 | ||
ECONNABORTED = 106 | ||
ECONNREFUSED = 107 | ||
ECONNRESET = 108 | ||
EINPROGRESS = 112 | ||
EISCONN = 113 | ||
ENOPROTOOPT = 123 | ||
|
||
alias ErrnoT = Int | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
lib LibC | ||
struct In6Addr | ||
u : In6AddrU | ||
end | ||
|
||
union In6AddrU | ||
byte : Char[16] | ||
word : WORD[8] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "./ws2def" | ||
|
||
@[Link("WS2_32")] | ||
lib LibC | ||
AF_UNSPEC = 0 | ||
AF_UNIX = 1 | ||
AF_INET = 2 | ||
AF_IPX = 6 | ||
AF_APPLETALK = 16 | ||
AF_NETBIOS = 17 | ||
AF_INET6 = 23 | ||
AF_IRDA = 26 | ||
AF_BTH = 32 | ||
|
||
struct InAddr | ||
s_addr : UInt32 | ||
end | ||
|
||
fun htons(hostshort : UShort) : UShort | ||
fun ntohs(netshort : UShort) : UShort | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
lib LibC | ||
IPPROTO_IP = 0 | ||
IPPROTO_ICMP = 1 | ||
IPPROTO_IGMP = 2 | ||
IPPROTO_TCP = 6 | ||
IPPROTO_UDP = 17 | ||
IPPROTO_ICMPV6 = 58 | ||
IPPROTO_RAW = 255 | ||
|
||
struct Sockaddr | ||
sa_family : UInt8 | ||
sa_data : Char[14] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require "./in6addr" | ||
|
||
lib LibC | ||
struct SockaddrIn6 | ||
sin6_family : Short | ||
sin6_port : UShort | ||
sin6_flowinfo : ULong | ||
sin6_addr : In6Addr | ||
sin6_scope_id : ULong | ||
end | ||
|
||
struct SockaddrIn | ||
sin_family : Short | ||
sin_port : UShort | ||
sin_addr : InAddr | ||
sin_zero : StaticArray(CHAR, 8) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "./winsock2" | ||
require "./ws2ipdef" | ||
|
||
lib LibC | ||
fun inet_ntop(family : Int, pAddr : Void*, pStringBuf : Char*, stringBufSize : SizeT) : Char* | ||
fun inet_pton(family : Int, pszAddrString : Char*, pAddrBuf : Void*) : Int | ||
end |
Oops, something went wrong.