pub struct Header { /* private fields */ }Expand description
SOME/IP header
Implementations§
Source§impl Header
impl Header
Sourcepub const fn message_id(&self) -> MessageId
pub const fn message_id(&self) -> MessageId
Returns the message ID (service ID + method ID).
Sourcepub const fn request_id(&self) -> u32
pub const fn request_id(&self) -> u32
Returns the request ID (client ID + session ID).
Sourcepub const fn protocol_version(&self) -> u8
pub const fn protocol_version(&self) -> u8
Returns the protocol version.
Sourcepub const fn interface_version(&self) -> u8
pub const fn interface_version(&self) -> u8
Returns the interface version.
Sourcepub const fn message_type(&self) -> MessageTypeField
pub const fn message_type(&self) -> MessageTypeField
Returns the message type field.
Sourcepub const fn return_code(&self) -> ReturnCode
pub const fn return_code(&self) -> ReturnCode
Returns the return code.
Sourcepub const fn upper_header_bytes(&self) -> [u8; 8]
pub const fn upper_header_bytes(&self) -> [u8; 8]
Return the 8-byte “upper header” used by E2E UPPER-HEADER-BITS-TO-SHIFT.
Layout (big-endian): request_id(4) + protocol_version(1) + interface_version(1)
+ message_type(1) + return_code(1)
Note: request_id is the full 4-byte SOME/IP Request ID field
(Client ID [31:16] + Session ID [15:0]), not just the 2-byte Session ID.
Sourcepub const fn from_fields(
message_id: MessageId,
length: u32,
request_id: u32,
protocol_version: u8,
interface_version: u8,
message_type: MessageTypeField,
return_code: ReturnCode,
) -> Self
pub const fn from_fields( message_id: MessageId, length: u32, request_id: u32, protocol_version: u8, interface_version: u8, message_type: MessageTypeField, return_code: ReturnCode, ) -> Self
Creates a header from raw field values.
Unlike new, the length field is taken directly rather
than being computed from a payload size. This is the inverse of the
accessor methods and is useful for FFI or any context where the caller
already has the raw on-wire field values.
Sourcepub const fn new(
message_id: MessageId,
request_id: u32,
protocol_version: u8,
interface_version: u8,
message_type: MessageTypeField,
return_code: ReturnCode,
payload_len: usize,
) -> Self
pub const fn new( message_id: MessageId, request_id: u32, protocol_version: u8, interface_version: u8, message_type: MessageTypeField, return_code: ReturnCode, payload_len: usize, ) -> Self
Sourcepub const fn new_sd(request_id: u32, sd_header_size: usize) -> Self
pub const fn new_sd(request_id: u32, sd_header_size: usize) -> Self
Creates a new SOME/IP-SD header with standard SD field values.
§Panics
Panics if sd_header_size exceeds u32::MAX - 8.
Sourcepub const fn new_event(
service_id: u16,
event_id: u16,
request_id: u32,
protocol_version: u8,
interface_version: u8,
payload_len: usize,
) -> Self
pub const fn new_event( service_id: u16, event_id: u16, request_id: u32, protocol_version: u8, interface_version: u8, payload_len: usize, ) -> Self
Creates a new header for a SOME/IP event notification.
§Panics
Panics if payload_len exceeds u32::MAX - 8.
Sourcepub const fn payload_size(&self) -> usize
pub const fn payload_size(&self) -> usize
Returns the payload size in bytes (length - 8).
Sourcepub const fn set_request_id(&mut self, request_id: u32)
pub const fn set_request_id(&mut self, request_id: u32)
Sets the request ID field.