From Didier Gautheron: put an "fvalue_t" structure into a "field_info"
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 2 Dec 2003 21:15:49 +0000 (21:15 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 2 Dec 2003 21:15:49 +0000 (21:15 +0000)
structure, rather than separately allocating "fvalue_t"s and having the
"field_info" structure point to them - this appears to speed up protocol
tree construction a bit.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9146 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dfilter/dfvm.c
epan/ftypes/ftypes.c
epan/ftypes/ftypes.h
epan/proto.c
epan/proto.h
gtk/io_stat.c
gtk/main.c
gtk/rtp_analysis.c
packet-ncp2222.inc
packet-smb-sidsnooping.c
tap-iostat.c

index dc8910878ad5978f4066d7670734408f887c72bf..be409ed35b38d85ff859c51fac8d1db91d7fd687 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dfvm.c,v 1.11 2003/11/25 13:20:35 sahlberg Exp $
+ * $Id: dfvm.c,v 1.12 2003/12/02 21:15:48 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -224,7 +224,7 @@ read_tree(dfilter_t *df, proto_tree *tree, header_field_info *hfinfo, int reg)
                len = finfos->len;
                for (i = 0; i < len; i++) {
                        finfo = g_ptr_array_index(finfos, i);
-                       fvalues = g_list_prepend(fvalues, finfo->value);
+                       fvalues = g_list_prepend(fvalues, &finfo->value);
                }
 
                hfinfo = hfinfo->same_name_next;
index 19ebf0bd227d3246c986004f324013ad369d4fa6..10ece8d278fbb0df4bdc032d3eb95f01a52170ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ftypes.c,v 1.15 2003/12/02 09:47:23 sahlberg Exp $
+ * $Id: ftypes.c,v 1.16 2003/12/02 21:15:48 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -206,6 +206,21 @@ fvalue_new(ftenum_t ftype)
        return fv;
 }
 
+void 
+fvalue_init(fvalue_t *fv, ftenum_t ftype)
+{
+       ftype_t                 *ft;
+       FvalueNewFunc           new_value;
+
+       FTYPE_LOOKUP(ftype, ft);
+       fv->ptr_u.ftype = ft;
+
+       new_value = ft->new_value;
+       if (new_value) {
+               new_value(fv);
+       }
+}
+
 fvalue_t*
 fvalue_from_unparsed(ftenum_t ftype, char *s, gboolean allow_partial_value, LogFunc logfunc)
 {
index 9adf60e84ba1dd69f4ce5917daf788a86177d518..ab7052c904d36381883dc86109e91daba3e28661 100644 (file)
@@ -1,7 +1,7 @@
 /* ftypes.h
  * Definitions for field types
  *
- * $Id: ftypes.h,v 1.22 2003/12/02 09:47:23 sahlberg Exp $
+ * $Id: ftypes.h,v 1.23 2003/12/02 21:15:48 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -208,16 +208,24 @@ struct _ftype_t {
 fvalue_t*
 fvalue_new(ftenum_t ftype);
 
+void
+fvalue_init(fvalue_t *fv, ftenum_t ftype);
+
 
 /* Free all memory used by an fvalue_t */
 extern fvalue_t *fvalue_free_list;
-#define FVALUE_FREE(fv)                                                \
+#define FVALUE_CLEANUP(fv)                                     \
        {                                                       \
                register FvalueFreeFunc free_value;             \
-               free_value = fv->ptr_u.ftype->free_value;       \
+               free_value = (fv)->ptr_u.ftype->free_value;     \
                if (free_value) {                               \
-                       free_value(fv);                         \
+                       free_value((fv));                       \
                }                                               \
+       }
+
+#define FVALUE_FREE(fv)                                                \
+       {                                                       \
+               FVALUE_CLEANUP(fv)                              \
                SLAB_FREE(fv, fv->ptr_u.next, fvalue_free_list);\
        }
 
index 2f842ab76c64dcfcd386ed252386f8977ef5d8fc..67206f3dee20c8205245d76fa7b76bc3d5ceb6a0 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.c
  * Routines for protocol tree
  *
- * $Id: proto.c,v 1.119 2003/12/02 10:23:18 sahlberg Exp $
+ * $Id: proto.c,v 1.120 2003/12/02 21:15:47 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -332,7 +332,7 @@ free_node_tree_data(tree_data_t *tree_data)
        if(finfo->rep){                 \
                ITEM_LABEL_FREE(finfo->rep);    \
        }                               \
-       FVALUE_FREE(finfo->value);      \
+       FVALUE_CLEANUP(&finfo->value);  \
        FIELD_INFO_FREE(finfo);
 
 static gboolean
@@ -812,7 +812,7 @@ proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
 static void
 proto_tree_set_protocol_tvb(field_info *fi, tvbuff_t *tvb)
 {
-       fvalue_set(fi->value, tvb, TRUE);
+       fvalue_set(&fi->value, tvb, TRUE);
 }
 
 /* Add a FT_PROTOCOL to a proto_tree */
@@ -912,7 +912,7 @@ proto_tree_set_bytes(field_info *fi, const guint8* start_ptr, gint length)
        if (length > 0) {
                g_byte_array_append(bytes, start_ptr, length);
        }
-       fvalue_set(fi->value, bytes, TRUE);
+       fvalue_set(&fi->value, bytes, TRUE);
 }
 
 
