-
Notifications
You must be signed in to change notification settings - Fork 637
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
base: dev
Are you sure you want to change the base?
Conversation
…actor/pcap-cpp11-modernization
{ | ||
size_t headerLen = getHeaderLen(); | ||
if (m_DataLen <= headerLen || headerLen == 0) | ||
return; | ||
|
||
if (getProtocol() == parseUntil || getOsiModelLayer() == parseUntilLayer) | ||
return; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Could you also add tests for these changes? |
This pull request implements the fix to #657 by refactoring the function
parseNextLayer()
to include parametersparseUntil
andparseUntilLayer
, which fixes the issue ofPacket::setRawPacket
parsing layers it should not whenparseUntilLayer
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:
parseNextLayer()
to check if the next layer should be parsed