When dissecting DNS or NBNS queries or replies, add the item to the tree
for the queries or replies first, then create and add the subtree and populate it, and, when that's done, set the length of the item appropriately; if you add the subtree later, the subtree's top-level node appears to have level 0, rather than 1 greater than the tree of which it's a subtree, which causes those trees not to print correctly. svn path=/trunk/; revision=122
This commit is contained in:
parent
5274503f24
commit
7dd4f76f59
21
packet-dns.c
21
packet-dns.c
|
@ -1,7 +1,7 @@
|
|||
/* packet-dns.c
|
||||
* Routines for DNS packet disassembly
|
||||
*
|
||||
* $Id: packet-dns.c,v 1.9 1998/11/17 04:28:51 gerald Exp $
|
||||
* $Id: packet-dns.c,v 1.10 1998/12/04 05:59:10 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -407,14 +407,14 @@ dissect_query_records(const u_char *dns_data_ptr, int count, const u_char *pd,
|
|||
int start_off;
|
||||
GtkWidget *qatree, *ti;
|
||||
|
||||
qatree = gtk_tree_new();
|
||||
start_off = cur_off;
|
||||
|
||||
ti = add_item_to_tree(GTK_WIDGET(dns_tree),
|
||||
start_off, 0, "Queries");
|
||||
qatree = gtk_tree_new();
|
||||
add_subtree(ti, qatree, ETT_DNS_QRY);
|
||||
while (count-- > 0)
|
||||
cur_off += dissect_dns_query(dns_data_ptr, pd, cur_off, qatree);
|
||||
ti = add_item_to_tree(GTK_WIDGET(dns_tree),
|
||||
start_off, cur_off - start_off, "Queries");
|
||||
add_subtree(ti, qatree, ETT_DNS_QRY);
|
||||
set_item_len(ti, cur_off - start_off);
|
||||
|
||||
return cur_off - start_off;
|
||||
}
|
||||
|
@ -429,13 +429,14 @@ dissect_answer_records(const u_char *dns_data_ptr, int count,
|
|||
int start_off;
|
||||
GtkWidget *qatree, *ti;
|
||||
|
||||
qatree = gtk_tree_new();
|
||||
start_off = cur_off;
|
||||
|
||||
ti = add_item_to_tree(GTK_WIDGET(dns_tree),
|
||||
start_off, 0, name);
|
||||
qatree = gtk_tree_new();
|
||||
add_subtree(ti, qatree, ETT_DNS_ANS);
|
||||
while (count-- > 0)
|
||||
cur_off += dissect_dns_answer(dns_data_ptr, pd, cur_off, qatree);
|
||||
ti = add_item_to_tree(GTK_WIDGET(dns_tree), start_off, cur_off - start_off, name);
|
||||
add_subtree(ti, qatree, ETT_DNS_ANS);
|
||||
set_item_len(ti, cur_off - start_off);
|
||||
|
||||
return cur_off - start_off;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
* Much stuff added by Guy Harris <guy@netapp.com>
|
||||
*
|
||||
* $Id: packet-nbns.c,v 1.9 1998/11/21 04:00:31 guy Exp $
|
||||
* $Id: packet-nbns.c,v 1.10 1998/12/04 05:59:12 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -642,14 +642,14 @@ dissect_query_records(const u_char *nbns_data_ptr, int count, const u_char *pd,
|
|||
int start_off;
|
||||
GtkWidget *qatree, *ti;
|
||||
|
||||
qatree = gtk_tree_new();
|
||||
start_off = cur_off;
|
||||
|
||||
ti = add_item_to_tree(GTK_WIDGET(nbns_tree),
|
||||
start_off, 0, "Queries");
|
||||
qatree = gtk_tree_new();
|
||||
add_subtree(ti, qatree, ETT_NBNS_QRY);
|
||||
while (count-- > 0)
|
||||
cur_off += dissect_nbns_query(nbns_data_ptr, pd, cur_off, qatree);
|
||||
ti = add_item_to_tree(GTK_WIDGET(nbns_tree),
|
||||
start_off, cur_off - start_off, "Queries");
|
||||
add_subtree(ti, qatree, ETT_NBNS_QRY);
|
||||
set_item_len(ti, cur_off - start_off);
|
||||
|
||||
return cur_off - start_off;
|
||||
}
|
||||
|
@ -663,15 +663,15 @@ dissect_answer_records(const u_char *nbns_data_ptr, int count,
|
|||
int start_off;
|
||||
GtkWidget *qatree, *ti;
|
||||
|
||||
qatree = gtk_tree_new();
|
||||
start_off = cur_off;
|
||||
|
||||
ti = add_item_to_tree(GTK_WIDGET(nbns_tree),
|
||||
start_off, 0, name);
|
||||
qatree = gtk_tree_new();
|
||||
add_subtree(ti, qatree, ETT_NBNS_ANS);
|
||||
while (count-- > 0)
|
||||
cur_off += dissect_nbns_answer(nbns_data_ptr, pd, cur_off,
|
||||
qatree, opcode);
|
||||
ti = add_item_to_tree(GTK_WIDGET(nbns_tree), start_off, cur_off - start_off, name);
|
||||
add_subtree(ti, qatree, ETT_NBNS_ANS);
|
||||
|
||||
set_item_len(ti, cur_off - start_off);
|
||||
return cur_off - start_off;
|
||||
}
|
||||
|
||||
|
|
8
packet.c
8
packet.c
|
@ -1,7 +1,7 @@
|
|||
/* packet.c
|
||||
* Routines for packet disassembly
|
||||
*
|
||||
* $Id: packet.c,v 1.12 1998/11/18 03:01:38 gerald Exp $
|
||||
* $Id: packet.c,v 1.13 1998/12/04 05:59:13 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -167,6 +167,12 @@ add_item_to_tree(GtkWidget *tree, gint start, gint len,
|
|||
return ti;
|
||||
}
|
||||
|
||||
void
|
||||
set_item_len(GtkWidget *ti, gint len)
|
||||
{
|
||||
gtk_object_set_data(GTK_OBJECT(ti), E_TREEINFO_LEN_KEY, (gpointer) len);
|
||||
}
|
||||
|
||||
void
|
||||
add_subtree(GtkWidget *ti, GtkWidget *subtree, gint idx) {
|
||||
static gint tree_type[NUM_TREE_TYPES];
|
||||
|
|
3
packet.h
3
packet.h
|
@ -1,7 +1,7 @@
|
|||
/* packet.h
|
||||
* Definitions for packet disassembly structures and routines
|
||||
*
|
||||
* $Id: packet.h,v 1.26 1998/11/20 05:58:42 gram Exp $
|
||||
* $Id: packet.h,v 1.27 1998/12/04 05:59:14 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -486,6 +486,7 @@ GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...)
|
|||
#else
|
||||
GtkWidget* add_item_to_tree(GtkWidget *, gint, gint, gchar *, ...);
|
||||
#endif
|
||||
void set_item_len(GtkWidget *, gint);
|
||||
gchar* val_to_str(guint32, const value_string *, const char *);
|
||||
gchar* match_strval(guint32, const value_string*);
|
||||
gint check_col(frame_data *, gint);
|
||||
|
|
Loading…
Reference in New Issue