@@ -983,7 +983,7 @@ proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
 static void
 proto_tree_set_time(field_info *fi, nstime_t *value_ptr)
 {
-       fvalue_set(fi->value, value_ptr, FALSE);
+       fvalue_set(&fi->value, value_ptr, FALSE);
 }
 
 /* Add a FT_IPXNET to a proto_tree */
@@ -1046,7 +1046,7 @@ proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
 static void
 proto_tree_set_ipxnet(field_info *fi, guint32 value)
 {
-       fvalue_set_integer(fi->value, value);
+       fvalue_set_integer(&fi->value, value);
 }
 
 /* Add a FT_IPv4 to a proto_tree */
@@ -1109,7 +1109,7 @@ proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
 static void
 proto_tree_set_ipv4(field_info *fi, guint32 value)
 {
-       fvalue_set_integer(fi->value, value);
+       fvalue_set_integer(&fi->value, value);
 }
 
 /* Add a FT_IPv6 to a proto_tree */
@@ -1172,7 +1172,7 @@ proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
 static void
 proto_tree_set_ipv6(field_info *fi, const guint8* value_ptr)
 {
-       fvalue_set(fi->value, (gpointer) value_ptr, FALSE);
+       fvalue_set(&fi->value, (gpointer) value_ptr, FALSE);
 }
 
 static void
@@ -1191,9 +1191,9 @@ proto_tree_set_uint64(field_info *fi, const guint8 *value_ptr, gboolean little_e
                for(i=0;i<8;i++){
                        buffer[i]=value_ptr[7-i];
                }
-               fvalue_set(fi->value, (gpointer)buffer, FALSE);
+               fvalue_set(&fi->value, (gpointer)buffer, FALSE);
        } else {
-               fvalue_set(fi->value, (gpointer)value_ptr, FALSE);
+               fvalue_set(&fi->value, (gpointer)value_ptr, FALSE);
        }
 }
 
@@ -1279,10 +1279,10 @@ proto_item_append_string(proto_item *pi, const char *str)
        fi = PITEM_FINFO(pi);
        hfinfo = fi->ptr_u.hfinfo;
        g_assert(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ);
-       old_str = fvalue_get(fi->value);
+       old_str = fvalue_get(&fi->value);
        new_str = g_malloc(strlen(old_str) + strlen(str) + 1);
        sprintf(new_str, "%s%s", old_str, str);
-       fvalue_set(fi->value, new_str, TRUE);
+       fvalue_set(&fi->value, new_str, TRUE);
 }
 
 /* Set the FT_STRING value */
@@ -1290,7 +1290,7 @@ static void
 proto_tree_set_string(field_info *fi, const char* value,
                gboolean already_allocated)
 {
-       fvalue_set(fi->value, (gpointer) value, already_allocated);
+       fvalue_set(&fi->value, (gpointer) value, already_allocated);
 }
 
 static void
@@ -1367,7 +1367,7 @@ proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
 static void
 proto_tree_set_ether(field_info *fi, const guint8* value)
 {
-       fvalue_set(fi->value, (gpointer) value, FALSE);
+       fvalue_set(&fi->value, (gpointer) value, FALSE);
 }
 
 static void
