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

Sendqueue pkt header size #379

Merged
merged 8 commits into from
Dec 20, 2024
Merged

Conversation

qrnch-jan
Copy link
Contributor

There's currently a gap for applications that want to precalculate the exact SendQueue size required for a batch of packets -- the application doesn't know[*] the exact size of the packet header that is implicitly added with each packet. This PR adds a constant function, tied to SendQueue, that will allow applications to easily get the size without bothering with any other details.

[*] Well, this isn't technically true -- it happens to be the same size and layout as packet headers found elsewhere in the crate. However, the benefit of this implementation is that it considers the exact type an implementation detail that the application doesn't need to care about.

qrnch-jan and others added 6 commits December 16, 2024 19:38
… rustc-serialize, which has had a history of causing builds to print deprecation warnings.
… pull in rustc-serialize, which has had a history of causing builds to print deprecation warnings."

This reverts commit 36138ca.
that want to precalculate required total SendQueue size.

This size is available using other types in the crate, but tying the
query to the `SendQueue` allows us to avoid a breaking change in case
the SendQueue's header ever changes (even though this is highly unlikely
to happen).
Copy link
Collaborator

@Wojtek242 Wojtek242 left a comment

Choose a reason for hiding this comment

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

@qrnch-jan the code does not look windows-exclusive. Would you be able to add this function to some reasonable place that is accessible on all platforms and add a small unit test to ensure code coverage?

@qrnch-jan
Copy link
Contributor Author

@Wojtek242 It is indeed not strictly Windows-exclusive, but the reason I put it there was to emphasize that it's the size of the packet header used by {win,n}pcap send queues, and it's the size one should use to calculate required sendqueue sizes.

I have moved the function, and documented that it's the one that should be used by SendQueue.

@qrnch-jan qrnch-jan requested a review from Wojtek242 December 20, 2024 12:46
@Wojtek242 Wojtek242 merged commit 20afc8b into rust-pcap:main Dec 20, 2024
12 checks passed
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