someip-wire
A no_std Rust crate for parsing and serializing SOME/IP (Scalable service-Oriented MiddlewarE over IP) wire protocol packets.
Based on the AUTOSAR SOME/IP Protocol Specification.
Scope
This crate focuses solely on SOME/IP header parsing and serialization.
The crate parses the standardized 16-byte SOME/IP header and provides the payload data as a raw byte slice. It does NOT parse the payload content itself, as payload format is entirely application-specific and defined by service interface definitions (e.g., FIDL/Franca IDL).
Architecture
To build a complete SOME/IP stack using this crate:
- Use
someip-wireto parse/emit SOME/IP headers (this crate) - Implement payload parsers based on your service interface definitions
- Route messages by connecting service/method IDs to their respective payload handlers
This separation of concerns keeps the crate focused, lightweight, and universally applicable across different SOME/IP service implementations and OEM-specific requirements.
Features
no_stdcompatible - Works in embedded environments- Zero-allocation - All operations work on borrowed data
- Type-safe API - Clean enums for message types and return codes
- Efficient wire format - Direct u8 operations at the packet level
- Two-layer architecture - Low-level packet access + high-level representation
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Examples
Parsing a SOME/IP packet
use Packet;
use Repr;
let buffer = ;
let packet = new_unchecked;
let repr = parse.unwrap;
assert_eq!;
assert_eq!;
// repr.data contains the raw payload bytes - parse based on your service definition
Creating a SOME/IP packet
use Packet;
use Repr;
use ;
let repr = Repr ;
let mut buffer = ;
let mut packet = new_unchecked;
repr.emit;
Note: The data field contains your service-specific payload. You are responsible for serializing/deserializing this based on your service interface definitions.
Working with return codes
use ReturnCode;
// Named return codes
let ok = E_OK;
let timeout = E_TIMEOUT;
// Reserved ranges
let someip_reserved = ReservedSomeIP;
let service_reserved = ReservedServiceMethod;
// Check properties
assert!;
assert!;
Architecture
The crate uses a two-layer architecture:
- Wire format layer (
packetmodule) - Works directly with raw bytes using u8 values for maximum efficiency - Representation layer (
payload,typesmodules) - Provides type-safe enums and structs for ergonomic API
This ensures zero-cost abstractions while maintaining a pleasant developer experience.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.