@@ -1499,7 +1499,7 @@ proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
 static void
 proto_tree_set_float(field_info *fi, float value)
 {
-       fvalue_set_floating(fi->value, value);
+       fvalue_set_floating(&fi->value, value);
 }
 
 /* Add a FT_DOUBLE to a proto_tree */
@@ -1562,7 +1562,7 @@ proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
 static void
 proto_tree_set_double(field_info *fi, double value)
 {
-       fvalue_set_floating(fi->value, value);
+       fvalue_set_floating(&fi->value, value);
 }
 
 /* Add any FT_UINT* to a proto_tree */
@@ -1650,7 +1650,7 @@ proto_tree_set_uint(field_info *fi, guint32 value)
                        integer >>= hfinfo->bitshift;
                }
        }
-       fvalue_set_integer(fi->value, integer);
+       fvalue_set_integer(&fi->value, integer);
 }
 
 /* Add any FT_INT* to a proto_tree */
@@ -1737,7 +1737,7 @@ proto_tree_set_int(field_info *fi, gint32 value)
                        integer >>= hfinfo->bitshift;
                }
        }
-       fvalue_set_integer(fi->value, integer);
+       fvalue_set_integer(&fi->value, integer);
 }
 
 
@@ -1891,10 +1891,9 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
        fi->length = *length;
        fi->tree_type = -1;
        fi->visible = PTREE_DATA(tree)->visible;
+       fvalue_init(&fi->value, fi->ptr_u.hfinfo->type);
        fi->rep = NULL;
 
-       fi->value = fvalue_new(fi->ptr_u.hfinfo->type);
-
        /* add the data source tvbuff */
        fi->ds_tvb=tvb?TVB_GET_DS_TVB(tvb):NULL;
 
@@ -2515,11 +2514,11 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
 
                case FT_BYTES:
                case FT_UINT_BYTES:
-                       bytes = fvalue_get(fi->value);
+                       bytes = fvalue_get(&fi->value);
                        if (bytes) {
                                ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                        "%s: %s", hfinfo->name,
-                                        bytes_to_str(bytes, fvalue_length(fi->value)));
+                                        bytes_to_str(bytes, fvalue_length(&fi->value)));
                                if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
                                        label_str[ITEM_LABEL_LENGTH - 1] = '\0';
                        }
@@ -2584,7 +2583,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                case FT_FLOAT:
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %." STRINGIFY(FLT_DIG) "f",
-                               hfinfo->name, fvalue_get_floating(fi->value));
+                               hfinfo->name, fvalue_get_floating(&fi->value));
                        if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
                                label_str[ITEM_LABEL_LENGTH - 1] = '\0';
                        break;
@@ -2592,7 +2591,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                case FT_DOUBLE:
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %." STRINGIFY(DBL_DIG) "g",
-                               hfinfo->name, fvalue_get_floating(fi->value));
+                               hfinfo->name, fvalue_get_floating(&fi->value));
                        if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
                                label_str[ITEM_LABEL_LENGTH - 1] = '\0';
                        break;
@@ -2600,7 +2599,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                case FT_ABSOLUTE_TIME:
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s", hfinfo->name,
-                               abs_time_to_str(fvalue_get(fi->value)));
+                               abs_time_to_str(fvalue_get(&fi->value)));
                        if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
                                label_str[ITEM_LABEL_LENGTH - 1] = '\0';
                        break;
@@ -2608,13 +2607,13 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                case FT_RELATIVE_TIME:
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s seconds", hfinfo->name,
-                               rel_time_to_secs_str(fvalue_get(fi->value)));
+                               rel_time_to_secs_str(fvalue_get(&fi->value)));
                        if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
                                label_str[ITEM_LABEL_LENGTH - 1] = '\0';
                        break;
 
                case FT_IPXNET:
-                       integer = fvalue_get_integer(fi->value);
+                       integer = fvalue_get_integer(&fi->value);
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: 0x%08X (%s)", hfinfo->name,
                                integer, get_ipxnet_name(integer));
@@ -2623,7 +2622,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                        break;
 
                case FT_ETHER:
