Expand description
A Rust library for parsing the SOME/IP network protocol (without payload interpretation).
§Usage
Add the following to your Cargo.toml
:
[dependencies]
someip_parse = "0.6.1"
§Example
use someip_parse::SomeipMsgsIterator;
//trying parsing some ip messages located in a udp payload
for someip_message in SomeipMsgsIterator::new(&udp_payload) {
match someip_message {
Ok(value) => {
if value.is_someip_sd() {
println!("someip service discovery packet");
} else {
println!("0x{:x} (service id: 0x{:x}, method/event id: 0x{:x})",
value.message_id(),
value.service_id(),
value.event_or_method_id());
}
println!(" with payload {:?}", value.payload())
},
Err(_) => {} //error reading a someip packet (based on size, protocol version value or message type value)
}
}
§References
- AUTOSAR Foundation (contains SOMEIP Protocol Specification & SOME/IP Service Discovery Protocol Specification)
- SOME/IP Protocol Specification R22-11
- SOME/IP Service Discovery Protocol Specification R22-11
Modules§
- err
- Error types of someip_parse.
- sd_
entries - Constants related to sd entries.
- sd_
flags - Constants related to the flags in the sd header
- sd_
options - Constants related to sd options.
Structs§
- SdHeader
- SOMEIP service discovery header
- SdHeader
Flags - Flags at the start of a SOMEIP service discovery header.
- Someip
Header - SOMEIP header (including tp header if present).
- Someip
MsgSlice - A slice containing an some ip header & payload of that message.
- Someip
Msgs Iterator - Allows iterating over the someip messages in a udp or tcp payload.
- TpBuf
- Buffer to reconstruct one SOMEIP TP packet stream without checks that the message id & request id are the same for all packets (this has to be done by the caller).
- TpBuf
Config - Configuration of a TP buffers maximum allowed size and initial allocated buffer size.
- TpHeader
- Additional header when a packet contains a TP header (transporting large SOME/IP messages).
- TpPool
- Pool of buffers to reconstruct multiple SOMEIP TP packet streams in parallel (re-uses buffers to minimize allocations).
- TpRange
- Describing the range of received data in an TP stream.
Enums§
- Message
Type - Message types of a SOME/IP message.
- Return
Code - Return code contained in a SOME/IP header.
- SdEntry
- SdEvent
Group Entry Type - SdOption
- SdOption
Type - SdService
Entry Type - Transport
Protocol - Protocol numbers based on IANA/IETF
Constants§
- EVENT_
ENTRY_ INITIAL_ DATA_ REQUESTED_ FLAG - MIN_
SD_ HEADER_ LENGTH - Length of someip sd header, flags + reserved + entries length + options length excluding entries and options arrays
- SOMEIP_
HEADER_ LENGTH - Length of a someip header.
- SOMEIP_
HEADER_ MESSAGE_ TYPE_ TP_ FLAG - Flag in the message type field marking the package a as tp message (transporting large SOME/IP messages of UDP).
- SOMEIP_
LEN_ OFFSET_ TO_ PAYLOAD - Offset that must be substracted from the length field to determine the length of the actual payload.
- SOMEIP_
MAX_ PAYLOAD_ LEN - Maximum payload length supported by some ip. This is NOT the maximum length that is supported when sending packets over UDP. This constant is based on the limitation of the length field data type (uint32).
- SOMEIP_
MAX_ PAYLOAD_ LEN_ UDP - The maximum payload size of an SOMEIP UDP message.
- SOMEIP_
PROTOCOL_ VERSION - The currently supported protocol version.
- SOMEIP_
SD_ MESSAGE_ ID - Message id of SOMEIP service discovery messages
- TP_
HEADER_ LENGTH - Length of the tp header that follows a someip header if a someip packet has been flaged as tp.
- TP_
UDP_ MAX_ SEGMENT_ LEN - Maximum allowed TP segment length.
- TP_
UDP_ MAX_ SEGMENT_ LEN_ ALIGNED - Maximum allowed TP aligned segment length.
Type Aliases§
- Slice
Iterator Deprecated - Deprecated use
SomeipMsgsIterator
instead. - Some
IpHeader Deprecated - Deprecated use
SomeipHeader
instead. - Some
IpHeader Slice Deprecated - Deprecated use
SomeipMsgSlice
instead.