-
Notifications
You must be signed in to change notification settings - Fork 729
Refactored PcapHandle to utilize std::unique_ptr internally. #1753
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have an
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am okay with the current way, but it's also fine to move the files.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels cleaner to have the "internal" public headers separated. That way, we don't have to worry about breaking changes if "internal" files are renamed or moved around due to people directly including them. And if they still do, that is on them.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I agree with you. Just think we can put effort on more important parts (if there are such things)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, it's possibly not the most important. But since this PR exposes a new public header (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. I don't have strong opion on this. Let see how @seladb says. |
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 we should avoid exposing internal header files like
PcapUtils.h.The reason it is needed is because we use
internal::PcapCloseDeleterinside a "public" header file, and we should find a way around it.I tried using forward declaration of
internal::PcapCloseDeleterbut couldn't make it work so far. @Dimi1010 maybe you can make it work?Other options are:
internal::PcapCloseDeletertoPcapDevice.h- not ideal, but I think it'll workm_PcapDescriptoras "no type" likevoid*and assign the type in the.cppfile. However it's a pretty ugly workaroundThere 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 this as a potential solution. I think this is the cleanest, tbh.
#1753 (comment)
internal::PcapCloseDeletercan't work as a forward declaration here as it is default constructed in thestd::unique_ptrso it needs a concrete type.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 exposing an
internalfolder of headers is not a good solution either because exposing header files just because we have some technical limitations is not something we want. I think we should either find a workaround (even if it's not very nice), or just leave the code as it isUh oh!
There was an error while loading. Please reload this page.
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 have seen that pattern be used to separate the stable public headers from the unstable ones, that can change at any moment and users shouldn't rely upon. Most notably I have seen it in many boost libraries ("details" folders).
Moving
internal::PcapCloseDeletertoPcapDevice.hcreates a dependency betweenPcapFilter.cppandPcapDevice.h, which I would prefer to not have.I guess we can leave this as is for now tho.
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.
If it was "stable" vs "unstable" public API I'd agree that separating them into different folders could work. But exposing a "private API" (internal code) is probably not the best way to go.
I guess leaving it as is is fine if we can find a better solution...