aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>2009-08-09 17:33:23 +0000
committerkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>2009-08-09 17:33:23 +0000
commit203ebcf63bfcc36dc9d8cc13b12cb187671b7383 (patch)
tree41b31c399a92ff8fdd4281ab78884c37e6846e78
parente660ae425adf60cc4a5d244f3fa70cb124d26e63 (diff)
Add PNODE_FINFO. We've been using PITEM_FINFO on proto_node's. This works because proto_item is typedefed to proto_node. We shouldn't rely on this since this is an implementation detail.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29354 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/proto.c8
-rw-r--r--epan/proto.h5
-rw-r--r--file.c2
-rw-r--r--gtk/iax2_analysis.c4
-rw-r--r--gtk/main_proto_draw.c2
-rw-r--r--gtk/rtp_analysis.c4
-rw-r--r--print.c6
-rw-r--r--proto_hier_stats.c2
-rw-r--r--tap-protohierstat.c6
9 files changed, 21 insertions, 18 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 4c5ffdc2ca..25182b1ec5 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -549,7 +549,7 @@ free_node_tree_data(tree_data_t *tree_data)
static gboolean
proto_tree_free_node(proto_node *node, gpointer data _U_)
{
- field_info *finfo = PITEM_FINFO(node);
+ field_info *finfo = PNODE_FINFO(node);
#if 0
proto_node *parent = node->parent;
#endif
@@ -5063,7 +5063,7 @@ typedef struct {
static gboolean
find_finfo(proto_node *node, gpointer data)
{
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
if (fi && fi->hfinfo) {
if (fi->hfinfo->id == ((ffdata_t*)data)->id) {
g_ptr_array_add(((ffdata_t*)data)->array, fi);
@@ -5097,7 +5097,7 @@ proto_find_finfo(proto_tree *tree, int id)
static gboolean
every_finfo(proto_node *node, gpointer data)
{
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
if (fi && fi->hfinfo) {
g_ptr_array_add(((ffdata_t*)data)->array, fi);
}
@@ -5130,7 +5130,7 @@ typedef struct {
static gboolean
check_for_offset(proto_node *node, gpointer data)
{
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
offset_search_t *offsearch = data;
/* !fi == the top most container node which holds nothing */
diff --git a/epan/proto.h b/epan/proto.h
index 37e8fcda7e..32e83a0ac2 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -345,8 +345,11 @@ extern gboolean proto_tree_traverse_post_order(proto_tree *tree,
extern void proto_tree_children_foreach(proto_tree *tree,
proto_tree_foreach_func func, gpointer data);
+/** Retrieve the field_info from a proto_node */
+#define PNODE_FINFO(proto_node) ((proto_node)->finfo)
+
/** Retrieve the field_info from a proto_item */
-#define PITEM_FINFO(proto_item) ((proto_item)->finfo)
+#define PITEM_FINFO(proto_item) PNODE_FINFO(proto_item)
/** Retrieve the tree_data_t from a proto_tree */
#define PTREE_DATA(proto_tree) ((proto_tree)->tree_data)
diff --git a/file.c b/file.c
index be6818465d..49e00156fe 100644
--- a/file.c
+++ b/file.c
@@ -2967,7 +2967,7 @@ match_subtree_text(proto_node *node, gpointer data)
const gchar *string = mdata->string;
size_t string_len = mdata->string_len;
capture_file *cf = mdata->cf;
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
gchar label_str[ITEM_LABEL_LENGTH];
gchar *label_ptr;
size_t label_len;
diff --git a/gtk/iax2_analysis.c b/gtk/iax2_analysis.c
index babdff1a79..46e2dbfd19 100644
--- a/gtk/iax2_analysis.c
+++ b/gtk/iax2_analysis.c
@@ -3355,7 +3355,7 @@ static gboolean process_node(proto_node *ptree_node, header_field_info *hfinform
header_field_info *hfssrc;
ipv4_addr *ipv4;
- finfo = PITEM_FINFO(ptree_node);
+ finfo = PNODE_FINFO(ptree_node);
if (hfinformation==(finfo->hfinfo)) {
hfssrc = proto_registrar_get_byname(proto_field);
@@ -3366,7 +3366,7 @@ static gboolean process_node(proto_node *ptree_node, header_field_info *hfinform
}
for(ptree_node=ptree_node->first_child; ptree_node!=NULL;
ptree_node=ptree_node->next) {
- finfo=PITEM_FINFO(ptree_node);
+ finfo=PNODE_FINFO(ptree_node);
if (hfssrc==finfo->hfinfo) {
if (hfinformation->type==FT_IPv4) {
ipv4 = fvalue_get(&finfo->value);
diff --git a/gtk/main_proto_draw.c b/gtk/main_proto_draw.c
index c484c49c34..1bde6b5755 100644
--- a/gtk/main_proto_draw.c
+++ b/gtk/main_proto_draw.c
@@ -1684,7 +1684,7 @@ proto_tree_draw_node(proto_node *node, gpointer data)
struct proto_tree_draw_info info;
struct proto_tree_draw_info *parent_info = (struct proto_tree_draw_info*) data;
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
gchar label_str[ITEM_LABEL_LENGTH];
gchar *label_ptr;
gboolean is_leaf, is_expanded;
diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c
index 96a411b1d5..0813a0cc46 100644
--- a/gtk/rtp_analysis.c
+++ b/gtk/rtp_analysis.c
@@ -3503,7 +3503,7 @@ static gboolean process_node(proto_node *ptree_node, header_field_info *hfinform
header_field_info *hfssrc;
ipv4_addr *ipv4;
- finfo = PITEM_FINFO(ptree_node);
+ finfo = PNODE_FINFO(ptree_node);
if (hfinformation==(finfo->hfinfo)) {
hfssrc = proto_registrar_get_byname(proto_field);
@@ -3511,7 +3511,7 @@ static gboolean process_node(proto_node *ptree_node, header_field_info *hfinform
return FALSE;
for(ptree_node=ptree_node->first_child; ptree_node!=NULL;
ptree_node=ptree_node->next) {
- finfo=PITEM_FINFO(ptree_node);
+ finfo=PNODE_FINFO(ptree_node);
if (hfssrc==finfo->hfinfo) {
if (hfinformation->type==FT_IPv4) {
ipv4 = fvalue_get(&finfo->value);
diff --git a/print.c b/print.c
index d9178a842d..f0e4564e44 100644
--- a/print.c
+++ b/print.c
@@ -151,7 +151,7 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
static
void proto_tree_print_node(proto_node *node, gpointer data)
{
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
print_data *pdata = (print_data*) data;
const guint8 *pd;
gchar label_str[ITEM_LABEL_LENGTH];
@@ -255,7 +255,7 @@ proto_tree_write_pdml(epan_dissect_t *edt, FILE *fh)
static void
proto_tree_write_node_pdml(proto_node *node, gpointer data)
{
- field_info *fi = PITEM_FINFO(node);
+ field_info *fi = PNODE_FINFO(node);
write_pdml_data *pdata = (write_pdml_data*) data;
const gchar *label_ptr;
gchar label_str[ITEM_LABEL_LENGTH];
@@ -1407,7 +1407,7 @@ static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
gpointer field_index;
call_data = data;
- fi = PITEM_FINFO(node);
+ fi = PNODE_FINFO(node);
field_index = g_hash_table_lookup(call_data->fields->field_indicies, fi->hfinfo->abbrev);
if(NULL != field_index) {
diff --git a/proto_hier_stats.c b/proto_hier_stats.c
index 77d3534441..ce3ce1e403 100644
--- a/proto_hier_stats.c
+++ b/proto_hier_stats.c
@@ -85,7 +85,7 @@ process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
proto_node *proto_sibling_node;
GNode *stat_node;
- finfo = PITEM_FINFO(ptree_node);
+ finfo = PNODE_FINFO(ptree_node);
g_assert(finfo);
/* If the field info isn't related to a protocol but to a field,
diff --git a/tap-protohierstat.c b/tap-protohierstat.c
index b413f5035e..407ae57a26 100644
--- a/tap-protohierstat.c
+++ b/tap-protohierstat.c
@@ -76,7 +76,7 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const v
{
phs_t *rs=prs;
phs_t *tmprs;
- proto_tree *tree;
+ proto_node *node;
field_info *fi;
if(!edt){
@@ -89,8 +89,8 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const v
return 0;
}
- for(tree=edt->tree->first_child;tree;tree=tree->next){
- fi=PITEM_FINFO(tree);
+ for(node=edt->tree->first_child;node;node=node->next){
+ fi=PNODE_FINFO(node);
/* first time we saw a protocol at this leaf */
if(rs->protocol==-1){