-
Notifications
You must be signed in to change notification settings - Fork 115
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
chore(decoders.sflow): Cleanup constant definitions and use switch statements #328
Conversation
Thank you! will have a look. |
@lspgn it's your say, I can also remove the deprecated consts... :-) Shall I? I do have two more PRs in the pipe, one adding parsing the ETH flow record and one adding discard support, but need to wait on this one as I base them off this PR... |
Yes please go ahead with the removal! Thank you :) For the other, would you be able to add tests and provide me with a packet capture? |
Deprecated constants removed. After this PR is merged, I will put up the other two, including unit-tests of course. :-) |
@lspgn is there anything I can do to get this merged? |
@srebhan I just need to find some time to take care of it :), thank you |
I'm sorry it took so long to review. |
The current
FORMAT_*
constant definitions in the sFlow decoder mixes definitions for opaquesample_data
andflow_data
as defined in the sFlow datagram spec and sFlow datastructs spec.Those definitions reference different things and the current code reuses the definitions in a very confusing way, making it difficult to relate the specification(s) to the code.
The present PR cleans the constant definitions and splits them into their respective meaning. The old
FORMAT_*
constants are not used anymore internally and are only kept for external users' compatibility.Additionally, the PR switches to
switch
statements in the decoding functions as those are more readable and simplifies code a bit.The PR does NOT apply any functional changes and is for cleanup only.