Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ValueError's in writes by introducing more restrictive data types #49

Closed
JulianSchmid opened this issue Dec 31, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JulianSchmid
Copy link
Owner

Currently certain fields in some headers can be filled with invalid data that can not be represented on the wire. An example is the flow_label field in the Ipv6Header. In the struct it currently is an u32 but on the wire it is a 20-bit value. That means you can assign values to the struct that are not representable on the wire. Currently this would trigger a ValueError when writing a header, but it would be nicer if no "invalid" data is even settable in the header in the first place and the actual setting on an invalid data triggers an error.

The idea would be to introduce struct types (e.g. Ipv6FlowLabel) that implements the core::convert::TryFrom trait and disallow setting of invalid values in the first place.

@JulianSchmid JulianSchmid added the enhancement New feature or request label Jan 4, 2023
@JulianSchmid JulianSchmid self-assigned this Apr 12, 2023
@JulianSchmid JulianSchmid added this to the v0.14 milestone Apr 12, 2023
@JulianSchmid
Copy link
Owner Author

Done by #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant