Repository navigation
simple-someip-v0.13.0
Contains a breaking change to the serialization trait surface, so this release
takes the major position under this crate's 0.x convention. As in 0.10.0
through 0.12.0, the version in Cargo.toml is bumped here rather than left
to release-plz so that cargo-semver-checks compares against the version this
change actually lands as.
Breaking — migrate wire encode/decode onto automotive-wire-codec 0.3
The hand-rolled WireFormat trait and its supporting Option-returning
parsers are gone, replaced by the automotive-wire-codec crate's Encode /
Decode / DecodeIter traits. This is a from-scratch rewrite of the
serialization layer's trait surface; on-wire bytes are unchanged (every
golden-bytes test, including under --features server, is green before and
after).
-
WireFormatremoved — replaced byautomotive_wire_codec::Encode.
required_size(&self) -> usizeis nowencoded_size(&self) -> Result<usize, Self::Error>(fallible: some encodings, e.g. SD configuration
strings, can exceed representable bounds).encodekeeps its
embedded_io::Write-based signature. The crate re-exportsEncode(plus
Decode,DecodeIter,DecodeIterator,EncodeToSliceError) from the
crate root.encode_to_sliceis now a codec-provided default method
returningEncodeToSliceErrorinstead ofprotocol::Errordirectly; the
crate-localEncodeExt::encode_to_vec(std-only) extension trait replaces
the old inherent heap-allocating helper. -
Decode via
Decode/DecodeIter.HeaderView,MessageView,
EntryView, andOptionViewnow implement the codec'sDecodetrait, and
service discovery entries/options are exposed as lazyDecodeIterators
(backed by a new lazySdBody) instead of eagerly-materialized
collections.MessageView::decodereturns(value, rest), recovering any
trailing bytes (e.g. the next message in a multi-message datagram); the new
decode_exactis the strict form that errors on trailing bytes instead of
discarding them.HeaderView::parse/SdHeaderView::parseremain as thin
wrappers over theDecodeimpls for source compatibility. -
protocol::Errorreworked.UnexpectedEofis gone. New variants:
Incomplete { needed, available }(buffer too short to decode),Trailing
(unconsumed bytes after a strict decode),InsufficientBuffer { needed, available }(output buffer too small to encode into), and
InvalidLength(u32)(SOME/IPlengthfield below the 8-byte minimum).
sd::Error::IncorrectOptionsSizeis now a struct variant{ needed, available }instead of a tuple/unit variant. -
sd_codecparsers now returnResult, notOption.
parse_someip_datagramandparse_someip_sd_datagramsurface
protocol::Error(distinguishing "too few bytes" / "not an SD message" /
"malformed SD payload" instead of collapsing all three intoNone).
BuildError::BufferTooSmallnow carries the codec'sInsufficientBuffer
(needed/available) instead of being a unit variant. -
PayloadWireFormatgains anEncodesupertrait. The inherent
required_size/encodemethods are gone — implementors get them from
Encodeinstead.from_payload_bytesis unchanged (payloads aren't
self-identifying, so decoding still requires the caller to supply the
MessageId). -
ReadBytesExtremoved. Decode is now fully slice-based
(Decode/DecodeIterviatake/ensure_len), leaving the
embedded_io::Read-backedReadBytesExttrait with no remaining callers.
It has been deleted along with its blanket impl and unit tests.
WriteBytesExtis unaffected and remains available. -
New dependency:
automotive-wire-codec = "0.3". -
Robustness fix: SOME/IP datagrams with
length < 8are now rejected
withError::InvalidLengthinstead of risking an arithmetic-underflow
panic when computingpayload_size(length - 8). -
Options::writeremoved. It was apubinherent method on
sd::Options; the equivalent is now theEncode::encodetrait method, so
callers needuse automotive_wire_codec::Encode(or the crate-root
re-export) in scope. Nothing else changes — the bytes written are identical. -
ServiceEntry::required_size()/EventGroupEntry::required_size()
returned 16 but wrote 15 bytes. Their replacementencoded_size()
returnsOk(15), which is whatencodeactually writes. The 16 belongs to
the enclosingEntry(1 type byte + 15 body bytes =ENTRY_SIZE), and
these two body types had inherited it. Anyone who sized a buffer from
required_size()on these types gets a different number now; it is the
correct one, and this is a latent-bug fix rather than a rename. -
Message::new_sdreturnsResult<Self, Error>. It previously
swallowed a failedSdHeader::encoded_size()withunwrap_or(0), building
a header that declared the bare 8-byte SD length whileencodewent on to
write the full payload. Receivers truncate at the declared length, so the
failure mode was silent wire corruption rather than an error. No in-tree SD
header can fail —sd::Header::encoded_sizeis unconditionallyOk— so
in-tree callers only gain a?or anexpect. -
PayloadWireFormat::SdHeaderis boundedEncode<Error = protocol::Error>. This matches the bound the trait already places on
Selfand is what makes the error above nameable and therefore
propagatable. Every concreteSdHeaderalready usedprotocol::Error, so
in-tree this is a no-op; a downstream implementor with a different error
type must change it. -
BuildError::ListFull { needed, capacity }added. A fixed-capacity
entry/option list overflow used to be reported as
BufferTooSmall(InsufficientBuffer { .. }), whose fields are documented in
bytes — it was putting element counts in them. The path is unreachable
(take(N)bounds the loop), but the error would have been actively
misleading if it ever fired. Exhaustive matches onBuildErrorneed a new
arm. -
Under-length SD options are rejected instead of panicking.
OptionView::decoderequired a 4-byte option header but then took
length + 3bytes, so a declaredlengthbelow 1 produced a view shorter
than the header it had just insisted on, and the accessors indexed it
unconditionally: option bytes00 02 04 00 00panicked inas_ipv4via
to_owned, and a zero-length Configuration option panicked in
configuration_bytes.decodenow rejects a wire size below the option
header, andas_ipv4/as_ipv6/as_load_balancingcheck their own span
before indexing, returningIncorrectOptionsSize. The crate's own paths
went throughSdHeaderView::parse, whose eagervalidate()walk already
rejected these, so this was not reachable viaparse_someip_sd_datagram—
but the lazySdBody/Decodesurface the docs point at is public.