Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5fe5d04
chore: add automotive-wire-codec 0.3 dep and reconcile migration plan
zheylmun Jul 17, 2026
a52f9d6
test: pin golden wire-format byte snapshots (Phase 0)
zheylmun Jul 17, 2026
9caccf5
refactor(protocol): widen Error to carry automotive-wire-codec fragments
zheylmun Jul 17, 2026
d74074e
feat!: replace WireFormat trait with codec Encode (Phase 2)
zheylmun Jul 17, 2026
58dc9c3
fix: update server-tokio test helpers to use Options::encode
zheylmun Jul 17, 2026
8c5bb20
feat(protocol): add codec Decode impls for HeaderView and MessageView
zheylmun Jul 17, 2026
fdfc54f
feat(sd): add lazy Decode/DecodeIter for EntryView and OptionView
zheylmun Jul 17, 2026
a4f361e
feat(sd): add lazy SdBody and unify SdHeaderView::parse slicing
zheylmun Jul 17, 2026
5b984e4
fix: guard against SOME/IP length < 8 underflow in decode path
zheylmun Jul 17, 2026
cfa41d1
refactor(sd): rebuild SdHeaderView as L2 over lazy L1 (Phase 4)
zheylmun Jul 17, 2026
08ba3e1
refactor!: make Encode a supertrait of PayloadWireFormat
zheylmun Jul 17, 2026
a7aad7f
refactor!: header-first SD builders, BuildError bridge, Result parsers
zheylmun Jul 17, 2026
dc02192
feat(e2e): bridge e2e::Error onto protocol::Error, document intention…
zheylmun Jul 17, 2026
4c90caa
docs: Phase 7 cleanup — sweep WireFormat prose, tighten tests, add 0.…
zheylmun Jul 17, 2026
870ad3f
refactor: remove dead ReadBytesExt trait and fix stale golden-test do…
zheylmun Jul 17, 2026
1a6fc0e
fix: reconcile client-tokio test with codec Encode API after main rebase
zheylmun Jul 17, 2026
6baa291
chore: clear branch-introduced clippy warnings after rebase
zheylmun Aug 24, 2026
a917c80
fix: repair CI lanes the local check matrix missed
zheylmun Aug 24, 2026
1e6ea49
docs(license): add the MIT and Apache-2.0 license texts
JustinKovacich Sep 10, 2026
1d726d7
fix(sd): reject under-length options instead of indexing past the view
JustinKovacich Sep 10, 2026
78cbe92
fix(protocol)!: propagate a failing encoded_size instead of masking it
JustinKovacich Sep 10, 2026
fe32ff8
fix(sd_codec)!: report a full list in elements, not as a byte count
JustinKovacich Sep 10, 2026
59b6c0f
docs(changelog): record the breaking changes the 0.13.0 entry omitted
JustinKovacich Sep 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,125 @@
# Changelog

## [0.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).

- **`WireFormat` removed — replaced by `automotive_wire_codec::Encode`.**
`required_size(&self) -> usize` is now `encoded_size(&self) ->
Result<usize, Self::Error>` (fallible: some encodings, e.g. SD configuration
strings, can exceed representable bounds). `encode` keeps its
`embedded_io::Write`-based signature. The crate re-exports `Encode` (plus
`Decode`, `DecodeIter`, `DecodeIterator`, `EncodeToSliceError`) from the
crate root. `encode_to_slice` is now a codec-provided default method
returning `EncodeToSliceError` instead of `protocol::Error` directly; the
crate-local `EncodeExt::encode_to_vec` (std-only) extension trait replaces
the old inherent heap-allocating helper.

- **Decode via `Decode` / `DecodeIter`.** `HeaderView`, `MessageView`,
`EntryView`, and `OptionView` now implement the codec's `Decode` trait, and
service discovery entries/options are exposed as lazy `DecodeIterator`s
(backed by a new lazy `SdBody`) instead of eagerly-materialized
collections. `MessageView::decode` returns `(value, rest)`, recovering any
trailing bytes (e.g. the next message in a multi-message datagram); the new
`decode_exact` is the strict form that errors on trailing bytes instead of
discarding them. `HeaderView::parse` / `SdHeaderView::parse` remain as thin
wrappers over the `Decode` impls for source compatibility.

- **`protocol::Error` reworked.** `UnexpectedEof` is 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/IP `length` field below the 8-byte minimum).
`sd::Error::IncorrectOptionsSize` is now a struct variant `{ needed,
available }` instead of a tuple/unit variant.

- **`sd_codec` parsers now return `Result`, not `Option`.**
`parse_someip_datagram` and `parse_someip_sd_datagram` surface
`protocol::Error` (distinguishing "too few bytes" / "not an SD message" /
"malformed SD payload" instead of collapsing all three into `None`).
`BuildError::BufferTooSmall` now carries the codec's `InsufficientBuffer`
(`needed` / `available`) instead of being a unit variant.

