Skip to content

Commit

Permalink
Add getaddrinfo functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Nov 3, 2015
1 parent 10dff9a commit b9096d3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
8 changes: 7 additions & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,20 @@ 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;
pub fn dlsym(handle: *mut ::c_void,
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(...))]
Expand Down
7 changes: 7 additions & 0 deletions src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
10 changes: 10 additions & 0 deletions src/unix/notbsd/linux/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
10 changes: 10 additions & 0 deletions src/unix/notbsd/linux/notmips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b9096d3

Please sign in to comment.