Wireshark-bugs: [Wireshark-bugs] [Bug 5048] VeriWave encapsulation type and WaveAgent protocol -
Date: Mon, 25 Oct 2010 13:02:05 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5048

--- Comment #13 from Bill Meier <wmeier@xxxxxxxxxxx> 2010-10-25 16:02:04 EDT ---
Re:

 2. vwr.c:  All the functions and the global variables (other than vwr_open)
   should be defined as static.

& 4. Removed static declaration of variables (wasn't needed).

from the comments above.


I think you may have misunderstood Guy's comment above:

> The "various internal variables" in the .vwr reader file should not be static;
> we make no guarantee that Wiretap will only have one file open.

The correct way:
>  Instead, you
> should allocate a private data structure for each wtap structure, and
> attach it to that structure through the "priv" pointer.
> 

See the netxray.c wiretap reader for an example of how to do this.

     ...
     typedef struct {
       ...
     } netxray_t
     ...

     int netxray_open(...) {
        ...
    netxray = (netxray_t *)g_malloc(sizeof(netxray_t));
    wth->priv = (void *)netxray;
        ...
     }

In this manner, and in your case, the "vwr offsets" will be associated with the 
wtap struct so that if there's more than one file open the correct offsets will
be associated with each file.

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.