[][src]Crate someip_parse

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.2.0"

Example

examples/print_messages.rs:

use someip_parse::SliceIterator;
 
//trying parsing some ip messages located in a udp payload
for someip_message in SliceIterator::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)
    }
}

Todo

  • Example how to serialize someip packets
  • SOMEIP Service Discovery Message Parsing

References

Structs

SliceIterator

Allows iterating over the someip messages in a udp or tcp payload.

SomeIpHeader

SOMEIP header (including tp header if present).

SomeIpHeaderSlice

A slice containing an some ip header & payload of that message.

TpHeader

Additional header when a packet contains a TP header (transporting large SOME/IP messages).

Enums

MessageType

Message types of a SOME/IP message.

ReadError

Errors that can occur when reading someip headers.

ReturnCode

Return code contained in a SOME/IP header.

ValueError

Range errors in fields of the someip & tp header struct. These can occur when serializing or modifying an error.

WriteError

Errors that can occur when serializing a someip & tp header.

Constants

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_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.