1#![allow(non_camel_case_types)]
19
20#[cfg(unix)]
21mod unix {
22 extern crate libc;
23
24 pub type fd_set = libc::fd_set;
25 pub type hostent = libc::hostent;
26 pub type in_addr = libc::in_addr;
27 pub type in6_addr = libc::in6_addr;
28 pub type iovec = libc::iovec;
29 pub type sa_family_t = libc::sa_family_t;
30 pub type sockaddr = libc::sockaddr;
31 pub type sockaddr_in = libc::sockaddr_in;
32 pub type sockaddr_in6 = libc::sockaddr_in6;
33 pub type socklen_t = libc::socklen_t;
34
35 pub type ADDRESS_FAMILY = libc::c_int;
36 pub const AF_UNSPEC: ADDRESS_FAMILY = libc::AF_UNSPEC;
37 pub const AF_INET: ADDRESS_FAMILY = libc::AF_INET;
38 pub const AF_INET6: ADDRESS_FAMILY = libc::AF_INET6;
39}
40
41#[cfg(windows)]
42mod windows {
43 extern crate libc;
44 extern crate windows_sys;
45
46 pub type fd_set = windows_sys::Win32::Networking::WinSock::FD_SET;
47 pub type hostent = windows_sys::Win32::Networking::WinSock::HOSTENT;
48 pub type in_addr = windows_sys::Win32::Networking::WinSock::IN_ADDR;
49 pub type in6_addr = windows_sys::Win32::Networking::WinSock::IN6_ADDR;
50 #[repr(C)]
51 pub struct iovec {
52 pub iov_base: *mut libc::c_void,
53 pub iov_len: libc::size_t,
54 }
55 pub type sa_family_t = windows_sys::Win32::Networking::WinSock::ADDRESS_FAMILY;
56 pub type sockaddr = windows_sys::Win32::Networking::WinSock::SOCKADDR;
57 pub type sockaddr_in = windows_sys::Win32::Networking::WinSock::SOCKADDR_IN;
58 pub type sockaddr_in6 = windows_sys::Win32::Networking::WinSock::SOCKADDR_IN6;
59 pub type socklen_t = windows_sys::Win32::Networking::WinSock::socklen_t;
60
61 pub type ADDRESS_FAMILY = windows_sys::Win32::Networking::WinSock::ADDRESS_FAMILY;
62 pub const AF_UNSPEC: ADDRESS_FAMILY = windows_sys::Win32::Networking::WinSock::AF_UNSPEC;
63 pub const AF_INET: ADDRESS_FAMILY = windows_sys::Win32::Networking::WinSock::AF_INET;
64 pub const AF_INET6: ADDRESS_FAMILY = windows_sys::Win32::Networking::WinSock::AF_INET6;
65}
66
67#[cfg(unix)]
68pub use self::unix::*;
69
70#[cfg(windows)]
71pub use self::windows::*;