diff options
Diffstat (limited to 'src/windows/mod.rs')
-rw-r--r-- | src/windows/mod.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/windows/mod.rs b/src/windows/mod.rs index e4db343ec2..73c5989b87 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -50,6 +50,8 @@ pub type ino_t = u16; pub enum timezone {} pub type time64_t = i64; +pub type SOCKET = ::uintptr_t; + s! { // note this is the struct called stat64 in Windows. Not stat, nor stati64. pub struct stat { @@ -93,6 +95,11 @@ s! { pub tv_sec: time_t, pub tv_nsec: c_long, } + + pub struct sockaddr { + pub sa_family: c_ushort, + pub sa_data: [c_char; 14], + } } pub const INT_MIN: c_int = -2147483648; @@ -383,6 +390,34 @@ extern { locale: *const wchar_t) -> *mut wchar_t; } +extern "system" { + pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int; + pub fn accept(s: SOCKET, addr: *mut ::sockaddr, + addrlen: *mut ::c_int) -> SOCKET; + pub fn bind(s: SOCKET, name: *const ::sockaddr, + namelen: ::c_int) -> ::c_int; + pub fn connect(s: SOCKET, name: *const ::sockaddr, + namelen: ::c_int) -> ::c_int; + pub fn getpeername(s: SOCKET, name: *mut ::sockaddr, + nameln: *mut ::c_int) -> ::c_int; + pub fn getsockname(s: SOCKET, name: *mut ::sockaddr, + nameln: *mut ::c_int) -> ::c_int; + pub fn getsockopt(s: SOCKET, level: ::c_int, optname: ::c_int, + optval: *mut ::c_char, + optlen: *mut ::c_int) -> ::c_int; + pub fn recvfrom(s: SOCKET, buf: *mut ::c_char, len: ::c_int, + flags: ::c_int, from: *mut ::sockaddr, + fromlen: *mut ::c_int) -> ::c_int; + pub fn sendto(s: SOCKET, buf: *const ::c_char, len: ::c_int, + flags: ::c_int, to: *const ::sockaddr, + tolen: ::c_int) -> ::c_int; + pub fn setsockopt(s: SOCKET, level: ::c_int, optname: ::c_int, + optval: *const ::c_char, + optlen: ::c_int) -> ::c_int; + pub fn socket(af: ::c_int, socket_type: ::c_int, + protocol: ::c_int) -> SOCKET; +} + cfg_if! { if #[cfg(core_cvoid)] { pub use core::ffi::c_void; |