diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-11-03 10:08:44 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-11-03 10:46:41 -0800 |
commit | b9096d3df8b11f983d502f6157235729dc6e93a1 (patch) | |
tree | 986bbcbaf5443d6559566f54be5f5cf1905062dd /src/unix | |
parent | 10dff9a489a457a2131b36f1557f160c813b0208 (diff) | |
download | rust-libc-b9096d3df8b11f983d502f6157235729dc6e93a1.tar.gz |
Add getaddrinfo functions
Diffstat (limited to 'src/unix')
-rw-r--r-- | src/unix/bsd/mod.rs | 7 | ||||
-rw-r--r-- | src/unix/mod.rs | 8 | ||||
-rw-r--r-- | src/unix/notbsd/android/mod.rs | 7 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mips.rs | 10 | ||||
-rw-r--r-- | src/unix/notbsd/linux/notmips/mod.rs | 10 |
5 files changed, 41 insertions, 1 deletions
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index ca738062b0..03fe18c2ea 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -135,6 +135,13 @@ extern { pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 5085028aed..fb028971a5 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -432,7 +432,6 @@ extern { pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; - pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; pub fn dlerror() -> *mut ::c_char; @@ -440,6 +439,13 @@ extern { symbol: *const ::c_char) -> *mut ::c_void; pub fn dlclose(handle: *mut ::c_void) -> ::c_int; pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; + + pub fn getaddrinfo(node: *const c_char, + service: *const c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo) -> ::c_int; + pub fn freeaddrinfo(res: *mut addrinfo); + pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; } // TODO: get rid of this #[cfg(not(...))] diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 86db969a22..37678f4ebb 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -218,6 +218,13 @@ extern { flags: ::c_uint) -> ::ssize_t; pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::size_t, + serv: *mut ::c_char, + sevlen: ::size_t, + flags: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index 16cdcc82a9..e51fd67bd7 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -235,3 +235,13 @@ pub const SIGCHLD: ::c_int = 18; pub const SIGBUS: ::c_int = 10; pub const SIG_SETMASK: ::c_int = 3; + +extern { + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_uint) -> ::c_int; +} diff --git a/src/unix/notbsd/linux/notmips/mod.rs b/src/unix/notbsd/linux/notmips/mod.rs index 5deb068de5..f974a56387 100644 --- a/src/unix/notbsd/linux/notmips/mod.rs +++ b/src/unix/notbsd/linux/notmips/mod.rs @@ -179,6 +179,16 @@ pub const SIGCHLD: ::c_int = 17; pub const SIGBUS: ::c_int = 7; pub const SIG_SETMASK: ::c_int = 2; +extern { + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int) -> ::c_int; +} + cfg_if! { if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { mod b32; |