Skip to content

Commit

Permalink
feat: add initial draft of reliable protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcsmith committed Oct 3, 2023
1 parent ae0bfb1 commit 8c12b53
Show file tree
Hide file tree
Showing 14 changed files with 1,109 additions and 701 deletions.
2 changes: 0 additions & 2 deletions crates/scion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ edition = "2021"
publish = false

[dependencies]
serde = { version = "1.0.188", features = ["derive"] }
thiserror = "1.0.48"
bytes = "1.4.0"
serde = { version = "1.0.188", features = ["derive"] }
thiserror = "1.0.48"
6 changes: 6 additions & 0 deletions crates/scion/src/address/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ impl HostType {
}
}

impl From<HostType> for u8 {
fn from(value: HostType) -> Self {
value as u8
}
}

/// Trait to be implemented by address types that are supported by SCION
/// as valid AS-host addresses.
pub trait HostAddress {
Expand Down
8 changes: 7 additions & 1 deletion crates/scion/src/address/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl ServiceAddress {

#[allow(unused)]
/// Special none service address value.
const NONE: Self = Self(0xffff);
pub(crate) const NONE: Self = Self(0xffff);
/// Flag bit indicating whether the address includes multicast
const MULTICAST_FLAG: u16 = 0x8000;

Expand Down Expand Up @@ -103,6 +103,12 @@ impl FromStr for ServiceAddress {
}
}

impl From<ServiceAddress> for u16 {
fn from(value: ServiceAddress) -> Self {
value.0
}
}

impl Display for ServiceAddress {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self.anycast() {
Expand Down
3 changes: 3 additions & 0 deletions crates/scion/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod address;
pub mod daemon;
pub mod reliable;

#[cfg(test)]
pub(crate) mod test_utils;
15 changes: 7 additions & 8 deletions crates/scion/src/reliable.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
mod error;
mod host_address;
mod message;
mod registration;
mod relay_protocol;

pub use error::ReliableRelayError;

mod relay_protocol;
pub use relay_protocol::ReliableRelayProtocol;

const IPV4_OCTETS: usize = 4;
const IPV6_OCTETS: usize = 16;
const LAYER4_PORT_OCTETS: usize = 2;
mod common_header;
mod parser;
mod registration;
mod wire_utils;

const ADDRESS_TYPE_OCTETS: usize = 1;
Loading

0 comments on commit 8c12b53

Please sign in to comment.