| Crates.io | someip-wire |
| lib.rs | someip-wire |
| version | 0.1.1 |
| created_at | 2025-11-15 11:05:20.556223+00 |
| updated_at | 2025-11-15 18:15:27.118942+00 |
| description | A no_std SOME/IP wire protocol parser and serializer with zero-allocation design |
| homepage | |
| repository | https://github.com/martinpalsson/someip-wire |
| max_upload_size | |
| id | 1934251 |
| size | 75,623 |
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.
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).
To build a complete SOME/IP stack using this crate:
someip-wire to parse/emit SOME/IP headers (this crate)This separation of concerns keeps the crate focused, lightweight, and universally applicable across different SOME/IP service implementations and OEM-specific requirements.
no_std compatible - Works in embedded environmentsAdd this to your Cargo.toml:
[dependencies]
someip-wire = "0.1.0"
use someip_wire::packet::Packet;
use someip_wire::payload::Repr;
let buffer = [
0x12, 0x34, 0x00, 0x01, // Message ID
0x00, 0x00, 0x00, 0x08, // Length
0x00, 0x01, 0x00, 0x00, // Request ID
0x01, // Protocol version
0x01, // Interface version
0x00, // Message type (Request)
0x00, // Return code (E_OK)
// Payload data
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
];
let packet = Packet::new_unchecked(&buffer);
let repr = Repr::parse(&packet).unwrap();
assert_eq!(repr.protocol_version, 0x01);
assert_eq!(repr.data.len(), 8);
// repr.data contains the raw payload bytes - parse based on your service definition
use someip_wire::packet::Packet;
use someip_wire::payload::Repr;
use someip_wire::types::{MessageId, RequestId, ClientId, MessageType, ReturnCode};
let repr = Repr {
message_id: MessageId {
service_id: 0x1234,
method_id: 0x0001,
},
length: 8,
request_id: RequestId {
client_id: ClientId {
client_id_prefix: 0x00,
client_id: 0x01,
},
session_id: 0x0000,
},
protocol_version: 0x01,
interface_version: 0x01,
message_type: MessageType::Response,
return_code: ReturnCode::E_OK,
data: &[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], // Your serialized payload
};
let mut buffer = [0u8; 24];
let mut packet = Packet::new_unchecked(&mut buffer);
repr.emit(&mut packet);
Note: The data field contains your service-specific payload. You are responsible for serializing/deserializing this based on your service interface definitions.
use someip_wire::types::ReturnCode;
// Named return codes
let ok = ReturnCode::E_OK;
let timeout = ReturnCode::E_TIMEOUT;
// Reserved ranges
let someip_reserved = ReturnCode::ReservedSomeIP(0x15);
let service_reserved = ReturnCode::ReservedServiceMethod(0x30);
// Check properties
assert!(ok.is_ok());
assert!(someip_reserved.is_reserved_someip());
The crate uses a two-layer architecture:
packet module) - Works directly with raw bytes using u8 values for maximum efficiencypayload, types modules) - Provides type-safe enums and structs for ergonomic APIThis ensures zero-cost abstractions while maintaining a pleasant developer experience.
Licensed under either of:
at your option.
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.