1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! C definitions used by libnative that don't belong in liblibc
13 #![allow(type_overflow)]
17 pub static WSADESCRIPTION_LEN: uint = 256;
18 pub static WSASYS_STATUS_LEN: uint = 128;
19 pub static FIONBIO: libc::c_long = 0x8004667e;
20 static FD_SETSIZE: uint = 64;
23 pub wVersion: libc::WORD,
24 pub wHighVersion: libc::WORD,
25 pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1],
26 pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
29 pub lpVendorInfo: *u8,
32 pub type LPWSADATA = *mut WSADATA;
35 fd_count: libc::c_uint,
36 fd_array: [libc::SOCKET, ..FD_SETSIZE],
39 pub fn fd_set(set: &mut fd_set, s: libc::SOCKET) {
40 set.fd_array[set.fd_count as uint] = s;
44 #[link(name = "ws2_32")]
46 pub fn WSAStartup(wVersionRequested: libc::WORD,
47 lpWSAData: LPWSADATA) -> libc::c_int;
48 pub fn WSAGetLastError() -> libc::c_int;
50 pub fn ioctlsocket(s: libc::SOCKET, cmd: libc::c_long,
51 argp: *mut libc::c_ulong) -> libc::c_int;
52 pub fn select(nfds: libc::c_int,
54 writefds: *mut fd_set,
55 exceptfds: *mut fd_set,
56 timeout: *libc::timeval) -> libc::c_int;
57 pub fn getsockopt(sockfd: libc::SOCKET,
60 optval: *mut libc::c_char,
61 optlen: *mut libc::c_int) -> libc::c_int;