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] Problem with proto_tree_add_uint()

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 05 Jul 2010 17:23:57 +0200

Hi,

Looks like your build process is gone out-of-control.

Try a clean build, using 'make clean' first. (assuming *N*X based development here)

Thanks,
Jaap

 

On Mon, 5 Jul 2010 15:58:10 +0100, César Gomes <cesargomes@xxxxx> wrote:

Hello everyone,

I'm currently developing a custom dissector for a custom made protocol in  my universtity, mean while i've had a problem with the displaying of some information on the stats tree. I have 2 instructions inside a if sturucture and one of them is always performed following is a potion of my code:


    if(Sindex){ /*verificar existencia da mensagem na TM*/
   
        proto_tree_add_item(sdm_tree, hf_testc, tvb, 0, 0, FALSE); /*Teste de correspondencia*/
        proto_tree_add_uint(sdm_tree, hf_ftt_TMframe, tvb, 0, 0, Tmsg[i].frame); /*mostra em que frame está a TM*/
        /*Processamento do tempo*/
        nstime_delta(stime, &pinfo->fd->abs_ts, &(Tmsg[i].tm_time));
        proto_tree_add_time(sdm_tree, hf_ftt_TMtime, tvb, 0,0, stime);       
       
       

    }
    else{
        proto_tree_add_uint(sdm_tree, hf_ftt_error, tvb, 0, 0, 1);
        col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR(1) %s",val_to_str(1,ftt_error,"X")); /*Erro a mensagem nao está na TM*/
    }
    if(duplicate==1){
        col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR(2) %s",val_to_str(2,ftt_error,"X")); /*Erro a mensagem nao está na TM*/
        proto_tree_add_uint(sdm_tree, hf_ftt_error, tvb, 0, 0, 2);
        }

duplicate is a gint

the instruction proto_tree_add_uint(sdm_tree, hf_ftt_error, tvb, 0, 0, 2); is always performed even if the condition "duplicate==1" is false, when the condition is true the condition is true the two instructions are performed as they're suposed to.

Is here something missing me?
I would apreciate your help.

Best regards,


César Gomes