Note: forwarded message attached.
. We'll help.
.
--- Begin Message ---
Hi
I wrote and then tried to run the following code.
But the ethereal is hanging.
Please any one me tell what may be wrong with it.
Obviously my intention here is to parse the CDR's
Regards,
Prashanth.
/* CDRs dissector */
static int
decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 length, format_ver;
guint8 no, format;
proto_tree *ext_tree;
proto_item *te;
tvbuff_t *next_tvb;
te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
length = tvb_get_ntohs(tvb, offset + 1);
no = tvb_get_guint8(tvb, offset + 3);
format = tvb_get_guint8(tvb, offset + 4);
format_ver = tvb_get_ntohs(tvb, offset +
5);
proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
my_gtpcdr_handle(tvb, offset+7, pinfo,tree,no);
return 3+length;
}
void my_gtpcdr_handle (tvbuff_t * tvb, int offset, packet_info *pinfo _U_ , proto_tree * tree, int no_of_records)
{
guint16 record_length;
int record_count = 1;
while( record_count <= no_of_records)
{
record_length = tvb_get_ntohs(tvb, offset);
if(record_length != 0)
{
offset = offset + 2 + my_decode_cdr ( tvb, offset + 2, pinfo, tree,record_length);
}
else
offset = offset + 2;
record_count = record_count + 1;
}
}
int my_decode_cdr (tvbuff_t * tvb, int offset, packet_info *pinfo _U_ , proto_tree *tree, int record_length)
{
int retval, i, flag;
guint8 type;
int check_extension_val;
int count = 0;
while(count != record_length)
{
/* fetch type field of each information element in record */
type = tvb_get_guint8(tvb, offset);
i = 0; flag = 0;
switch(type)
{
case 0x7F: retval = decode_gtp_chrg_id ( tvb, offset,
pinfo,tree);
offset = offset + retval;
count = count + retval;
break;
default : offset + 1;
count + 1;
break;
}
}
return
count;
}
Get your email and more, right on the new Yahoo.com
--- End Message ---