Make the recent epan/proto.{c,h} change compile.

svn path=/trunk/; revision=9075
This commit is contained in:
Guy Harris 2003-11-24 22:11:55 +00:00
parent 2e94fc8139
commit 122dd3959c
10 changed files with 60 additions and 60 deletions

View File

@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
* $Id: proto.c,v 1.107 2003/11/24 21:12:10 sahlberg Exp $
* $Id: proto.c,v 1.108 2003/11/24 22:11:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -157,7 +157,7 @@ static GMemChunk *gmc_hfinfo = NULL;
static field_info *field_info_free_list=NULL;
static field_info *field_info_tmp=NULL;
#define free_field_info(fi) \
fi->next=field_info_free_list; \
fi->ptr_u.next=field_info_free_list; \
field_info_free_list=fi;
@ -283,7 +283,7 @@ proto_cleanup(void)
while (field_info_free_list) {
field_info *tmpfi;
tmpfi=field_info_free_list->next;
tmpfi=field_info_free_list->ptr_u.next;
g_free(field_info_free_list);
field_info_free_list=tmpfi;
}
@ -587,7 +587,7 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
* good thing we saved it, now we can reverse the
* memory leak and reclaim it.
*/
field_info_tmp->next=field_info_free_list;
field_info_tmp->ptr_u.next=field_info_free_list;
field_info_free_list=field_info_tmp;
}
/* we might throw an exception, keep track of this one
@ -595,7 +595,7 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
*/
field_info_tmp=new_fi;
switch(new_fi->hfinfo->type) {
switch(new_fi->ptr_u.hfinfo->type) {
case FT_NONE:
/* no value to set for FT_NONE */
break;
@ -756,9 +756,9 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
break;
default:
g_error("new_fi->hfinfo->type %d (%s) not handled\n",
new_fi->hfinfo->type,
ftype_name(new_fi->hfinfo->type));
g_error("new_fi->ptr_u.hfinfo->type %d (%s) not handled\n",
new_fi->ptr_u.hfinfo->type,
ftype_name(new_fi->ptr_u.hfinfo->type));
g_assert_not_reached();
break;
}
@ -1295,7 +1295,7 @@ proto_item_append_string(proto_item *pi, const char *str)
return;
fi = PITEM_FINFO(pi);
hfinfo = fi->hfinfo;
hfinfo = fi->ptr_u.hfinfo;
g_assert(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ);
old_str = fvalue_get(fi->value);
new_str = g_malloc(strlen(old_str) + strlen(str) + 1);
@ -1656,7 +1656,7 @@ proto_tree_set_uint(field_info *fi, guint32 value)
header_field_info *hfinfo;
guint32 integer;
hfinfo = fi->hfinfo;
hfinfo = fi->ptr_u.hfinfo;
integer = value;
if (hfinfo->bitmask) {
@ -1743,7 +1743,7 @@ proto_tree_set_int(field_info *fi, gint32 value)
header_field_info *hfinfo;
guint32 integer;
hfinfo = fi->hfinfo;
hfinfo = fi->ptr_u.hfinfo;
integer = (guint32) value;
if (hfinfo->bitmask) {
@ -1906,14 +1906,14 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
for(i=0;i<INITIAL_NUM_FIELD_INFO;i++){
field_info *tmpfi;
tmpfi=&pfi[i];
tmpfi->next=field_info_free_list;
tmpfi->ptr_u.next=field_info_free_list;
field_info_free_list=tmpfi;
}
}
fi=field_info_free_list;
field_info_free_list=fi->next;
field_info_free_list=fi->ptr_u.next;
fi->hfinfo = hfinfo;
fi->ptr_u.hfinfo = hfinfo;
fi->start = start;
if (tvb) {
fi->start += tvb_raw_offset(tvb);
@ -1923,7 +1923,7 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
fi->visible = PTREE_DATA(tree)->visible;
fi->representation = NULL;
fi->value = fvalue_new(fi->hfinfo->type);
fi->value = fvalue_new(fi->ptr_u.hfinfo->type);
/* add the data source tvbuff */
if (tvb) {
@ -2525,7 +2525,7 @@ proto_register_subtree_array(gint **indices, int num_indices)
void
proto_item_fill_label(field_info *fi, gchar *label_str)
{
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
guint8 *bytes;
guint32 integer;
@ -2710,7 +2710,7 @@ static void
fill_label_uint64(field_info *fi, gchar *label_str)
{
unsigned char *bytes;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
int ret; /*tmp return value */
bytes=fvalue_get(fi->value);
@ -2739,7 +2739,7 @@ static void
fill_label_int64(field_info *fi, gchar *label_str)
{
unsigned char *bytes;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
int ret; /*tmp return value */
bytes=fvalue_get(fi->value);
@ -2773,7 +2773,7 @@ fill_label_boolean(field_info *fi, gchar *label_str)
guint32 value;
int ret; /*tmp return value */
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
static const true_false_string default_tf = { "True", "False" };
const true_false_string *tfstring = &default_tf;
@ -2816,7 +2816,7 @@ fill_label_enumerated_bitfield(field_info *fi, gchar *label_str)
guint32 value;
int ret; /*tmp return value */
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
/* Figure out the bit width */
bitwidth = hfinfo_bitwidth(hfinfo);
@ -2852,7 +2852,7 @@ fill_label_numeric_bitfield(field_info *fi, gchar *label_str)
guint32 value;
int ret; /*tmp return value */
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
/* Figure out the bit width */
bitwidth = hfinfo_bitwidth(hfinfo);
@ -2883,7 +2883,7 @@ static void
fill_label_enumerated_uint(field_info *fi, gchar *label_str)
{
char *format = NULL;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
guint32 value;
int ret; /*tmp return value */
@ -2904,7 +2904,7 @@ static void
fill_label_uint(field_info *fi, gchar *label_str)
{
char *format = NULL;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
guint32 value;
int ret; /*tmp return value */
@ -2923,7 +2923,7 @@ static void
fill_label_enumerated_int(field_info *fi, gchar *label_str)
{
char *format = NULL;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
guint32 value;
int ret; /*tmp return value */
@ -2943,7 +2943,7 @@ static void
fill_label_int(field_info *fi, gchar *label_str)
{
char *format = NULL;
header_field_info *hfinfo = fi->hfinfo;
header_field_info *hfinfo = fi->ptr_u.hfinfo;
guint32 value;
int ret; /*tmp return value */
@ -3479,7 +3479,7 @@ proto_can_match_selected(field_info *finfo, epan_dissect_t *edt)
header_field_info *hfinfo;
gint length;
hfinfo = finfo->hfinfo;
hfinfo = finfo->ptr_u.hfinfo;
g_assert(hfinfo);
switch(hfinfo->type) {
@ -3571,7 +3571,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
gint start, length;
guint8 c;
hfinfo = finfo->hfinfo;
hfinfo = finfo->ptr_u.hfinfo;
g_assert(hfinfo);
abbrev_len = strlen(hfinfo->abbrev);
@ -3712,7 +3712,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
break;
case FT_PROTOCOL:
buf = g_strdup(finfo->hfinfo->abbrev);
buf = g_strdup(finfo->ptr_u.hfinfo->abbrev);
break;
default:

View File

@ -1,7 +1,7 @@
/* proto.h
* Definitions for protocol display
*
* $Id: proto.h,v 1.45 2003/11/24 21:12:10 sahlberg Exp $
* $Id: proto.h,v 1.46 2003/11/24 22:11:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -111,7 +111,7 @@ typedef struct field_info {
*/
struct field_info *next;
header_field_info *hfinfo;
};
} ptr_u;
gint start;
gint length;
gint tree_type; /* ETT_* */

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.330 2003/11/18 04:16:28 gerald Exp $
* $Id: main.c,v 1.331 2003/11/24 22:11:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -267,7 +267,7 @@ goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
header_field_info *hfinfo;
guint32 framenum;
hfinfo = cfile.finfo_selected->hfinfo;
hfinfo = cfile.finfo_selected->ptr_u.hfinfo;
g_assert(hfinfo);
if (hfinfo->type == FT_FRAMENUM) {
framenum = fvalue_get_integer(cfile.finfo_selected->value);
@ -945,13 +945,13 @@ tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data _U_)
cfile.finfo_selected = finfo;
set_menus_for_selected_tree_row(&cfile);
if (finfo->hfinfo) {
if (finfo->hfinfo->blurb != NULL &&
finfo->hfinfo->blurb[0] != '\0') {
if (finfo->ptr_u.hfinfo) {
if (finfo->ptr_u.hfinfo->blurb != NULL &&
finfo->ptr_u.hfinfo->blurb[0] != '\0') {
has_blurb = TRUE;
length = strlen(finfo->hfinfo->blurb);
length = strlen(finfo->ptr_u.hfinfo->blurb);
} else {
length = strlen(finfo->hfinfo->name);
length = strlen(finfo->ptr_u.hfinfo->name);
}
if (finfo->length == 0) {
len_str[0] = '\0';
@ -962,11 +962,11 @@ tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data _U_)
}
statusbar_pop_field_msg(); /* get rid of current help msg */
if (length) {
length += strlen(finfo->hfinfo->abbrev) + strlen(len_str) + 10;
length += strlen(finfo->ptr_u.hfinfo->abbrev) + strlen(len_str) + 10;
help_str = g_malloc(sizeof(gchar) * length);
sprintf(help_str, "%s (%s)%s",
(has_blurb) ? finfo->hfinfo->blurb : finfo->hfinfo->name,
finfo->hfinfo->abbrev, len_str);
(has_blurb) ? finfo->ptr_u.hfinfo->blurb : finfo->ptr_u.hfinfo->name,
finfo->ptr_u.hfinfo->abbrev, len_str);
statusbar_push_field_msg(help_str);
g_free(help_str);
} else {

View File

@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
* $Id: menu.c,v 1.109 2003/11/19 00:04:15 ulfl Exp $
* $Id: menu.c,v 1.110 2003/11/24 22:11:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -999,7 +999,7 @@ set_menus_for_selected_tree_row(capture_file *cf)
gboolean properties;
if (cf->finfo_selected != NULL) {
header_field_info *hfinfo = cf->finfo_selected->hfinfo;
header_field_info *hfinfo = cf->finfo_selected->ptr_u.hfinfo;
if (hfinfo->parent == -1) {
properties = prefs_is_registered_protocol(hfinfo->abbrev);
} else {

View File

@ -1,7 +1,7 @@
/* prefs_dlg.c
* Routines for handling preferences
*
* $Id: prefs_dlg.c,v 1.65 2003/11/04 20:33:13 guy Exp $
* $Id: prefs_dlg.c,v 1.66 2003/11/24 22:11:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1308,7 +1308,7 @@ properties_cb(GtkWidget *w, gpointer dummy)
}
/* Find the title for the protocol for the selected field. */
hfinfo = cfile.finfo_selected->hfinfo;
hfinfo = cfile.finfo_selected->ptr_u.hfinfo;
if (hfinfo->parent == -1)
title = prefs_get_title_by_name(hfinfo->abbrev);
else

View File

@ -1,7 +1,7 @@
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
* $Id: rtp_analysis.c,v 1.9 2003/11/03 20:45:25 guy Exp $
* $Id: rtp_analysis.c,v 1.10 2003/11/24 22:11:55 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -1780,14 +1780,14 @@ static gboolean process_node(proto_item *ptree_node, header_field_info *hfinform
finfo = PITEM_FINFO(ptree_node);
if (hfinformation==(finfo->hfinfo)) {
if (hfinformation==(finfo->ptr_u.hfinfo)) {
hfssrc = proto_registrar_get_byname((gchar*) proto_field);
if (hfssrc == NULL)
return FALSE;
for(ptree_node=g_node_first_child(ptree_node); ptree_node!=NULL;
ptree_node=g_node_next_sibling(ptree_node)) {
finfo=PITEM_FINFO(ptree_node);
if (hfssrc==finfo->hfinfo) {
if (hfssrc==finfo->ptr_u.hfinfo) {
if (hfinformation->type==FT_IPv4) {
ipv4 = fvalue_get(finfo->value);
*p_result = ipv4_get_net_order_addr(ipv4);

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) Gilbert Ramirez 2000-2002
* Portions Copyright (c) Novell, Inc. 2000-2003
*
* $Id: packet-ncp2222.inc,v 1.65 2003/10/23 08:16:50 guy Exp $
* $Id: packet-ncp2222.inc,v 1.66 2003/11/24 22:11:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -928,7 +928,7 @@ get_item_string(proto_item *item)
char *
get_item_name(proto_item *item)
{
return PITEM_FINFO(item)->hfinfo->name;
return PITEM_FINFO(item)->ptr_u.hfinfo->name;
}

View File

@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
* $Id: print.c,v 1.57 2002/08/28 21:00:40 jmayer Exp $
* $Id: print.c,v 1.58 2003/11/24 22:11:53 guy Exp $
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
@ -155,7 +155,7 @@ void proto_tree_print_node(GNode *node, gpointer data)
/* If it's uninterpreted data, dump it (unless our caller will
be printing the entire packet in hex). */
if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
if (fi->ptr_u.hfinfo->id == proto_data && pdata->print_hex_for_data) {
/*
* Find the data for this field.
*/

View File

@ -1,7 +1,7 @@
/* proto_hier_stats.c
* Routines for calculating statistics based on protocol.
*
* $Id: proto_hier_stats.c,v 1.17 2003/09/03 23:32:40 guy Exp $
* $Id: proto_hier_stats.c,v 1.18 2003/11/24 22:11:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -86,10 +86,10 @@ process_node(proto_item *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
finfo = PITEM_FINFO(ptree_node);
g_assert(finfo);
stat_node = find_stat_node(parent_stat_node, finfo->hfinfo);
stat_node = find_stat_node(parent_stat_node, finfo->ptr_u.hfinfo);
/* Assert that the finfo is related to a protocol, not a field. */
g_assert(finfo->hfinfo->parent == -1);
g_assert(finfo->ptr_u.hfinfo->parent == -1);
stats = STAT_NODE_STATS(stat_node);
stats->num_pkts_total++;

View File

@ -1,7 +1,7 @@
/* tap-protohierstat.c
* protohierstat 2002 Ronnie Sahlberg
*
* $Id: tap-protohierstat.c,v 1.3 2003/04/23 08:20:02 guy Exp $
* $Id: tap-protohierstat.c,v 1.4 2003/11/24 22:11:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -93,8 +93,8 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, void *d
/* first time we saw a protocol at this leaf */
if(rs->protocol==-1){
rs->protocol=fi->hfinfo->id;
rs->proto_name=fi->hfinfo->abbrev;
rs->protocol=fi->ptr_u.hfinfo->id;
rs->proto_name=fi->ptr_u.hfinfo->abbrev;
rs->frames=1;
rs->bytes=pinfo->fd->pkt_len;
rs->child=new_phs_t(rs);
@ -104,7 +104,7 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, void *d
/* find this protocol in the list of siblings */
for(tmprs=rs;tmprs;tmprs=tmprs->sibling){
if(tmprs->protocol==fi->hfinfo->id){
if(tmprs->protocol==fi->ptr_u.hfinfo->id){
break;
}
}
@ -115,8 +115,8 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, void *d
;
tmprs->sibling=new_phs_t(rs->parent);
rs=tmprs->sibling;
rs->protocol=fi->hfinfo->id;
rs->proto_name=fi->hfinfo->abbrev;
rs->protocol=fi->ptr_u.hfinfo->id;
rs->proto_name=fi->ptr_u.hfinfo->abbrev;
} else {
rs=tmprs;
}