Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

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

From: vinayak kamath <vins.sunysb@xxxxxxxxx>
Date: Tue, 31 Mar 2009 13:22:38 -0700
Hi,

When i load the PCAP file pinfo->cinfo value is never null but when i click on any of the lines(my own porotocol message)
 on GUI the debud printfs shows the value as null
I am a bit confused here....

Any help is appreciated...

-vinayak

On Tue, Mar 31, 2009 at 11:06 AM, vinayak kamath <vins.sunysb@xxxxxxxxx> wrote:
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