-                       bytes = fvalue_get(fi->value);
+                       bytes = fvalue_get(&fi->value);
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s (%s)", hfinfo->name,
                                ether_to_str(bytes),
@@ -2633,7 +2632,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                        break;
 
                case FT_IPv4:
-                       ipv4 = fvalue_get(fi->value);
+                       ipv4 = fvalue_get(&fi->value);
                        n_addr = ipv4_get_net_order_addr(ipv4);
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s (%s)", hfinfo->name,
@@ -2644,7 +2643,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                        break;
 
                case FT_IPv6:
-                       bytes = fvalue_get(fi->value);
+                       bytes = fvalue_get(&fi->value);
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s (%s)", hfinfo->name,
                                get_hostname6((struct e_in6_addr *)bytes),
@@ -2656,7 +2655,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                case FT_STRING:
                case FT_STRINGZ:
                case FT_UINT_STRING:
-                       bytes = fvalue_get(fi->value);
+                       bytes = fvalue_get(&fi->value);
                        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
                                "%s: %s", hfinfo->name,
                                format_text(bytes, strlen(bytes)));
@@ -2680,7 +2679,7 @@ fill_label_uint64(field_info *fi, gchar *label_str)
        header_field_info *hfinfo = fi->ptr_u.hfinfo;
        int                                     ret;    /*tmp return value */
 
