ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Protocol Col / Info col error

From: vinayak kamath <vins.sunysb@xxxxxxxxx>
Date: Tue, 31 Mar 2009 11:06:59 -0700
Hi ,

Sorry when i meant Null it was for pinfo->cinfo since i tried to print it .
Also if i comment the check_col() function it throws an error saying
"Err  file column-utils.c: line 214 (col_set_str): assertion failed: (cinfo->col_first[el] >= 0)".

My concern is this code works  for wireshark 0.99.5 on linux or wireshark 1.0.0 on windows.

I also changed the tvb_length to tvb_reported_length

thanks
vinayak


On Tue, Mar 31, 2009 at 10:54 AM, Guy Harris <guy@xxxxxxxxxxxx> wrote:

On Mar 31, 2009, at 10:45 AM, vinayak kamath wrote:

>   iDataLen = tvb_length(tvb); /* get length of packet */

That's the amount of captured packet data in the packet, which could
be smaller than the length of the packet, as the capture might have
been done with a "snapshot length" or "slice length" that caused a
maximum of N bytes of packet data to be captured, discarding all the
data following it.

You want tvb_reported_length().

>   if ( IsABCMessage(tvb, iDataLen)) /* check if it is a ABC  message
> */
> {
>  if (check_col(pinfo->cinfo,COL_PROTOCOL))  // #######This is NULL,
> asa a result it doesn't enter the if condition

What is the "This" in "This is NULL"?  check_col() returns a Boolean
value, not a pointer, so it's true or false, not null or non-null.

Note also that check_col() will not always return true - it should do
so the first time the dissector is called, but won't necessarily be
true on times it's called after that.  (And it's possible that, in the
future, it won't return true the first time the dissector is called.)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe