summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-07-06 13:34:15 +0300
committerYuval Adam <_@yuv.al>2018-07-06 13:34:15 +0300
commit8459bef382664b181e8b7e7e4712d7051258faff (patch)
treed179d5d9a9f707ba2fc98c1eeb7718eb739220ea
parentd0f7dff9a51fa33612b71d03a3736dd107e9a747 (diff)
Building against gssdp sorta works
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml4
-rw-r--r--build.rs5
-rw-r--r--src/main.rs4
-rw-r--r--src/upnp.rs14
5 files changed, 34 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 17d05e2..143fb3a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -54,6 +54,11 @@ version = "0.2.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "pkg-config"
+version = "0.3.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "redox_syscall"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -72,6 +77,8 @@ version = "0.1.0"
dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"termios 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -143,6 +150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1"
+"checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f"
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
diff --git a/Cargo.toml b/Cargo.toml
index 62fcd62..052118f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,4 +6,8 @@ authors = ["Yuval Adam <_@yuv.al>"]
[dependencies]
colored = "1.6"
clap = "2.32"
+libc = "0.2.42"
termios = "0.3.0"
+
+[build-dependencies]
+pkg-config = "0.3.11"
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..5b21abd
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,5 @@
+extern crate pkg_config;
+
+fn main() {
+ pkg_config::Config::new().probe("gssdp-1.0").unwrap();
+}
diff --git a/src/main.rs b/src/main.rs
index 4205b78..3db18f7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,6 +7,7 @@ use std::path::Path;
use std::process;
mod cli;
+mod upnp;
fn main() {
let app = App::new("Rustcast")
@@ -31,5 +32,6 @@ fn main() {
}
// test a single char read
- cli::read_char();
+ // cli::read_char();
+ upnp::discover();
}
diff --git a/src/upnp.rs b/src/upnp.rs
new file mode 100644
index 0000000..fc3cd2c
--- /dev/null
+++ b/src/upnp.rs
@@ -0,0 +1,14 @@
+extern crate libc;
+
+use self::libc::{uint32_t, uint16_t, uint8_t, c_char, c_uchar, c_int, c_void};
+
+pub type GSSDPClient = *mut c_void;
+
+#[link(name = "gssdp-1.0")]
+extern {
+ pub fn gssdp_client_new(main_context: *mut c_void, iface: *const c_char, error: *mut c_void) -> GSSDPClient;
+}
+
+pub fn discover() {
+ println!("Discovering...");
+}