diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-08-17 16:31:08 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-08-17 16:31:08 +0200 |
commit | 78ab1a93e6d519bf404fbe61fc7ec3c3ab35a72a (patch) | |
tree | 75106e1ff89a03a6869184994b902a70315dfc30 /src/types/udp.rs | |
parent | Begin drafting cross-platform interface (diff) | |
download | wireguard-rs-78ab1a93e6d519bf404fbe61fc7ec3c3ab35a72a.tar.xz wireguard-rs-78ab1a93e6d519bf404fbe61fc7ec3c3ab35a72a.zip |
Remove peer from cryptkey router on drop
Diffstat (limited to 'src/types/udp.rs')
-rw-r--r-- | src/types/udp.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/types/udp.rs b/src/types/udp.rs new file mode 100644 index 0000000..f45cf85 --- /dev/null +++ b/src/types/udp.rs @@ -0,0 +1,26 @@ +use std::error; + +/* Often times an a file descriptor in an atomic might suffice. + */ +pub trait Bind<Endpoint>: Send + Sync { + type Error : error::Error; + + fn new() -> Self; + + /// Updates the port of the Bind + /// + /// # Arguments + /// + /// - port, The new port to bind to. 0 means any available port. + /// + /// # Returns + /// + /// The unit type or an error, if binding fails + fn set_port(&self, port: u16) -> Result<(), Self::Error>; + + /// Returns the current port of the bind + fn get_port(&self) -> u16; + + fn recv(&self, dst: &mut [u8]) -> Endpoint; + fn send(&self, src: &[u8], dst: &Endpoint); +} |