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: CommonHeaderThe common header of the SCION packet
address: AddressHeaderThe address header of the SCION packet
path: DpPathThe path information of the SCION packet
Implementations§
Source§impl ScionPacketHeader
impl ScionPacketHeader
Sourcepub fn required_size(&self) -> usize
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.
Sourcepub fn wire_valid(&self) -> Result<(), InvalidStructureError>
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.
Sourcepub unsafe fn encode_unchecked(
&self,
buf: &mut [u8],
payload_size: u16,
) -> usize
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
- The buffer must be at least
self.required_size()bytes long - The structure must be valid for encoding, i.e.,
self.valid()must returnOk(())
Sourcepub fn try_encode(
&self,
buf: &mut [u8],
payload_size: u16,
) -> Result<usize, EncodeError>
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
impl Arbitrary for ScionPacketHeader
Source§type Parameters = ArbitraryScionPacketHeaderParams
type Parameters = ArbitraryScionPacketHeaderParams
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<ScionPacketHeader>
type Strategy = BoxedStrategy<ScionPacketHeader>
Strategy used to generate values of type Self.Source§fn arbitrary_with(params: Self::Parameters) -> Self::Strategy
fn arbitrary_with(params: Self::Parameters) -> Self::Strategy
Source§impl Clone for ScionPacketHeader
impl Clone for ScionPacketHeader
Source§fn clone(&self) -> ScionPacketHeader
fn clone(&self) -> ScionPacketHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScionPacketHeader
impl Debug for ScionPacketHeader
impl Eq for ScionPacketHeader
Source§impl Hash for ScionPacketHeader
impl Hash for ScionPacketHeader
Source§impl PartialEq for ScionPacketHeader
impl PartialEq for ScionPacketHeader
impl StructuralPartialEq for ScionPacketHeader
Source§impl TryFromView for ScionPacketHeader
impl TryFromView for ScionPacketHeader
Source§type ViewType = ScionHeaderView
type ViewType = ScionHeaderView
Source§fn try_from_view(view: &Self::ViewType) -> Result<Self, ViewConversionError>
fn try_from_view(view: &Self::ViewType) -> Result<Self, ViewConversionError>
Source§fn try_from_slice<'buf>(
buf: &'buf [u8],
) -> Result<(Self, &'buf [u8]), ViewConversionError>where
<Self as TryFromView>::ViewType: 'buf,
fn try_from_slice<'buf>(
buf: &'buf [u8],
) -> Result<(Self, &'buf [u8]), ViewConversionError>where
<Self as TryFromView>::ViewType: 'buf,
Auto Trait Implementations§
impl Freeze for ScionPacketHeader
impl RefUnwindSafe for ScionPacketHeader
impl Send for ScionPacketHeader
impl Sync for ScionPacketHeader
impl Unpin for ScionPacketHeader
impl UnsafeUnpin for ScionPacketHeader
impl UnwindSafe for ScionPacketHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Requestimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToValue for Twhere
T: Arbitrary,
impl<T> ToValue for Twhere
T: Arbitrary,
Source§type Params = <T as Arbitrary>::Parameters
type Params = <T as Arbitrary>::Parameters
T.Source§fn arbitrary_value(seed: u128) -> T
fn arbitrary_value(seed: u128) -> T
T using the given seed.