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

Refactor parseNextLayer to include parseUntilLayer and parseUntil #1376

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

rtmeng
Copy link
Contributor

@rtmeng rtmeng commented Apr 26, 2024

This pull request implements the fix to #657 by refactoring the function parseNextLayer() to include parameters parseUntil and parseUntilLayer, which fixes the issue of Packet::setRawPacket parsing layers it should not when parseUntilLayer is set. Like mentioned in the Issue, this solution doesn't break the API and relies on the layers to not parse too far if it's not requested.

Main Changes:

  • Changed each layer's parseNextLayer() to check if the next layer should be parsed
  • Fixed inconsistencies of using the keyword override

@rtmeng rtmeng requested a review from seladb as a code owner April 26, 2024 20:01
{
size_t headerLen = getHeaderLen();
if (m_DataLen <= headerLen || headerLen == 0)
return;

if (getProtocol() == parseUntil || getOsiModelLayer() == parseUntilLayer)
return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It will be a pain to change a bit but all return statements in cpp files unfortunately requires a tab indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, somehow didn’t notice that locally, I’ll go through and add them

@tigercosmos
Copy link
Collaborator

Could you also add tests for these changes?

@rtmeng rtmeng marked this pull request as draft April 30, 2024 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants