Ethereal-dev: [Ethereal-dev] error with one dissector....help

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: david martinez <davidmfcg@xxxxxxxx>
Date: Thu, 2 Feb 2006 12:00:10 +0100 (CET)
Hi; i'm created a dissector to a simple protol with
only 1 field; but when i have instaled ethereal 0.14
and i open a capture file where should be appear my
protol tree appear this error:
  [Dissecotr bug protocol LLCTLB: proto.c:1187 failed
assetion "(guint)hfindex <gpa.hfinfo.len"]
On COL INFO appear that message too, but appear the
name of my protocol too, on PROTOCOL_INFO apprear the
name correct too. What is my problem?? I put here my
code, please somebody help me:



#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <epan/packet.h>
#include <epan/prefs.h>

#include <glib.h>


#include <epan/packet.h>

#include "etypes.h"

void proto_reg_handoff_LLCTLB(void);

static int proto_LLCTLB=-1;
static int hf_LLCTLB_SNR=-1;
static gint ett_LLCTLB=-1;




static void
dissect_LLCTLB(tvbuff_t *tvb,packet_info
*pinfo,proto_tree *tree)
{

proto_item *tp,*t0;
proto_tree *LLCTLB_tree;
guint8 SNR;



pinfo->current_proto="LLCTLB";
if(check_col(pinfo->cinfo,COL_PROTOCOL))

    col_set_str(pinfo->cinfo,COL_PROTOCOL,"LLCTLB");

if(check_col(pinfo->cinfo,COL_INFO))
    col_clear(pinfo->cinfo,COL_INFO);

if(check_col(pinfo->cinfo,COL_INFO))

col_set_str(pinfo->cinfo,COL_INFO,"ListenBeacon");SNR=tvb_get_guint8(tvb,0);

if(tree) { 

tp=proto_tree_add_protocol_format(tree,proto_LLCTLB,tvb,0,1,"ListenBeacon");

LLCTLB_tree=proto_item_add_subtree(tp,ett_LLCTLB);
t0=proto_tree_add_uint(LLCTLB_tree,hf_LLCTLB_SNR,tvb,0,1,SNR);
tvb_set_reported_length(tvb,1);

}
}

 
 
 
 
void 
 proto_register_LLCTLB_(void) { 
       	    static hf_register_info hf[]= { 
{ &hf_LLCTLB_SNR,
     {
"SNR","LLCTLB.SNR",FT_UINT8,BASE_DEC,NULL,0x00,"
",HFILL}
},
 
  
};



 static gint *ett[]= { 
     &ett_LLCTLB,
  };
 
 
 proto_LLCTLB=proto_register_protocol(" ListenBeacon
"," LLCTLB "," LLCTLB ");

proto_register_field_array(proto_LLCTLB,hf,array_length(hf));
proto_register_subtree_array(ett,array_length(ett)); 





 }


void proto_reg_handoff_LLCTLB(void)
{           
dissector_handle_t LLCTLB_handle;
LLCTLB_handle=create_dissector_handle(dissect_LLCTLB,proto_LLCTLB);
dissector_add("ethertype",ETHERTYPE_LLCTLB,LLCTLB_handle);
 
}




		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com