Skip to content

Conversation

@theswiftfox
Copy link
Contributor

@theswiftfox theswiftfox commented Jun 26, 2025

similar to samp-reston/doip-definitions#29 this PR introduces the feature to split up python bindings from std.
Additionally the codec can now handle incomplete packages where the header.payload_length doesn't match the actual received package and ensures that src.advance does not try to advance more bytes than present.

Still a draft as the dependency has to be changed to the upstream again, once the PR in doip-definitions is merged :)

Elena Gantner [email protected] on behalf of Mercedes-Benz Tech Innovation GmbH
Provider Information

 - introduce python-bindings feature to enable bindings.
   this will activate the python-bindings feature in
   doip-definitions

Signed-of-by: Elena Gantner <[email protected]>
 - ensure that src.advance at most advances the remaining bytes
   in case of an incomplete message
 - fix small bug in creating payload slice calculation

Signed-of-by: Elena Gantner <[email protected]>
Comment on lines +197 to +203
let cnt = DOIP_HEADER_LEN + (header.payload_length as usize);
let advance_length = if src.remaining() >= cnt {
cnt
} else {
src.len()
};
src.advance(advance_length);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot

@theswiftfox
Copy link
Contributor Author

theswiftfox commented Jun 26, 2025

Should I use the upstream git rev of samp-reston/doip-definitions, or do you plan on a version bump on crates.io? (if so, I'd wait and change the rev to that version :) )

Edit: NVM, just saw the commit in doip-definitions

 - update std feature to also set the feature in
   doip-definitions dependency

Signed-of-by: Elena Gantner <[email protected]>
@theswiftfox theswiftfox marked this pull request as ready for review June 26, 2025 09:15
@theswiftfox
Copy link
Contributor Author

@samp-reston I updated the dependencies to the latest doip-definitions crate

@samp-reston samp-reston merged commit 48448fb into samp-reston:main Jun 26, 2025
1 check passed
@samp-reston
Copy link
Owner

Very good thank you for your contributions, feel free to create PRs too in future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants