Skip to main content

Crate simple_someip

Crate simple_someip 

Source
Expand description

§Simple SOME/IP

CI Coverage Crates.io

A Rust implementation of the SOME/IP automotive communication protocol — remote procedure calls, event notifications, service discovery, and wire-format serialization.

The core protocol layer (protocol, e2e, and trait modules) is no_std-compatible with zero heap allocation, making it suitable for embedded targets. Optional client and server modules provide async tokio-based networking for std environments.

§Modules

Moduleno_stdDescription
protocolYesWire format: headers, messages, message types, return codes, and service discovery (SD) entries/options
e2eYesEnd-to-End protection — Profile 4 (CRC-32) and Profile 5 (CRC-16)
WireFormat / PayloadWireFormatYesTraits for serializing messages and defining custom payload types
[client]NoAsync tokio client — service discovery, subscriptions, and request/response (feature client)
[server]NoAsync tokio server — service offering, event publishing, and subscription management (feature server)

§Feature Flags

FeatureDefaultDescription
clientnoAsync tokio client; implies std + tokio + socket2
servernoAsync tokio server; implies std + tokio + socket2
stdnoEnables std-dependent helpers

By default only the protocol, trait, and e2e modules are compiled, and the crate builds in no_std mode with no allocator requirement.

§Examples

§Encoding a SOME/IP-SD header (no_std)

use simple_someip::WireFormat;
use simple_someip::protocol::sd::{self, Entry, ServiceEntry};

// Build an SD header with a FindService entry
let entries = [Entry::FindService(ServiceEntry::find(0x1234))];
let sd_header = sd::Header::new(sd::Flags::new_sd(false), &entries, &[]);

// Encode to bytes
let mut buf = [0u8; 64];
let n = sd_header.encode(&mut buf.as_mut_slice()).unwrap();

// Decode from bytes (zero-copy view)
let view = sd::SdHeaderView::parse(&buf[..n]).unwrap();
assert_eq!(view.entry_count(), 1);

§References

Modules§

e2e
End-to-end (E2E) protection utilities for SOME/IP payloads. E2E (End-to-End) protection for SOME/IP payloads.
protocol
SOME/IP protocol primitives: headers, messages, return codes, and service discovery.

Traits§

PayloadWireFormat
A trait for SOME/IP Payload types that can be serialized to a Writer and constructed from raw payload bytes.
WireFormat
A trait for types that can be serialized to a Writer.