-
Notifications
You must be signed in to change notification settings - Fork 683
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
Centralize code for fetching pcap devices. #1434
Conversation
Added memory utilities header for smart pointer utilities.
…Remote)PcapDevices.
{ | ||
PCPP_LOG_ERROR("Error searching for devices: " << errbuf); | ||
PCPP_LOG_ERROR(e.what()); |
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.
recommend to have a meaningful error message here.
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.
The error messages are actually the same as before. It is just that the DeviceUtil functions have the error messages thrown in a runtime_error
as the exception reason and this code catches that and logs the message in the exception.
pcap_if_t* currInterface = interfaceList; | ||
while (currInterface != nullptr) | ||
|
||
for (pcap_if_t* currInterface = interfaceList.get(); currInterface != nullptr; currInterface = currInterface->next) |
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.
nice catch
} | ||
catch (const std::exception& e) | ||
{ | ||
PCPP_LOG_ERROR(e.what()); |
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.
same here
Pcap++/CMakeLists.txt
Outdated
header/DeviceUtils.h | ||
header/MemoryUtils.h |
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.
These 2 new files contain internal utils, so they shouldn't be exposed as part of the API...
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.
Where do you want me to put them then?
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.
I'm not a CMake expert, but I think there is a way to decide which header files are "public" (meaning exposed as part of PcapPlusPlus API) and which are "private". This may also affect our doxygen API documentation: https://pcapplusplus.github.io/api-docs/next/ (which currently looks at all the header files in Pcap++/header
😕 )
Maybe @clementperon can help here?
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.
Well, removed the headers from the public header list. (fb685bf)
Things appear to be building fine, and the only difference is that the headers are missing from the include folder of the install command output.
Don't know if anything has changed in the docs generation. The CI action still shows that the headers are being parsed.
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.
I think that's ok. For doxygen we probably need to exclude these files in Doxyfile
and Doxyfile-ci
which are in the web-site repo. Here is how to exclude files:
https://stackoverflow.com/questions/34776315/doxygen-special-command-to-ignore-a-file
Do you want to open a PR for it or prefer I do it?
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.
Hmm, maybe we can mark the documentation as internal for doxygen in the code?
Something like this: https://stackoverflow.com/a/18443973/11922936
That way the docs won't be generated for the public documentation but it will retain the option for generating internal documentation if we want one in the future.
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.
Enclosed the internal namespace in a conditional doxygen section (617273e). I think this might remove the namespace's contents from the public documentation.
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.
Nice!! You can test it locally or merge this PR and I'll test it later. It's not a blocker for merging because the documentation isn't final for a non-releases and we can fix it later if needed
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.
let's make it in another PR if necessary.
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.
See one comment, otherwise LGTM
Part of #1431. Implements point 7.