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

Support partial default initialization with Ipv4Header & TcpHeader #50

Closed
JulianSchmid opened this issue Jan 4, 2023 · 4 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@JulianSchmid
Copy link
Owner

It would be nice if one could simply write:

let header = TcpHeader{
    source_port: 123,
    ns: true,
    ..Default::default()
};

But this currently causes a compile time error as both Ipv4Header as well as TcpHeader contain private fields. In both of structs cases these private fields contain a buffer for options as well as a length for how much of the buffer is filled.

We can get around this limitation by moving the buffers into their own types and making them public.

@JulianSchmid JulianSchmid added the enhancement New feature or request label Jan 4, 2023
@robs-zeynet
Copy link
Contributor

I agree that your proposal here is Better, but hopefully it doesn't block my workaround proposal I just pushed here:

#66

Hope you're well!

@JulianSchmid JulianSchmid added this to the v0.14 milestone Jul 5, 2023
@JulianSchmid
Copy link
Owner Author

Hi @robs-zeynet , support for Ipv4Header & TcpHeader default initialization have been merged to master already and also should be part of 0.14.0 .

@JulianSchmid
Copy link
Owner Author

I originally also wanted to include IpAuthHeader & Ipv6RawExtHeader as part of this issue. But in interest of getting a release out of the door I moved it into a separate issue: #67

@JulianSchmid
Copy link
Owner Author

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

2 participants