one member - or have one that's not used, so get rid of those unions.
svn path=/trunk/; revision=9151
/*
- * $Id: ftypes.c,v 1.17 2003/12/03 08:53:37 guy Exp $
+ * $Id: ftypes.c,v 1.18 2003/12/03 09:28:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
SLAB_ALLOC(fv, fvalue_free_list);
FTYPE_LOOKUP(ftype, ft);
- fv->ptr_u.ftype = ft;
+ fv->ftype = ft;
new_value = ft->new_value;
if (new_value) {
FvalueNewFunc new_value;
FTYPE_LOOKUP(ftype, ft);
- fv->ptr_u.ftype = ft;
+ fv->ftype = ft;
new_value = ft->new_value;
if (new_value) {
fvalue_t *fv;
fv = fvalue_new(ftype);
- if (fv->ptr_u.ftype->val_from_unparsed) {
- if (fv->ptr_u.ftype->val_from_unparsed(fv, s, allow_partial_value, logfunc)) {
+ if (fv->ftype->val_from_unparsed) {
+ if (fv->ftype->val_from_unparsed(fv, s, allow_partial_value, logfunc)) {
return fv;
}
}
fvalue_t *fv;
fv = fvalue_new(ftype);
- if (fv->ptr_u.ftype->val_from_string) {
- if (fv->ptr_u.ftype->val_from_string(fv, s, logfunc)) {
+ if (fv->ftype->val_from_string) {
+ if (fv->ftype->val_from_string(fv, s, logfunc)) {
return fv;
}
}
const char*
fvalue_type_name(fvalue_t *fv)
{
- return fv->ptr_u.ftype->name;
+ return fv->ftype->name;
}
guint
fvalue_length(fvalue_t *fv)
{
- if (fv->ptr_u.ftype->len)
- return fv->ptr_u.ftype->len(fv);
+ if (fv->ftype->len)
+ return fv->ftype->len(fv);
else
- return fv->ptr_u.ftype->wire_size;
+ return fv->ftype->wire_size;
}
int
fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype)
{
- g_assert(fv->ptr_u.ftype->len_string_repr);
- return fv->ptr_u.ftype->len_string_repr(fv, rtype);
+ g_assert(fv->ftype->len_string_repr);
+ return fv->ftype->len_string_repr(fv, rtype);
}
char *
fvalue_to_string_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
{
- g_assert(fv->ptr_u.ftype->val_to_string_repr);
+ g_assert(fv->ftype->val_to_string_repr);
if (!buf) {
buf = g_malloc0(fvalue_string_repr_len(fv, rtype) + 1);
}
- fv->ptr_u.ftype->val_to_string_repr(fv, rtype, buf);
+ fv->ftype->val_to_string_repr(fv, rtype, buf);
return buf;
}
return;
}
- fv->ptr_u.ftype->slice(fv, slice_data->bytes, start_offset, length);
+ fv->ftype->slice(fv, slice_data->bytes, start_offset, length);
}
void
fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
{
- g_assert(fv->ptr_u.ftype->set_value);
- fv->ptr_u.ftype->set_value(fv, value, already_copied);
+ g_assert(fv->ftype->set_value);
+ fv->ftype->set_value(fv, value, already_copied);
}
void
fvalue_set_integer(fvalue_t *fv, guint32 value)
{
- g_assert(fv->ptr_u.ftype->set_value_integer);
- fv->ptr_u.ftype->set_value_integer(fv, value);
+ g_assert(fv->ftype->set_value_integer);
+ fv->ftype->set_value_integer(fv, value);
}
void
fvalue_set_floating(fvalue_t *fv, gdouble value)
{
- g_assert(fv->ptr_u.ftype->set_value_floating);
- fv->ptr_u.ftype->set_value_floating(fv, value);
+ g_assert(fv->ftype->set_value_floating);
+ fv->ftype->set_value_floating(fv, value);
}
gpointer
fvalue_get(fvalue_t *fv)
{
- g_assert(fv->ptr_u.ftype->get_value);
- return fv->ptr_u.ftype->get_value(fv);
+ g_assert(fv->ftype->get_value);
+ return fv->ftype->get_value(fv);
}
guint32
fvalue_get_integer(fvalue_t *fv)
{
- g_assert(fv->ptr_u.ftype->get_value_integer);
- return fv->ptr_u.ftype->get_value_integer(fv);
+ g_assert(fv->ftype->get_value_integer);
+ return fv->ftype->get_value_integer(fv);
}
double
fvalue_get_floating(fvalue_t *fv)
{
- g_assert(fv->ptr_u.ftype->get_value_floating);
- return fv->ptr_u.ftype->get_value_floating(fv);
+ g_assert(fv->ftype->get_value_floating);
+ return fv->ftype->get_value_floating(fv);
}
gboolean
fvalue_eq(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_eq);
- return a->ptr_u.ftype->cmp_eq(a, b);
+ g_assert(a->ftype->cmp_eq);
+ return a->ftype->cmp_eq(a, b);
}
gboolean
fvalue_ne(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_ne);
- return a->ptr_u.ftype->cmp_ne(a, b);
+ g_assert(a->ftype->cmp_ne);
+ return a->ftype->cmp_ne(a, b);
}
gboolean
fvalue_gt(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_gt);
- return a->ptr_u.ftype->cmp_gt(a, b);
+ g_assert(a->ftype->cmp_gt);
+ return a->ftype->cmp_gt(a, b);
}
gboolean
fvalue_ge(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_ge);
- return a->ptr_u.ftype->cmp_ge(a, b);
+ g_assert(a->ftype->cmp_ge);
+ return a->ftype->cmp_ge(a, b);
}
gboolean
fvalue_lt(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_lt);
- return a->ptr_u.ftype->cmp_lt(a, b);
+ g_assert(a->ftype->cmp_lt);
+ return a->ftype->cmp_lt(a, b);
}
gboolean
fvalue_le(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_le);
- return a->ptr_u.ftype->cmp_le(a, b);
+ g_assert(a->ftype->cmp_le);
+ return a->ftype->cmp_le(a, b);
}
gboolean
fvalue_contains(fvalue_t *a, fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ptr_u.ftype->cmp_contains);
- return a->ptr_u.ftype->cmp_contains(a, b);
+ g_assert(a->ftype->cmp_contains);
+ return a->ftype->cmp_contains(a, b);
}
/* ftypes.h
* Definitions for field types
*
- * $Id: ftypes.h,v 1.24 2003/12/03 08:53:37 guy Exp $
+ * $Id: ftypes.h,v 1.25 2003/12/03 09:28:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <epan/dfilter/drange.h>
typedef struct _fvalue_t {
- union {
- ftype_t *ftype;
- } ptr_u;
+ ftype_t *ftype;
union {
/* Put a few basic types in here */
gpointer pointer;
#define FVALUE_CLEANUP(fv) \
{ \
register FvalueFreeFunc free_value; \
- free_value = (fv)->ptr_u.ftype->free_value; \
+ free_value = (fv)->ftype->free_value; \
if (free_value) { \
free_value((fv)); \
} \
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.121 2003/12/03 08:53:36 guy Exp $
+ * $Id: proto.c,v 1.122 2003/12/03 09:28:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* good thing we saved it, now we can reverse the
* memory leak and reclaim it.
*/
- field_info_tmp->ptr_u.next=field_info_free_list;
- field_info_free_list=field_info_tmp;
+ SLAB_FREE(field_info_tmp, field_info_free_list);
}
/* we might throw an exception, keep track of this one
* across the "dangerous" section below.
*/
field_info_tmp=new_fi;
- switch(new_fi->ptr_u.hfinfo->type) {
+ switch(new_fi->hfinfo->type) {
case FT_NONE:
/* no value to set for FT_NONE */
break;
break;
default:
- 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_error("new_fi->hfinfo->type %d (%s) not handled\n",
+ new_fi->hfinfo->type,
+ ftype_name(new_fi->hfinfo->type));
g_assert_not_reached();
break;
}
return;
fi = PITEM_FINFO(pi);
- hfinfo = fi->ptr_u.hfinfo;
+ hfinfo = fi->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);
header_field_info *hfinfo;
guint32 integer;
- hfinfo = fi->ptr_u.hfinfo;
+ hfinfo = fi->hfinfo;
integer = value;
if (hfinfo->bitmask) {
header_field_info *hfinfo;
guint32 integer;
- hfinfo = fi->ptr_u.hfinfo;
+ hfinfo = fi->hfinfo;
integer = (guint32) value;
if (hfinfo->bitmask) {
FIELD_INFO_NEW(fi);
- fi->ptr_u.hfinfo = hfinfo;
+ fi->hfinfo = hfinfo;
fi->start = start;
if (tvb) {
fi->start += tvb_raw_offset(tvb);
fi->length = *length;
fi->tree_type = -1;
fi->visible = PTREE_DATA(tree)->visible;
- fvalue_init(&fi->value, fi->ptr_u.hfinfo->type);
+ fvalue_init(&fi->value, fi->hfinfo->type);
fi->rep = NULL;
/* add the data source tvbuff */
void
proto_item_fill_label(field_info *fi, gchar *label_str)
{
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
guint8 *bytes;
guint32 integer;
fill_label_uint64(field_info *fi, gchar *label_str)
{
unsigned char *bytes;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
int ret; /*tmp return value */
bytes=fvalue_get(&fi->value);
fill_label_int64(field_info *fi, gchar *label_str)
{
unsigned char *bytes;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
int ret; /*tmp return value */
bytes=fvalue_get(&fi->value);
guint32 value;
int ret; /*tmp return value */
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
static const true_false_string default_tf = { "True", "False" };
const true_false_string *tfstring = &default_tf;
guint32 value;
int ret; /*tmp return value */
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
/* Figure out the bit width */
bitwidth = hfinfo_bitwidth(hfinfo);
guint32 value;
int ret; /*tmp return value */
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
/* Figure out the bit width */
bitwidth = hfinfo_bitwidth(hfinfo);
fill_label_enumerated_uint(field_info *fi, gchar *label_str)
{
char *format = NULL;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
guint32 value;
int ret; /*tmp return value */
fill_label_uint(field_info *fi, gchar *label_str)
{
char *format = NULL;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
guint32 value;
int ret; /*tmp return value */
fill_label_enumerated_int(field_info *fi, gchar *label_str)
{
char *format = NULL;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
guint32 value;
int ret; /*tmp return value */
fill_label_int(field_info *fi, gchar *label_str)
{
char *format = NULL;
- header_field_info *hfinfo = fi->ptr_u.hfinfo;
+ header_field_info *hfinfo = fi->hfinfo;
guint32 value;
int ret; /*tmp return value */
header_field_info *hfinfo;
gint length;
- hfinfo = finfo->ptr_u.hfinfo;
+ hfinfo = finfo->hfinfo;
g_assert(hfinfo);
switch(hfinfo->type) {
gint start, length;
guint8 c;
- hfinfo = finfo->ptr_u.hfinfo;
+ hfinfo = finfo->hfinfo;
g_assert(hfinfo);
abbrev_len = strlen(hfinfo->abbrev);
break;
case FT_PROTOCOL:
- buf = g_strdup(finfo->ptr_u.hfinfo->abbrev);
+ buf = g_strdup(finfo->hfinfo->abbrev);
break;
default:
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.50 2003/12/03 08:53:36 guy Exp $
+ * $Id: proto.h,v 1.51 2003/12/03 09:28:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
/* Contains the field information for the proto_item. */
typedef struct field_info {
- union {
- /* the next pointer is only used when keeping track of
- * free (unallocated) field_infos. Such field_info's
- * are never associated with a header_field_info.
- */
- struct field_info *next;
- header_field_info *hfinfo;
- } ptr_u;
+ header_field_info *hfinfo;
gint start;
gint length;
gint tree_type; /* ETT_* */
/* main.c
*
- * $Id: main.c,v 1.335 2003/12/02 23:14:32 guy Exp $
+ * $Id: main.c,v 1.336 2003/12/03 09:28:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
header_field_info *hfinfo;
guint32 framenum;
- hfinfo = cfile.finfo_selected->ptr_u.hfinfo;
+ hfinfo = cfile.finfo_selected->hfinfo;
g_assert(hfinfo);
if (hfinfo->type == FT_FRAMENUM) {
framenum = fvalue_get_integer(&cfile.finfo_selected->value);
cfile.finfo_selected = finfo;
set_menus_for_selected_tree_row(&cfile);
- if (finfo->ptr_u.hfinfo) {
- if (finfo->ptr_u.hfinfo->blurb != NULL &&
- finfo->ptr_u.hfinfo->blurb[0] != '\0') {
+ if (finfo->hfinfo) {
+ if (finfo->hfinfo->blurb != NULL &&
+ finfo->hfinfo->blurb[0] != '\0') {
has_blurb = TRUE;
- length = strlen(finfo->ptr_u.hfinfo->blurb);
+ length = strlen(finfo->hfinfo->blurb);
} else {
- length = strlen(finfo->ptr_u.hfinfo->name);
+ length = strlen(finfo->hfinfo->name);
}
if (finfo->length == 0) {
len_str[0] = '\0';
}
statusbar_pop_field_msg(); /* get rid of current help msg */
if (length) {
- length += strlen(finfo->ptr_u.hfinfo->abbrev) + strlen(len_str) + 10;
+ length += strlen(finfo->hfinfo->abbrev) + strlen(len_str) + 10;
help_str = g_malloc(sizeof(gchar) * length);
sprintf(help_str, "%s (%s)%s",
- (has_blurb) ? finfo->ptr_u.hfinfo->blurb : finfo->ptr_u.hfinfo->name,
- finfo->ptr_u.hfinfo->abbrev, len_str);
+ (has_blurb) ? finfo->hfinfo->blurb : finfo->hfinfo->name,
+ finfo->hfinfo->abbrev, len_str);
statusbar_push_field_msg(help_str);
g_free(help_str);
} else {
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.118 2003/12/01 01:57:14 sharpe Exp $
+ * $Id: menu.c,v 1.119 2003/12/03 09:28:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
gboolean properties;
if (cf->finfo_selected != NULL) {
- header_field_info *hfinfo = cf->finfo_selected->ptr_u.hfinfo;
+ header_field_info *hfinfo = cf->finfo_selected->hfinfo;
if (hfinfo->parent == -1) {
properties = prefs_is_registered_protocol(hfinfo->abbrev);
} else {
/* prefs_dlg.c
* Routines for handling preferences
*
- * $Id: prefs_dlg.c,v 1.66 2003/11/24 22:11:55 guy Exp $
+ * $Id: prefs_dlg.c,v 1.67 2003/12/03 09:28:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
}
/* Find the title for the protocol for the selected field. */
- hfinfo = cfile.finfo_selected->ptr_u.hfinfo;
+ hfinfo = cfile.finfo_selected->hfinfo;
if (hfinfo->parent == -1)
title = prefs_get_title_by_name(hfinfo->abbrev);
else
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
- * $Id: rtp_analysis.c,v 1.11 2003/12/02 21:15:49 guy Exp $
+ * $Id: rtp_analysis.c,v 1.12 2003/12/03 09:28:26 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
finfo = PITEM_FINFO(ptree_node);
- if (hfinformation==(finfo->ptr_u.hfinfo)) {
+ if (hfinformation==(finfo->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->ptr_u.hfinfo) {
+ if (hfssrc==finfo->hfinfo) {
if (hfinformation->type==FT_IPv4) {
ipv4 = fvalue_get(&finfo->value);
*p_result = ipv4_get_net_order_addr(ipv4);
* Portions Copyright (c) Gilbert Ramirez 2000-2002
* Portions Copyright (c) Novell, Inc. 2000-2003
*
- * $Id: packet-ncp2222.inc,v 1.67 2003/12/02 21:15:45 guy Exp $
+ * $Id: packet-ncp2222.inc,v 1.68 2003/12/03 09:28:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
char *
get_item_name(proto_item *item)
{
- return PITEM_FINFO(item)->ptr_u.hfinfo->name;
+ return PITEM_FINFO(item)->hfinfo->name;
}
/* print.c
* Routines for printing packet analysis trees.
*
- * $Id: print.c,v 1.61 2003/11/27 22:29:52 guy Exp $
+ * $Id: print.c,v 1.62 2003/12/03 09:28:19 guy Exp $
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
/* If it's uninterpreted data, dump it (unless our caller will
be printing the entire packet in hex). */
- if (fi->ptr_u.hfinfo->id == proto_data && pdata->print_hex_for_data) {
+ if (fi->hfinfo->id == proto_data && pdata->print_hex_for_data) {
/*
* Find the data for this field.
*/
/* proto_hier_stats.c
* Routines for calculating statistics based on protocol.
*
- * $Id: proto_hier_stats.c,v 1.18 2003/11/24 22:11:53 guy Exp $
+ * $Id: proto_hier_stats.c,v 1.19 2003/12/03 09:28:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
finfo = PITEM_FINFO(ptree_node);
g_assert(finfo);
- stat_node = find_stat_node(parent_stat_node, finfo->ptr_u.hfinfo);
+ stat_node = find_stat_node(parent_stat_node, finfo->hfinfo);
/* Assert that the finfo is related to a protocol, not a field. */
- g_assert(finfo->ptr_u.hfinfo->parent == -1);
+ g_assert(finfo->hfinfo->parent == -1);
stats = STAT_NODE_STATS(stat_node);
stats->num_pkts_total++;
/* tap-protohierstat.c
* protohierstat 2002 Ronnie Sahlberg
*
- * $Id: tap-protohierstat.c,v 1.4 2003/11/24 22:11:53 guy Exp $
+ * $Id: tap-protohierstat.c,v 1.5 2003/12/03 09:28:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
/* first time we saw a protocol at this leaf */
if(rs->protocol==-1){
- rs->protocol=fi->ptr_u.hfinfo->id;
- rs->proto_name=fi->ptr_u.hfinfo->abbrev;
+ rs->protocol=fi->hfinfo->id;
+ rs->proto_name=fi->hfinfo->abbrev;
rs->frames=1;
rs->bytes=pinfo->fd->pkt_len;
rs->child=new_phs_t(rs);
/* find this protocol in the list of siblings */
for(tmprs=rs;tmprs;tmprs=tmprs->sibling){
- if(tmprs->protocol==fi->ptr_u.hfinfo->id){
+ if(tmprs->protocol==fi->hfinfo->id){
break;
}
}
;
tmprs->sibling=new_phs_t(rs->parent);
rs=tmprs->sibling;
- rs->protocol=fi->ptr_u.hfinfo->id;
- rs->proto_name=fi->ptr_u.hfinfo->abbrev;
+ rs->protocol=fi->hfinfo->id;
+ rs->proto_name=fi->hfinfo->abbrev;
} else {
rs=tmprs;
}