Skip to content

Commit

Permalink
feat(rust): adss smoltcp support and abstract tcp transport to tcp_core
Browse files Browse the repository at this point in the history
* Changes to support using smoltcp as transport protocol in crate `ockam_transport_smoltcp`.
  * Includes async interface.
  * Ability to manually poll.
  * Necessary implementation of interfaces to run in std using tun/tap interface.

* Extract common behavior from smoltcp and std tcp into `ockam_transport_core` in `tcp` module.
  * Necessary unix socket behavior extracted into traits.
  * Worker and Route behavior extracted into common modules.
  * No support for portals and inlet yet.
  • Loading branch information
conectado committed Feb 21, 2022
1 parent 2a0d5d4 commit 4f089cd
Show file tree
Hide file tree
Showing 47 changed files with 6,184 additions and 476 deletions.
310 changes: 228 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions implementations/rust/ockam/ockam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ockam_node = { path = "../ockam_node", version = "^0.45.0", default-features = f
ockam_vault_sync_core = { path = "../ockam_vault_sync_core", version = "^0.38.0", default_features = false, optional = true }
ockam_vault = { path = "../ockam_vault", version = "^0.40.0", default_features = false, optional = true }
ockam_channel = { path = "../ockam_channel", version = "^0.42.0", default_features = false }
ockam_transport_tcp = { path = "../ockam_transport_tcp", version = "^0.41.0", optional = true }
ockam_transport_tcp = { path = "../ockam_transport_tcp", version = "^0.42.0", optional = true }
ockam_key_exchange_core = { path = "../ockam_key_exchange_core", version = "^0.38.0", default_features = false }
ockam_key_exchange_xx = { path = "../ockam_key_exchange_xx", version = "^0.39.0", default_features = false, optional = true }
ockam_identity = { path = "../ockam_identity", version = "^0.36.0", default_features = false }
Expand All @@ -117,8 +117,8 @@ hex = { version = "0.4", default-features = false }
dyn-clone = "1.0"

[dev-dependencies]
ockam_vault_sync_core = { path = "../ockam_vault_sync_core", version = "^0.38.0"}
ockam_key_exchange_xx = { path = "../ockam_key_exchange_xx", version = "^0.39.0"}
ockam_vault_sync_core = { path = "../ockam_vault_sync_core", version = "^0.38.0" }
ockam_key_exchange_xx = { path = "../ockam_key_exchange_xx", version = "^0.39.0" }
trybuild = { version = "1.0", features = ["diff"] }
serde_json = "1.0"
rand_xorshift = "0.3"
8 changes: 5 additions & 3 deletions implementations/rust/ockam/ockam_core/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,24 @@ pub mod sync {
pub use spin::RwLock;

/// spin::Mutex.lock() does not return Option<T>
pub struct Mutex<T>(spin::Mutex<T>);
pub struct Mutex<T: ?Sized>(spin::Mutex<T>);
impl<T> Mutex<T> {
pub fn new(value: T) -> Self {
Mutex(spin::Mutex::new(value))
}
}
impl<T: ?Sized> Mutex<T> {
pub fn lock(&self) -> Option<spin::MutexGuard<'_, T>> {
Some(self.0.lock())
}
}
impl<T> core::ops::Deref for Mutex<T> {
impl<T: ?Sized> core::ops::Deref for Mutex<T> {
type Target = spin::Mutex<T>;
fn deref(&self) -> &spin::Mutex<T> {
&self.0
}
}
impl<T> core::ops::DerefMut for Mutex<T> {
impl<T: ?Sized> core::ops::DerefMut for Mutex<T> {
fn deref_mut(&mut self) -> &mut spin::Mutex<T> {
&mut self.0
}
Expand Down
Loading

0 comments on commit 4f089cd

Please sign in to comment.