diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-03-06 19:58:06 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-03-07 08:42:02 +0100 |
| commit | 14fc5c2740687465e41960dc73e201ba71068840 (patch) | |
| tree | 6c8ca8fac1ddc78283d50ac4a38d44b783d445ec | |
| parent | ae3458fdd2ee092924ce2f275e622f6a66fab903 (diff) | |
| download | mullvadvpn-14fc5c2740687465e41960dc73e201ba71068840.tar.xz mullvadvpn-14fc5c2740687465e41960dc73e201ba71068840.zip | |
Make OpenVpnPluginEvent serializable
| -rw-r--r-- | Cargo.lock | 55 | ||||
| -rw-r--r-- | openvpn_ffi/Cargo.toml | 2 | ||||
| -rw-r--r-- | openvpn_ffi/src/lib.rs | 6 |
3 files changed, 62 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock index d6b275ace6..d6c53e865c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -177,6 +177,8 @@ version = "0.1.0" dependencies = [ "assert_matches 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -185,6 +187,11 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "regex" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -212,6 +219,24 @@ version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "serde_codegen_internals" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "serde_json" version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -228,6 +253,24 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "syn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "talpid_cli" version = "0.0.0" dependencies = [ @@ -243,6 +286,7 @@ dependencies = [ "assert_matches 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "clonablechild 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openvpn_ffi 0.1.0", "talpid_ipc 0.1.0", "zmq 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -302,6 +346,11 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "unreachable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -377,18 +426,24 @@ dependencies = [ "checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151" "checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" "checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" "checksum rustc-demangle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1430d286cadb237c17c885e25447c982c97113926bb579f4379c0eca8d9586dc" "checksum serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "a702319c807c016e51f672e5c77d6f0b46afddd744b5e437d6b8436b888b458f" +"checksum serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d52006899f910528a10631e5b727973fe668f3228109d1707ccf5bad5490b6e" +"checksum serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f15ea24bd037b2d64646b4d934fa99c649be66e3f7b29fb595a5543b212b1452" "checksum serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "dbc45439552eb8fb86907a2c41c1fd0ef97458efb87ff7f878db466eb581824e" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" +"checksum syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)" = "480c834701caba3548aa991e54677281be3a5414a9d09ddbdf4ed74a569a9d19" +"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum term_size 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "71662702fe5cd2cf95edd4ad655eea42f24a87a0e44059cbaa4e55260b7bc331" "checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" "checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum unicode-segmentation 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7baebdc1df1363fa66161fca2fe047e4f4209011cc7e045948298996afdf85df" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f" diff --git a/openvpn_ffi/Cargo.toml b/openvpn_ffi/Cargo.toml index 0ad09ce919..353ee586ff 100644 --- a/openvpn_ffi/Cargo.toml +++ b/openvpn_ffi/Cargo.toml @@ -6,6 +6,8 @@ description = "Constants, enums and structs for interfacing with OpenVPN" [dependencies] error-chain = "0.8" +serde = "0.9" +serde_derive = "0.9" [dev-dependencies] assert_matches = "1.0" diff --git a/openvpn_ffi/src/lib.rs b/openvpn_ffi/src/lib.rs index 6deed54e37..3c880b2293 100644 --- a/openvpn_ffi/src/lib.rs +++ b/openvpn_ffi/src/lib.rs @@ -4,10 +4,14 @@ #[macro_use] extern crate error_chain; +#[macro_use] +extern crate serde_derive; + #[cfg(test)] #[macro_use] extern crate assert_matches; + use std::os::raw::c_int; mod structs; @@ -33,7 +37,7 @@ pub const OPENVPN_PLUGIN_FUNC_DEFERRED: c_int = 2; /// Enum whose variants correspond to the `OPENVPN_PLUGIN_*` event constants. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] pub enum OpenVpnPluginEvent { Up = 0, Down = 1, |
