SomeipHeader

Struct SomeipHeader 

Source
pub struct SomeipHeader {
    pub message_id: u32,
    pub length: u32,
    pub request_id: u32,
    pub interface_version: u8,
    pub message_type: MessageType,
    pub return_code: u8,
    pub tp_header: Option<TpHeader>,
}
Expand description

SOMEIP header (including tp header if present).

Fields§

§message_id: u32§length: u32§request_id: u32§interface_version: u8§message_type: MessageType

Message type (does not contain the tp flag, this is determined if something is present in the tp_header field).

§return_code: u8§tp_header: Option<TpHeader>

Contains a tp header (Transporting large SOME/IP messages of UDP [SOME/IP-TP]).

If there is a tp header a someip payload is split over multiple messages and the tp header contains the start offset of the payload of this message relative to the completly assembled payload.

Implementations§

Source§

impl SomeipHeader

Source

pub fn new_sd_header( length: u32, session_id: u16, tp_header: Option<TpHeader>, ) -> Self

Create a service discovery message header.

Source

pub fn service_id(&self) -> u16

Returns the service id (first 16 bits of the message id)

Source

pub fn set_service_id(&mut self, service_id: u16)

Set the servide id (first 16 bits of the message id)

Source

pub fn set_event_id(&mut self, event_id: u16)

Set the event id + the event bit.

Source

pub fn set_method_id(&mut self, method_id: u16)

Set the event id + the event bit to 0. Asserting method_id <= 0x7FFF (otherwise the )

Source

pub fn set_method_or_event_id(&mut self, method_id: u16)

Sets the event id or method id. This number mjust include the “event bit”.

Source

pub fn is_someip_sd(&self) -> bool

Returns true if the message has the message id of a some ip service discovery message.

Source

pub fn is_event(&self) -> bool

Returns true if the event or notification bit in the message id is set

Source

pub fn event_or_method_id(&self) -> u16

Return the event id or method id. This number includes the “event bit”.

Source

pub fn event_id(&self) -> Option<u16>

Return the event id. None if event bit is not set.

Source

pub fn method_id(&self) -> Option<u16>

Return the method id. None if event bit is set.

Source

pub fn write_raw<T: Write>(&self, writer: &mut T) -> Result<(), Error>

Serialize the header.

Source

pub fn base_to_bytes(&self) -> [u8; 16]

Returns the encoded SOMEIP header (without the TP header).

Source

pub fn read<T: Read>( reader: &mut T, ) -> Result<SomeipHeader, SomeipHeaderReadError>

Read a header from a byte stream.

Trait Implementations§

Source§

impl Clone for SomeipHeader

Source§

fn clone(&self) -> SomeipHeader

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SomeipHeader

Source§

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

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

impl Default for SomeipHeader

Source§

fn default() -> SomeipHeader

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SomeipHeader

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SomeipHeader

Source§

impl StructuralPartialEq for SomeipHeader

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.