Skip to main content

ScionPacketHeader

Struct ScionPacketHeader 

Source
pub struct ScionPacketHeader {
    pub common: CommonHeader,
    pub address: AddressHeader,
    pub path: DpPath,
}
Expand description

Represents a SCION packet header

This structure contains all the fields of a SCION packet header, including the common header, address header, and path information.

Fields§

§common: CommonHeader

The common header of the SCION packet

§address: AddressHeader

The address header of the SCION packet

§path: DpPath

The path information of the SCION packet

Implementations§

Source§

impl ScionPacketHeader

Source

pub fn required_size(&self) -> usize

Returns the size required for the wire encoding.

§Safety

This size must be correct, it is used to validate buffer sizes in encode. If this size is smaller than the actual encoded size, undefined behavior will occur.

Source

pub fn wire_valid(&self) -> Result<(), InvalidStructureError>

Validates that all fields in the structure are valid for encoding.

Note: This only checks the minimal set of fields required for encoding, do not expect comprehensive validation.

Returns Ok(()) if valid, otherwise a static error reference.

Source

pub unsafe fn encode_unchecked( &self, buf: &mut [u8], payload_size: u16, ) -> usize

Writes the wire encoding into the provided buffer.

Returns the number of bytes written.

§SAFETY
  1. The buffer must be at least self.required_size() bytes long
  2. The structure must be valid for encoding, i.e., self.valid() must return Ok(())
Source

pub fn try_encode( &self, buf: &mut [u8], payload_size: u16, ) -> Result<usize, EncodeError>

Writes the wire encoding into the provided buffer.

Returns the number of bytes written on success, or Err(usize) of the required size if the buffer is too small or the packet.

The buffer must be at least self.required_size() bytes long.

Trait Implementations§

Source§

impl Arbitrary for ScionPacketHeader

Source§

type Parameters = ArbitraryScionPacketHeaderParams

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = BoxedStrategy<ScionPacketHeader>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with(params: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
Source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl Clone for ScionPacketHeader

Source§

fn clone(&self) -> ScionPacketHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScionPacketHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ScionPacketHeader

Source§

impl Hash for ScionPacketHeader

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ScionPacketHeader

Source§

fn eq(&self, other: &ScionPacketHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScionPacketHeader

Source§

impl TryFromView for ScionPacketHeader

Source§

type ViewType = ScionHeaderView

The type of view that can be converted into this model.
Source§

fn try_from_view(view: &Self::ViewType) -> Result<Self, ViewConversionError>

Attempts to parse a model from the provided view, returning an error if the view is invalid.
Source§

fn try_from_slice<'buf>( buf: &'buf [u8], ) -> Result<(Self, &'buf [u8]), ViewConversionError>
where <Self as TryFromView>::ViewType: 'buf,

Attempts to parse a model from the provided buffer, returning the model and the remaining buffer on success.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToValue for T
where T: Arbitrary,

Source§

type Params = <T as Arbitrary>::Parameters

The parameters for generating arbitrary values of type T.
Source§

fn arbitrary_value(seed: u128) -> T

Generates an arbitrary value of type T using the given seed.
Source§

fn arbitrary_value_with(params: <T as ToValue>::Params, seed: u128) -> T

Generates an arbitrary value of type T using the given parameters and seed.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more