-       bytes=fvalue_get(fi->value);
+       bytes=fvalue_get(&fi->value);
        switch(hfinfo->display){
        case BASE_DEC:
                ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -2709,7 +2708,7 @@ fill_label_int64(field_info *fi, gchar *label_str)
        header_field_info *hfinfo = fi->ptr_u.hfinfo;
        int                                     ret;    /*tmp return value */
 
-       bytes=fvalue_get(fi->value);
+       bytes=fvalue_get(&fi->value);
        switch(hfinfo->display){
        case BASE_DEC:
                ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -2748,7 +2747,7 @@ fill_label_boolean(field_info *fi, gchar *label_str)
                tfstring = (const struct true_false_string*) hfinfo->strings;
        }
 
-       value = fvalue_get_integer(fi->value);
+       value = fvalue_get_integer(&fi->value);
        if (hfinfo->bitmask) {
                /* Figure out the bit width */
                bitwidth = hfinfo_bitwidth(hfinfo);
@@ -2792,7 +2791,7 @@ fill_label_enumerated_bitfield(field_info *fi, gchar *label_str)
        format = hfinfo_uint_vals_format(hfinfo);
 
        /* Un-shift bits */
-       unshifted_value = fvalue_get_integer(fi->value);
+       unshifted_value = fvalue_get_integer(&fi->value);
        value = unshifted_value;
        if (hfinfo->bitshift > 0) {
                unshifted_value <<= hfinfo->bitshift;
@@ -2828,7 +2827,7 @@ fill_label_numeric_bitfield(field_info *fi, gchar *label_str)
        format = hfinfo_uint_format(hfinfo);
 
        /* Un-shift bits */
-       unshifted_value = fvalue_get_integer(fi->value);
+       unshifted_value = fvalue_get_integer(&fi->value);
        value = unshifted_value;
        if (hfinfo->bitshift > 0) {
                unshifted_value <<= hfinfo->bitshift;
@@ -2857,7 +2856,7 @@ fill_label_enumerated_uint(field_info *fi, gchar *label_str)
        /* Pick the proper format string */
        format = hfinfo_uint_vals_format(hfinfo);
 
-       value = fvalue_get_integer(fi->value);
+       value = fvalue_get_integer(&fi->value);
 
        /* Fill in the textual info */
        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -2877,7 +2876,7 @@ fill_label_uint(field_info *fi, gchar *label_str)
 
        /* Pick the proper format string */
        format = hfinfo_uint_format(hfinfo);
-       value = fvalue_get_integer(fi->value);
+       value = fvalue_get_integer(&fi->value);
 
        /* Fill in the textual info */
        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -2896,7 +2895,7 @@ fill_label_enumerated_int(field_info *fi, gchar *label_str)
 
        /* Pick the proper format string */
        format = hfinfo_int_vals_format(hfinfo);
-       value = fvalue_get_integer(fi->value);
+       value = fvalue_get_integer(&fi->value);
 
        /* Fill in the textual info */
        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -2916,7 +2915,7 @@ fill_label_int(field_info *fi, gchar *label_str)
 
        /* Pick the proper format string */
        format = hfinfo_int_format(hfinfo);
-       value = fvalue_get_integer(fi->value);
+       value = fvalue_get_integer(&fi->value);
 
        /* Fill in the textual info */
        ret = snprintf(label_str, ITEM_LABEL_LENGTH,
@@ -3595,7 +3594,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                        dfilter_len = abbrev_len + 4 + 11 + 1;
                        buf = g_malloc0(dfilter_len);
                        format = hfinfo_numeric_format(hfinfo);
-                       snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer(finfo->value));
+                       snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer(&finfo->value));
                        break;
 
                case FT_UINT64:
@@ -3604,7 +3603,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                         * N bytes for the string for the number.
                         * 1 byte for the trailing '\0'.
                         */
-                       stringified = u64toa(fvalue_get(finfo->value));
+                       stringified = u64toa(fvalue_get(&finfo->value));
                        dfilter_len = abbrev_len + 4 + strlen(stringified) +1;
                        buf = g_malloc0(dfilter_len);
                        snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
@@ -3617,7 +3616,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                         * N bytes for the string for the number.
                         * 1 byte for the trailing '\0'.
                         */
-                       stringified = i64toa(fvalue_get(finfo->value));
+                       stringified = i64toa(fvalue_get(&finfo->value));
                        dfilter_len = abbrev_len + 4 + strlen(stringified) +1;
                        buf = g_malloc0(dfilter_len);
                        snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
@@ -3634,7 +3633,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                        dfilter_len = abbrev_len + 4 + 2 + 8 + 1;
                        buf = g_malloc0(dfilter_len);
                        snprintf(buf, dfilter_len, "%s == 0x%08x", hfinfo->abbrev,
-                                       fvalue_get_integer(finfo->value));
+                                       fvalue_get_integer(&finfo->value));
                        break;
 
                case FT_IPv6:
@@ -3643,7 +3642,7 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                         * N bytes for the string for the address.
                         * 1 byte for the trailing '\0'.
                         */
-                       stringified = ip6_to_str((struct e_in6_addr*) fvalue_get(finfo->value));
+                       stringified = ip6_to_str((struct e_in6_addr*) fvalue_get(&finfo->value));
                        dfilter_len = abbrev_len + 4 + strlen(stringified) + 1;
                        buf = g_malloc0(dfilter_len);
                        snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
@@ -3666,14 +3665,14 @@ proto_construct_dfilter_string(field_info *finfo, epan_dissect_t *edt)
                         *      4 bytes for " == ".
                         *      1 byte for trailing NUL.
                         */
-                       dfilter_len = fvalue_string_repr_len(finfo->value,
+                       dfilter_len = fvalue_string_repr_len(&finfo->value,
                                        FTREPR_DFILTER);
                        dfilter_len += abbrev_len + 4 + 1;
                        buf = g_malloc0(dfilter_len);
 
                        /* Create the string */
                        snprintf(buf, dfilter_len, "%s == ", hfinfo->abbrev);
-                       fvalue_to_string_repr(finfo->value,
+                       fvalue_to_string_repr(&finfo->value,
                                        FTREPR_DFILTER,
                                        &buf[abbrev_len + 4]);
                        break;
index 671e94abedeb289e7fccb37d518f32f3747b786a..f508dd42da98c111d97d64f0ef72a3eb935d7b7f 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.h
  * Definitions for protocol display
  *
- * $Id: proto.h,v 1.48 2003/11/26 12:22:22 sahlberg Exp $
+ * $Id: proto.h,v 1.49 2003/12/02 21:15:47 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -123,8 +123,8 @@ typedef struct field_info {
        gint                            tree_type; /* ETT_* */
        item_label_t                    *rep; /* string for GUI tree */
        int                             visible;
-       fvalue_t                        *value;
        tvbuff_t                        *ds_tvb;  /* data source tvbuff */
+       fvalue_t                        value;
 } field_info;
 
 /* One of these exists for the entire protocol tree. Each proto_node
index 37a9f3766557eb17c833f321c8d5a4a88b054562..9fd40d247541b3c3ff83a2af2b94f3b607aa81e0 100644 (file)
@@ -1,7 +1,7 @@
 /* io_stat.c
  * io_stat   2002 Ronnie Sahlberg
  *
- * $Id: io_stat.c,v 1.47 2003/10/27 23:12:53 guy Exp $
+ * $Id: io_stat.c,v 1.48 2003/12/02 21:15:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -290,7 +290,7 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, void *dummy
                        case FT_INT16:
                        case FT_INT24:
                        case FT_INT32:
-                               new_int=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                               new_int=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
 
                                if((new_int>it->int_max)||(it->frames==0)){
                                        it->int_max=new_int;
@@ -301,7 +301,7 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, void *dummy
                                it->int_tot+=new_int;
                                break;
                        case FT_RELATIVE_TIME:
-                               new_time=fvalue_get(((field_info *)gp->pdata[0])->value);
+                               new_time=fvalue_get(&((field_info *)gp->pdata[0])->value);
 
                                switch(git->calc_type){
 #ifdef G_HAVE_UINT64
index 60572a121bedc8c1dff40cb45daab2e6e68afd2d..c8271f0470b1fa11f2ad28985553b308e6152fe4 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.333 2003/11/28 00:13:08 ulfl Exp $
+ * $Id: main.c,v 1.334 2003/12/02 21:15:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -275,7 +275,7 @@ goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
        hfinfo = cfile.finfo_selected->ptr_u.hfinfo;
        g_assert(hfinfo);
        if (hfinfo->type == FT_FRAMENUM) {
-           framenum = fvalue_get_integer(cfile.finfo_selected->value);
+           framenum = fvalue_get_integer(&cfile.finfo_selected->value);
            if (framenum != 0)
                goto_frame(&cfile, framenum);
        }
index 33601b6ae8b2b8b0013e1135e730f6a36a8a240c..84a15d4b766b52dc4899179e5cb96ba2443b958a 100644 (file)
@@ -1,7 +1,7 @@
 /* rtp_analysis.c
  * RTP analysis addition for ethereal
  *
- * $Id: rtp_analysis.c,v 1.10 2003/11/24 22:11:55 guy Exp $
+ * $Id: rtp_analysis.c,v 1.11 2003/12/02 21:15:49 guy Exp $
  *
  * Copyright 2003, Alcatel Business Systems
  * By Lars Ruoff <lars.ruoff@gmx.net>
@@ -1789,11 +1789,11 @@ static gboolean process_node(proto_item *ptree_node, header_field_info *hfinform
                        finfo=PITEM_FINFO(ptree_node);
                        if (hfssrc==finfo->ptr_u.hfinfo) {
                                if (hfinformation->type==FT_IPv4) {
-                                       ipv4 = fvalue_get(finfo->value);
+                                       ipv4 = fvalue_get(&finfo->value);
                                        *p_result = ipv4_get_net_order_addr(ipv4);
                                }
                                else {
-                                       *p_result = fvalue_get_integer(finfo->value);
+                                       *p_result = fvalue_get_integer(&finfo->value);
                                }
                                return TRUE;
                        }
index 74da88cb15dcc3d656ed223879862e49b8db08b9..e05c841e36c700b089618c11e31d88f6097b7c0c 100644 (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.66 2003/11/24 22:11:53 guy Exp $
+ * $Id: packet-ncp2222.inc,v 1.67 2003/12/02 21:15:45 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -915,14 +915,14 @@ ncp_record_find(guint8 func, guint8 subfunc)
 guint
 get_item_value(proto_item *item)
 {
-       return fvalue_get_integer(PITEM_FINFO(item)->value);
+       return fvalue_get_integer(&PITEM_FINFO(item)->value);
 }
 
 
 char *
 get_item_string(proto_item *item)
 {
-       return fvalue_get(PITEM_FINFO(item)->value);
+       return fvalue_get(&PITEM_FINFO(item)->value);
 }
 
 char *
@@ -4604,7 +4604,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                 if (info_type != 0) {    /* Is this  a string or not? */
                                        
                                         if (info_type == 1) {   /* Is this bytes? */
-                                                byte_string = bytes_to_str(fvalue_get(finfo->value), fvalue_length(finfo->value));
+                                                byte_string = bytes_to_str(fvalue_get(&finfo->value), fvalue_length(&finfo->value));
                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
                                                        (const gchar*) ncp_rec->req_info_str->first_string,
                                                                byte_string);
@@ -4612,7 +4612,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                         else
                                         {
                                                 if (info_type == 2) {   /* Is this a String? */
-                                                        uni_to_string(fvalue_get(finfo->value), fvalue_length(finfo->value), non_uni_string);
+                                                        uni_to_string(fvalue_get(&finfo->value), fvalue_length(&finfo->value), non_uni_string);
                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
                                                                (const gchar*) ncp_rec->req_info_str->first_string,
                                                                non_uni_string);
@@ -4621,7 +4621,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                                 {
                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
                                                                (const gchar*) ncp_rec->req_info_str->first_string,
-                                                                       fvalue_get(finfo->value));
+                                                                       fvalue_get(&finfo->value));
                                                 }
                                         }
                                 }
@@ -4629,7 +4629,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                 {
                                        col_append_fstr(pinfo->cinfo, COL_INFO,
                                                (const gchar*) ncp_rec->req_info_str->first_string,
-                                               fvalue_get_integer(finfo->value));
+                                               fvalue_get_integer(&finfo->value));
                                 }
                         }
                        if (len > 1) {
@@ -4641,7 +4641,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                         if (info_type != 0) {    /* Is this  a string or not? */
                                               if (info_type == 1) 
                                               {   /* Is this bytes? */
-                                                byte_string = bytes_to_str(fvalue_get(finfo->value), fvalue_length(finfo->value));
+                                                byte_string = bytes_to_str(fvalue_get(&finfo->value), fvalue_length(&finfo->value));
                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
                                                        (const gchar*) ncp_rec->req_info_str->repeat_string,
                                                                byte_string);
@@ -4649,7 +4649,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                               else
                                               {
                                                         if (info_type == 2) {   /* Is this a String? */
-                                                                uni_to_string(fvalue_get(finfo->value), fvalue_length(finfo->value), non_uni_string);
+                                                                uni_to_string(fvalue_get(&finfo->value), fvalue_length(&finfo->value), non_uni_string);
                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
                                                                        (const gchar*) ncp_rec->req_info_str->repeat_string,
                                                                                non_uni_string);
@@ -4658,7 +4658,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                                         {
                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
                                                                        (const gchar*) ncp_rec->req_info_str->repeat_string,
-                                                                               fvalue_get(finfo->value));
+                                                                               fvalue_get(&finfo->value));
                                                         }
                                               }
                                         }
