Skip to content

Commit

Permalink
doc: document that reversed paths are for end-host usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcsmith committed Dec 19, 2023
1 parent 6ad9468 commit 33c1a0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/scion-proto/src/path/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ where

/// Creates new StandardPath, backed by the provided buffer, by copying and reversing this one.
///
/// The reversed path is suitable for use from an end-host: its current hop and info field
/// indices are set to 0.
///
/// # Panics
///
/// Panics if the provided buffer does not have the same length as self.raw().
Expand All @@ -301,9 +304,8 @@ where

/// Reverses both the raw path and the metadata in the [`Self::meta_header`].
///
/// Can panic if the meta header is inconsistent with the encoded path or the encoded path
/// itself is inconsistent (e.g., the `current_info_field` points to an empty segment).
// TODO(jsmith): Check if this panic is actually possible
/// The reversed path is suitable for use from an end-host: its current hop and info field
/// indices are set to 0.
pub fn to_reversed(&self) -> StandardPath<Bytes> {
let mut encoded_path = vec![0u8; self.encoded_path.len()];
let StandardPath { meta_header, .. } = self.reverse_to_slice(&mut encoded_path);
Expand Down

0 comments on commit 33c1a0c

Please sign in to comment.