Jeremy Soller | 4ddaf1f | 2016-11-03 16:53:22 -0600 | [diff] [blame^] | 1 | pub type c_char = i8; |
| 2 | pub type c_long = i64; |
| 3 | pub type c_ulong = u64; |
| 4 | |
| 5 | pub type wchar_t = i16; |
| 6 | |
| 7 | pub type off_t = usize; |
| 8 | pub type mode_t = u16; |
| 9 | pub type time_t = i64; |
| 10 | pub type pid_t = usize; |
| 11 | pub type gid_t = usize; |
| 12 | pub type uid_t = usize; |
| 13 | |
| 14 | pub type in_addr_t = u32; |
| 15 | pub type in_port_t = u16; |
| 16 | |
| 17 | pub type socklen_t = u32; |
| 18 | pub type sa_family_t = u16; |
| 19 | |
| 20 | #[derive(Copy, Clone)] |
| 21 | #[repr(C)] |
| 22 | pub struct in_addr { |
| 23 | pub s_addr: in_addr_t, |
| 24 | } |
| 25 | |
| 26 | #[derive(Copy, Clone)] |
| 27 | #[repr(C)] |
| 28 | pub struct in6_addr { |
| 29 | pub s6_addr: [u8; 16], |
| 30 | __align: [u32; 0], |
| 31 | } |
| 32 | |
| 33 | #[derive(Copy, Clone)] |
| 34 | #[repr(C)] |
| 35 | pub struct sockaddr { |
| 36 | pub sa_family: sa_family_t, |
| 37 | pub sa_data: [::c_char; 14], |
| 38 | } |
| 39 | |
| 40 | #[derive(Copy, Clone)] |
| 41 | #[repr(C)] |
| 42 | pub struct sockaddr_in { |
| 43 | pub sin_family: sa_family_t, |
| 44 | pub sin_port: ::in_port_t, |
| 45 | pub sin_addr: ::in_addr, |
| 46 | pub sin_zero: [u8; 8], |
| 47 | } |
| 48 | |
| 49 | #[derive(Copy, Clone)] |
| 50 | #[repr(C)] |
| 51 | pub struct sockaddr_in6 { |
| 52 | pub sin6_family: sa_family_t, |
| 53 | pub sin6_port: in_port_t, |
| 54 | pub sin6_flowinfo: u32, |
| 55 | pub sin6_addr: ::in6_addr, |
| 56 | pub sin6_scope_id: u32, |
| 57 | } |