pub struct CommonHeader {
pub traffic_class: u8,
pub flow_id: u32,
pub next_header: ProtocolNumber,
}Expand description
Represents the common header of a SCION packet
Fields§
§traffic_class: u8Traffic class of the SCION packet
flow_id: u32Flow ID of the SCION packet
next_header: ProtocolNumberNext header type
Indicates the type of header that follows the SCION header. E.g., UDP, TCP, etc.
Implementations§
Source§impl CommonHeader
impl CommonHeader
Sourcepub fn valid(&self) -> Result<(), InvalidStructureError>
pub fn valid(&self) -> Result<(), InvalidStructureError>
Validates that all fields in the CommonHeader are valid for encoding
Sourcepub unsafe fn encode_unchecked(
&self,
buf: &mut [u8],
header_len_units: u8,
path_type: PathType,
dst_addr_type: WireHostAddrType,
src_addr_type: WireHostAddrType,
payload_size: u16,
) -> usize
pub unsafe fn encode_unchecked( &self, buf: &mut [u8], header_len_units: u8, path_type: PathType, dst_addr_type: WireHostAddrType, src_addr_type: WireHostAddrType, payload_size: u16, ) -> usize
Encodes the CommonHeader into the provided buffer
§Safety
- The implementation may use unchecked indexing operations and relies on the caller to
provide a sufficiently large buffer (at least
CommonHeaderLayout::SIZE_BYTESbytes).
Trait Implementations§
Source§impl Clone for CommonHeader
impl Clone for CommonHeader
Source§fn clone(&self) -> CommonHeader
fn clone(&self) -> CommonHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CommonHeader
Source§impl Debug for CommonHeader
impl Debug for CommonHeader
impl Eq for CommonHeader
Source§impl FromView for CommonHeader
impl FromView for CommonHeader
Source§impl Hash for CommonHeader
impl Hash for CommonHeader
Source§impl PartialEq for CommonHeader
impl PartialEq for CommonHeader
impl StructuralPartialEq for CommonHeader
Auto Trait Implementations§
impl Freeze for CommonHeader
impl RefUnwindSafe for CommonHeader
impl Send for CommonHeader
impl Sync for CommonHeader
impl Unpin for CommonHeader
impl UnsafeUnpin for CommonHeader
impl UnwindSafe for CommonHeader
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
Mutably borrows from an owned value. Read more
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
Compare self to
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>
Wrap the input message
T in a tonic::Requestimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<VT> TryFromView for VTwhere
VT: FromView,
impl<VT> TryFromView for VTwhere
VT: FromView,
Source§fn try_from_view(
view: &<VT as TryFromView>::ViewType,
) -> Result<VT, ViewConversionError>
fn try_from_view( view: &<VT as TryFromView>::ViewType, ) -> Result<VT, ViewConversionError>
Attempts to parse a model from the provided view, returning an error if the view is invalid.
Source§type ViewType = <VT as FromView>::ViewType
type ViewType = <VT as FromView>::ViewType
The type of view that can be converted into this model.
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,
Attempts to parse a model from the provided buffer, returning the model and the
remaining buffer on success.