@@ -4666,7 +4666,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
                                         {
                                                col_append_fstr(pinfo->cinfo, COL_INFO,
                                                        (const gchar*) ncp_rec->req_info_str->repeat_string,
-                                                       fvalue_get_integer(finfo->value));
+                                                       fvalue_get_integer(&finfo->value));
                                         }
                                 }
                        }
index 79a3eb30065c7e79e171c40d43aae447202e3b24..cd8cd6ae42ced4700e2d56df7fe97e491b2d87af 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for snooping SID to name mappings
  * Copyright 2003, Ronnie Sahlberg
  *
- * $Id: packet-smb-sidsnooping.c,v 1.9 2003/06/09 10:08:05 sahlberg Exp $
+ * $Id: packet-smb-sidsnooping.c,v 1.10 2003/12/02 21:15:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -128,7 +128,7 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, vo
                return 0;
        }
        fi=gp->pdata[0];
-       info_level=fi->value->value.integer;
+       info_level=fi->value.value.integer;
 
        if(info_level!=1){
                return 0;
@@ -153,7 +153,7 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, vo
                }
                if(!old_ctx){
                        old_ctx=g_mem_chunk_alloc(ctx_handle_chunk);
-                       memcpy(old_ctx, fi->value->value.bytes->data, 20);
+                       memcpy(old_ctx, fi->value.value.bytes->data, 20);
                }
                g_hash_table_insert(ctx_handle_table, (gpointer)pinfo->fd->num, old_ctx);
 
