summaryrefslogtreecommitdiffhomepage
path: root/talpid_ipc/src/lib.rs
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-02-28 13:25:29 +0800
committerErik Larkö <erik@mullvad.net>2017-03-02 21:29:23 +0800
commite8bdd0b098a5851973f7a4a6caf42827fd55efc5 (patch)
treec7b63d9d4dd5fe8a2a925bfaf282a58dd28068bd /talpid_ipc/src/lib.rs
parent2ce1865e915fef63ddc03b92bfe647e63e5bfd49 (diff)
downloadmullvadvpn-e8bdd0b098a5851973f7a4a6caf42827fd55efc5.tar.xz
mullvadvpn-e8bdd0b098a5851973f7a4a6caf42827fd55efc5.zip
No server trait, return Id when started
Diffstat (limited to 'talpid_ipc/src/lib.rs')
-rw-r--r--talpid_ipc/src/lib.rs34
1 files changed, 28 insertions, 6 deletions
diff --git a/talpid_ipc/src/lib.rs b/talpid_ipc/src/lib.rs
index 1cc3ec497c..75ace1d87e 100644
--- a/talpid_ipc/src/lib.rs
+++ b/talpid_ipc/src/lib.rs
@@ -1,9 +1,31 @@
-#[cfg(test)]
-#[macro_use]
-extern crate assert_matches;
-
#[macro_use]
extern crate error_chain;
-mod ipc;
-pub use ipc::*;
+#[cfg(windows)]
+#[path = "nop_ipc.rs"]
+mod ipc_impl;
+
+#[cfg(not(windows))]
+#[path = "zmq_ipc.rs"]
+mod ipc_impl;
+
+pub use self::ipc_impl::*;
+
+/// The type signature for functions accepting messages from the server.
+/// If the server fails in delivering the message for any reason it will
+/// put the cause in the Err part of the `Result`.
+pub type OnMessage<MessageType> = FnMut(Result<MessageType>) + Send + 'static;
+
+error_chain!{
+ errors {
+ ReadFailure {
+ description("Could not read IPC message")
+ }
+ CouldNotStartServer {
+ description("Failed to start the IPC server")
+ }
+ InvalidMessage(message: Vec<u8>) {
+ description("The IPC server got a message it did not know how to handle")
+ }
+ }
+}