someip_wire/
field.rs

1#![allow(non_snake_case)]
2
3#![allow(dead_code)]
4
5pub type Field = ::core::ops::Range<usize>;
6pub mod header {
7    use crate::field::Field;
8
9    pub const MESSAGE_ID: Field = 0..4;
10    pub const LENGTH: Field = 4..8;
11    pub const REQUEST_ID: Field = 8..12;
12    pub const PROTOCOL_VERSION: Field = 12..13;
13    pub const INTERFACE_VERSION: Field = 13..14;
14    pub const MESSAGE_TYPE: Field = 14..15;
15    pub const RETURN_CODE: Field = 15..16;
16
17    /// Get the payload field range given the length of the payload data
18    pub const fn payload(length: usize) -> Field {
19        RETURN_CODE.end..(RETURN_CODE.end + length)
20    }
21
22    /// Length of the SOME/IP header (16 bytes, excluding payload)
23    pub const HEADER_LENGTH: usize = RETURN_CODE.end;
24}