@@ -210,9 +210,9 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, vo
                fi_name=gp_names->pdata[num_rids-1];
                strncpy(sid_name, sid, len);
                sid_name[len++]='-';
-               len+=sprintf(sid_name+len,"%d",fi_rid->value->value.integer);
+               len+=sprintf(sid_name+len,"%d",fi_rid->value.value.integer);
                sid_name[len]=0;
-               add_sid_name_mapping(sid_name, fi_name->value->value.string);
+               add_sid_name_mapping(sid_name, fi_name->value.value.string);
        }
        return 1;
 }
@@ -237,7 +237,7 @@ lsa_policy_information(void *dummy _U_, packet_info *pinfo _U_, epan_dissect_t *
                return 0;
        }
        fi=gp->pdata[0];
-       info_level=fi->value->value.integer;
+       info_level=fi->value.value.integer;
 
        switch(info_level){
        case 3:
@@ -248,14 +248,14 @@ lsa_policy_information(void *dummy _U_, packet_info *pinfo _U_, epan_dissect_t *
                        return 0;
                }
                fi=gp->pdata[0];
-               domain=fi->value->value.string;
+               domain=fi->value.value.string;
 
                gp=proto_get_finfo_ptr_array(edt->tree, hf_lsa_domain_sid);
                if(!gp || gp->len!=1){
                        return 0;
                }
                fi=gp->pdata[0];
-               sid=fi->value->value.string;
+               sid=fi->value.value.string;
 
                add_sid_name_mapping(sid, domain);
                break;
index 153f50fcb7163dfffea521dcdb95e3dd0cff3be6..d90344f631aac51fa031a914590010b2efb9d1d8 100644 (file)
@@ -1,7 +1,7 @@
 /* tap-iostat.c
  * iostat   2002 Ronnie Sahlberg
  *
- * $Id: tap-iostat.c,v 1.8 2003/04/29 08:47:20 sahlberg Exp $
+ * $Id: tap-iostat.c,v 1.9 2003/12/02 21:15:46 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -118,7 +118,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                gp=proto_get_finfo_ptr_array(edt->tree, it->hf_index);
                if(gp){
                        for(i=0;i<gp->len;i++){
-                               it->counter+=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                               it->counter+=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                        }
                }
                break;
@@ -136,7 +136,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                case FT_UINT16:
                                case FT_UINT24:
                                case FT_UINT32:
-                                       val=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                                       val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
                                        } else if(val<it->counter){
@@ -147,7 +147,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                case FT_INT16:
                                case FT_INT24:
                                case FT_INT32:
-                                       val=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                                       val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
                                        } else if((gint32)val<(gint32)(it->counter)){
@@ -155,7 +155,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                        }                               
                                        break;
                                case FT_RELATIVE_TIME:
-                                       new_time=fvalue_get(((field_info *)gp->pdata[i])->value);
+                                       new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
                                        val=new_time->secs*1000+new_time->nsecs/1000000;
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
@@ -181,7 +181,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                case FT_UINT16:
                                case FT_UINT24:
                                case FT_UINT32:
-                                       val=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                                       val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
                                        } else if(val>it->counter){
@@ -192,7 +192,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                case FT_INT16:
                                case FT_INT24:
                                case FT_INT32:
-                                       val=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                                       val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
                                        } else if((gint32)val>(gint32)(it->counter)){
@@ -200,7 +200,7 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                        }                               
                                        break;
                                case FT_RELATIVE_TIME:
-                                       new_time=fvalue_get(((field_info *)gp->pdata[i])->value);
+                                       new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
                                        val=new_time->secs*1000+new_time->nsecs/1000000;
                                        if((it->frames==1)&&(i==0)){
                                                it->counter=val;
@@ -231,11 +231,11 @@ iostat_packet(io_stat_item_t *mit, packet_info *pinfo, epan_dissect_t *edt _U_,
                                case FT_INT16:
                                case FT_INT24:
                                case FT_INT32:
-                                       val=fvalue_get_integer(((field_info *)gp->pdata[i])->value);
+                                       val=fvalue_get_integer(&((field_info *)gp->pdata[i])->value);
                                        it->counter+=val;
                                        break;
                                case FT_RELATIVE_TIME:
-                                       new_time=fvalue_get(((field_info *)gp->pdata[i])->value);
+                                       new_time=fvalue_get(&((field_info *)gp->pdata[i])->value);
                                        val=new_time->secs*1000+new_time->nsecs/1000000;
                                        it->counter+=val;
                                        break;