Need to run shutdown code, where is best?

Is there a standard place to put shutdown code in the wireshark codebase? There are some system resources that I need to request as part of my tap and I know where to initialize the request for those resources. But other than hacking the termination code and releasing the resources there, is there some sort of routine for either a dissector or tap that gets called on shutdown that would be a better place for releasing the resources?

This is for Window OS though I imagine it would be applicable to all OSes.

Victor_jimenez's avatar
1
Victor_jimenez
asked 2019-07-01 19:20:14 +0000
edit flag offensive 0 remove flag close merge delete

Comments

So do you need to hold onto those resources until Wireshark exits? What happens if, for example, your tap displays a window, and the window is closed? What happens if the file on which the tap was run is closed?

Guy Harris's avatar Guy Harris (2019-07-01 21:25:04 +0000) edit

Ideally, you should hold the resource until the tap is no longer needed. That way you can ensure a clean release. Wireshark doesn't seem to have a place to put this type of cleanup code into. I mean you could put it at the bottom of main(), I suppose, but that seems like an awful hack.

Victor_jimenez's avatar Victor_jimenez (2019-07-02 16:31:24 +0000) edit
add a comment see more comments