- **`PayloadWireFormat` gains an `Encode` supertrait.** The inherent
`required_size` / `encode` methods are gone — implementors get them from
`Encode` instead. `from_payload_bytes` is unchanged (payloads aren't
self-identifying, so decoding still requires the caller to supply the
`MessageId`).

- **`ReadBytesExt` removed.** Decode is now fully slice-based
(`Decode`/`DecodeIter` via `take`/`ensure_len`), leaving the
`embedded_io::Read`-backed `ReadBytesExt` trait with no remaining callers.
It has been deleted along with its blanket impl and unit tests.
`WriteBytesExt` is unaffected and remains available.

- **New dependency:** `automotive-wire-codec = "0.3"`.

- **Robustness fix:** SOME/IP datagrams with `length < 8` are now rejected
with `Error::InvalidLength` instead of risking an arithmetic-underflow
panic when computing `payload_size` (`length - 8`).

- **`Options::write` removed.** It was a `pub` inherent method on
`sd::Options`; the equivalent is now the `Encode::encode` trait method, so
callers need `use 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 replacement `encoded_size()`
returns `Ok(15)`, which is what `encode` actually writes. The 16 belongs to
the enclosing `Entry` (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_sd` returns `Result<Self, Error>`.** It previously
swallowed a failed `SdHeader::encoded_size()` with `unwrap_or(0)`, building
a header that declared the bare 8-byte SD length while `encode` went 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_size` is unconditionally `Ok` — so
in-tree callers only gain a `?` or an `expect`.

- **`PayloadWireFormat::SdHeader` is bounded `Encode<Error =
protocol::Error>`.** This matches the bound the trait already places on
`Self` and is what makes the error above nameable and therefore
propagatable. Every concrete `SdHeader` already used `protocol::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 on `BuildError` need a new
arm.

- **Under-length SD options are rejected instead of panicking.**
`OptionView::decode` required a 4-byte option header but then took
`length + 3` bytes, so a declared `length` below 1 produced a view shorter
than the header it had just insisted on, and the accessors indexed it
unconditionally: option bytes `00 02 04 00 00` panicked in `as_ipv4` via
`to_owned`, and a zero-length Configuration option panicked in
`configuration_bytes`. `decode` now rejects a wire size below the option
header, and `as_ipv4` / `as_ipv6` / `as_load_balancing` check their own span
before indexing, returning `IncorrectOptionsSize`. The crate's own paths
went through `SdHeaderView::parse`, whose eager `validate()` walk already
rejected these, so this was not reachable via `parse_someip_sd_datagram` —
but the lazy `SdBody` / `Decode` surface the docs point at is public.

## [0.12.0]

Contains a breaking change to the public error enums, so this release takes the
Expand Down
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exclude = ["tools/size_probe"]

[package]
name = "simple-someip"
version = "0.12.0"
version = "0.13.0"
Comment thread
zheylmun marked this conversation as resolved.
edition = "2024"
license = "MIT OR Apache-2.0"
Comment thread
JustinKovacich marked this conversation as resolved.
description = "A lightweight SOME/IP serialization and communication library"
Expand All @@ -48,6 +48,9 @@ embassy-sync = { version = "0.6", optional = true }
embassy-executor = { version = "0.6", default-features = false, features = [
"nightly",
], optional = true }
# L0 shared wire-codec traits (Decode/DecodeIter/Encode) and big-endian leaf
# helpers. `no_std`, no-alloc; shares `embedded-io = "0.7"` with this crate.
automotive-wire-codec = "0.3"
embedded-io = { version = "0.7" }
# `futures` pulls in `futures-util` which provides the executor-agnostic
# `select!` macro and `FutureExt::fuse` / `pin_mut!` helpers — used by
Expand Down
176 changes: 176 additions & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
23 changes: 23 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The library supports both `std` and `no_std` environments, making it suitable fo
## Modules

- `protocol` — Wire format layer: SOME/IP header, `MessageId`, `MessageType`, `ReturnCode`, SD entries/options
- `traits` — `WireFormat` and `PayloadWireFormat` traits for custom message types
- `traits` — `PayloadWireFormat` trait (built on `automotive_wire_codec::Encode`) for custom message types
- `transport` — Executor-agnostic UDP socket / factory / timer / spawner traits (no_std-compatible)
- `e2e` — End-to-End protection profiles (always available, no heap allocation)
- `tokio_transport` — Default `std + tokio` impls of the transport traits (requires `feature = "client-tokio"` or `feature = "server-tokio"`)
Expand Down
Loading
Loading