diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-02-28 16:05:14 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-02-28 17:32:15 +0100 |
| commit | 08c3fa1931e8f8ecb74553287388acd4efd2ab1e (patch) | |
| tree | fbc81620424c4e2265ca62162a895489341c3bb5 | |
| parent | 03cfb564f0150ab192a9c76f71f2b352efdcd3f5 (diff) | |
| download | mullvadvpn-08c3fa1931e8f8ecb74553287388acd4efd2ab1e.tar.xz mullvadvpn-08c3fa1931e8f8ecb74553287388acd4efd2ab1e.zip | |
Add EventProcessor
| -rw-r--r-- | talpid_openvpn_plugin/src/lib.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/talpid_openvpn_plugin/src/lib.rs b/talpid_openvpn_plugin/src/lib.rs index d2d1ea9d74..49e4ce031c 100644 --- a/talpid_openvpn_plugin/src/lib.rs +++ b/talpid_openvpn_plugin/src/lib.rs @@ -8,8 +8,38 @@ extern crate error_chain; #[macro_use] extern crate assert_matches; +use std::collections::HashMap; + + mod ffi; /// Publicly export the functions making up the public interface of the plugin. These are the C FFI /// functions called by OpenVPN. pub use ffi::{openvpn_plugin_open_v3, openvpn_plugin_close_v1, openvpn_plugin_func_v3}; + +use ffi::consts::OpenVpnPluginEvent; + + +error_chain!{} + + +/// Struct processing OpenVPN events and notifies listeners over IPC +struct EventProcessor; + +impl EventProcessor { + pub fn new() -> Result<EventProcessor> { + Ok(EventProcessor) + } + + pub fn process_event(&mut self, event: OpenVpnPluginEvent, env: HashMap<String, String>) { + // TODO(linus): This is where we should send events to core. + println!("Hello from EventProcessor: {:?}", event); + } +} + +impl Drop for EventProcessor { + fn drop(&mut self) { + // TODO(linus): If we need, this is where we send some shutdown event or similar to core. + println!("Dropping EventProcessor!"); + } +} |
