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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@122
f5534014-38df-0310-8fa8-
9805f1628bb7
/* 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>
int start_off;
GtkWidget *qatree, *ti;
- qatree = gtk_tree_new();
start_off = cur_off;
-
- 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");
+ 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);
+ set_item_len(ti, cur_off - start_off);
return cur_off - start_off;
}
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;
}
* 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>
int start_off;
GtkWidget *qatree, *ti;
- qatree = gtk_tree_new();
start_off = cur_off;
-
- 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");
+ 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);
+ set_item_len(ti, cur_off - start_off);
return cur_off - start_off;
}
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;
}
/* 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>
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];
/* 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>
#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);