-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,466 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ Cargo.lock | |
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# IDEs/Editors | ||
*.sublime-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "ifaddrs" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
libc = "~0.2.28" | ||
c_linked_list = "~1.1.0" | ||
|
||
[target.'cfg(target_os = "android")'.dependencies.ifaddrs-sys] | ||
version = "0.1.0" | ||
path = "ifaddrs-sys" | ||
|
||
[dev-dependencies] | ||
unwrap = "~1.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "ifaddrs-sys" | ||
version = "0.1.0" | ||
links = "ifaddrs" | ||
build = "build.rs" | ||
|
||
[lib] | ||
name = "ifaddrs_sys" | ||
path = "lib.rs" | ||
|
||
[dependencies] | ||
libc = "~0.2.28" | ||
|
||
[build-dependencies] | ||
gcc = "0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extern crate gcc; | ||
|
||
use std::env; | ||
|
||
fn main() { | ||
let mut cfg = gcc::Build::new(); | ||
if env::var("TARGET").unwrap().contains("android") { | ||
cfg.include("native").file("native/ifaddrs.c").compile( | ||
"libifaddrs.a", | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![cfg(target_os = "android")] | ||
extern crate libc; | ||
use libc::*; | ||
#[repr(C)] | ||
#[derive(Debug)] | ||
pub struct ifaddrs { | ||
pub ifa_next: *mut ifaddrs, | ||
pub ifa_name: *mut c_char, | ||
pub ifa_flags: ::c_uint, | ||
pub ifa_addr: *mut ::sockaddr, | ||
pub ifa_netmask: *mut ::sockaddr, | ||
pub ifa_ifu: *mut ::sockaddr, | ||
pub ifa_data: *mut ::c_void, | ||
} | ||
|
||
extern "C" { | ||
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; | ||
pub fn freeifaddrs(ifa: *mut ::ifaddrs); | ||
} |
Oops, something went wrong.