summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorSake Blok <sake@euronet.nl>2010-09-22 20:56:14 +0000
committerSake Blok <sake@euronet.nl>2010-09-22 20:56:14 +0000
commit7364bef1b3262a02a649c7375acf48076e170706 (patch)
treea9a6e294a01ccdc4d73332108c123f40afbc0fe6 /epan
parent8e278e7f90f3b93e3f2760babf8eff08756cf965 (diff)
downloadwireshark-7364bef1b3262a02a649c7375acf48076e170706.tar.gz
When using a custom column, make it possible to select which occurrence to show if the field has multiple occurrences.
svn path=/trunk/; revision=34186
Diffstat (limited to 'epan')
-rw-r--r--epan/column-utils.c2
-rw-r--r--epan/column.c17
-rw-r--r--epan/column.h2
-rw-r--r--epan/column_info.h3
-rw-r--r--epan/epan.c3
-rw-r--r--epan/epan.h2
-rw-r--r--epan/prefs.c18
-rw-r--r--epan/proto.c371
-rw-r--r--epan/proto.h2
9 files changed, 246 insertions, 174 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 225eb39141..1a5b9e7f93 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -59,6 +59,7 @@ col_setup(column_info *cinfo, const gint num_cols)
cinfo->col_last = g_new(int, NUM_COL_FMTS);
cinfo->col_title = g_new(gchar*, num_cols);
cinfo->col_custom_field = g_new(gchar*, num_cols);
+ cinfo->col_custom_occurrence = g_new(gint, num_cols);
cinfo->col_custom_field_id = g_new(int, num_cols);
cinfo->col_custom_dfilter = g_new(dfilter_t*, num_cols);
cinfo->col_data = (const gchar **)g_new(gchar*, num_cols);
@@ -222,6 +223,7 @@ void col_custom_set_edt(epan_dissect_t *edt, column_info *cinfo)
cinfo->col_custom_field_id[i] != -1) {
cinfo->col_data[i] = cinfo->col_buf[i];
cinfo->col_expr.col_expr[i] = epan_custom_set(edt, cinfo->col_custom_field_id[i],
+ cinfo->col_custom_occurrence[i],
cinfo->col_buf[i],
cinfo->col_expr.col_expr_val[i],
COL_MAX_LEN);
diff --git a/epan/column.c b/epan/column.c
index b1b0504500..ef5a3ce503 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -725,6 +725,20 @@ get_column_custom_field(const gint col)
return(cfmt->custom_field);
}
+gint
+get_column_custom_occurrence(const gint col)
+{
+ GList *clp = g_list_nth(prefs.col_list, col);
+ fmt_data *cfmt;
+
+ if (!clp) /* Invalid column requested */
+ return 0;
+
+ cfmt = (fmt_data *) clp->data;
+
+ return(cfmt->custom_occurrence);
+}
+
void
build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
{
@@ -739,14 +753,17 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
if (cinfo->col_fmt[i] == COL_CUSTOM) {
cinfo->col_custom_field[i] = g_strdup(get_column_custom_field(i));
+ cinfo->col_custom_occurrence[i] = get_column_custom_occurrence(i);
if(!dfilter_compile(cinfo->col_custom_field[i], &cinfo->col_custom_dfilter[i])) {
/* XXX: Should we issue a warning? */
g_free(cinfo->col_custom_field[i]);
cinfo->col_custom_field[i] = NULL;
+ cinfo->col_custom_occurrence[i] = 0;
cinfo->col_custom_dfilter[i] = NULL;
}
} else {
cinfo->col_custom_field[i] = NULL;
+ cinfo->col_custom_occurrence[i] = 0;
cinfo->col_custom_dfilter[i] = NULL;
}
diff --git a/epan/column.h b/epan/column.h
index e402eeaaae..ff8ca8eb13 100644
--- a/epan/column.h
+++ b/epan/column.h
@@ -33,6 +33,7 @@ typedef struct _fmt_data {
gchar *title;
gchar *fmt;
gchar *custom_field;
+ gint custom_occurrence;
gboolean visible;
gboolean resolved;
} fmt_data;
@@ -48,6 +49,7 @@ void set_column_visible(const gint, gboolean);
gboolean get_column_resolved(const gint);
void set_column_resolved(const gint, gboolean);
const gchar *get_column_custom_field(const gint);
+gint get_column_custom_occurrence(const gint);
const gchar *get_column_width_string(const gint, const gint);
const char *get_column_longest_string(const gint);
gint get_column_char_width(const gint format);
diff --git a/epan/column_info.h b/epan/column_info.h
index 91489c113a..bce6473417 100644
--- a/epan/column_info.h
+++ b/epan/column_info.h
@@ -44,7 +44,7 @@ typedef struct {
gchar **col_expr_val; /**< Value for filter expression */
} col_expr_t;
-/** Coulmn info */
+/** Column info */
typedef struct _column_info {
gint num_cols; /**< Number of columns */
gint *col_fmt; /**< Format of column */
@@ -53,6 +53,7 @@ typedef struct _column_info {
gint *col_last; /**< Last column number with a given format */
gchar **col_title; /**< Column titles */
gchar **col_custom_field; /**< Custom column field */
+ gint *col_custom_occurrence;/**< Custom column field id*/
gint *col_custom_field_id; /**< Custom column field id*/
struct _dfilter_t **col_custom_dfilter; /**< Compiled custom column field */
const gchar **col_data; /**< Column data */
diff --git a/epan/epan.c b/epan/epan.c
index 021958efc0..236ea20b92 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -235,10 +235,11 @@ epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
/* ----------------------- */
const gchar *
epan_custom_set(epan_dissect_t *edt, int field_id,
+ gint occurrence,
gchar *result,
gchar *expr, const int size )
{
- return proto_custom_set(edt->tree, field_id, result, expr, size);
+ return proto_custom_set(edt->tree, field_id, occurrence, result, expr, size);
}
void
diff --git a/epan/epan.h b/epan/epan.h
index 3beb8e9047..43501d2b10 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -124,7 +124,7 @@ epan_dissect_free(epan_dissect_t* edt);
/** Sets custom column */
const gchar *
-epan_custom_set(epan_dissect_t *edt, int id,
+epan_custom_set(epan_dissect_t *edt, int id, gint occurrence,
gchar *result, gchar *expr, const int size);
/**
diff --git a/epan/prefs.c b/epan/prefs.c
index 1368367700..6df0875f55 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -1139,6 +1139,7 @@ init_prefs(void) {
cfmt->visible = TRUE;
cfmt->resolved = TRUE;
cfmt->custom_field = NULL;
+ cfmt->custom_occurrence = 0;
prefs.col_list = g_list_append(prefs.col_list, cfmt);
}
prefs.num_cols = DEF_NUM_COLS;
@@ -1933,7 +1934,7 @@ try_convert_to_custom_column(gpointer *el_data)
haystack_fmt = col_format_to_string(migrated_columns[haystack_idx].el);
if (strcmp(haystack_fmt, *fmt) == 0) {
- gchar *cust_col = g_strdup_printf("%%Cus:%s",
+ gchar *cust_col = g_strdup_printf("%%Cus:%s:0",
migrated_columns[haystack_idx].col_expr);
g_free(*fmt);
@@ -1957,6 +1958,7 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
module_t *module;
pref_t *pref;
gboolean had_a_dot;
+ gchar **cust_format_info;
const gchar *cust_format = col_format_to_string(COL_CUSTOM);
size_t cust_format_len = strlen(cust_format);
@@ -2035,11 +2037,19 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
if (strncmp(col_l_elt->data, cust_format, cust_format_len) == 0) {
cfmt->fmt = g_strdup(cust_format);
prefs_fmt = g_strdup(col_l_elt->data);
- cfmt->custom_field = g_strdup(&prefs_fmt[cust_format_len+1]); /* add 1 for ':' */
+ cust_format_info = g_strsplit(&prefs_fmt[cust_format_len+1],":",2); /* add 1 for ':' */
+ cfmt->custom_field = g_strdup(cust_format_info[0]);
+ if (cfmt->custom_field && cust_format_info[1]) {
+ cfmt->custom_occurrence = (int)strtol(cust_format_info[1],NULL,10);
+ } else {
+ cfmt->custom_occurrence = 0;
+ }
+ g_strfreev(cust_format_info);
} else {
cfmt->fmt = g_strdup(col_l_elt->data);
prefs_fmt = g_strdup(cfmt->fmt);
cfmt->custom_field = NULL;
+ cfmt->custom_occurrence = 0;
}
cfmt->visible = prefs_is_column_hidden (cols_hidden_list, prefs_fmt) ? FALSE : TRUE;
cfmt->resolved = TRUE;
@@ -3067,7 +3077,7 @@ write_prefs(char **pf_path_return)
cfmt = (fmt_data *) clp->data;
col_l = g_list_append(col_l, g_strdup(cfmt->title));
if ((strcmp(cfmt->fmt, cust_format) == 0) && (cfmt->custom_field)) {
- prefs_fmt = g_strdup_printf("%s:%s", cfmt->fmt, cfmt->custom_field);
+ prefs_fmt = g_strdup_printf("%s:%s:%d", cfmt->fmt, cfmt->custom_field, cfmt->custom_occurrence);
col_l = g_list_append(col_l, prefs_fmt);
} else {
prefs_fmt = cfmt->fmt;
@@ -3311,8 +3321,10 @@ copy_prefs(e_prefs *dest, e_prefs *src)
dest_cfmt->fmt = g_strdup(src_cfmt->fmt);
if (src_cfmt->custom_field) {
dest_cfmt->custom_field = g_strdup(src_cfmt->custom_field);
+ dest_cfmt->custom_occurrence = src_cfmt->custom_occurrence;
} else {
dest_cfmt->custom_field = NULL;
+ dest_cfmt->custom_occurrence = 0;
}
dest_cfmt->visible = src_cfmt->visible;
dest_cfmt->resolved = src_cfmt->resolved;
diff --git a/epan/proto.c b/epan/proto.c
index cbcb56ba30..65bd3bfdbf 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -3418,8 +3418,8 @@ proto_tree_set_representation(proto_item *pi, const char *format, va_list ap)
/* -------------------------- */
const gchar *
-proto_custom_set(proto_tree* tree, const int field_id, gchar *result,
- gchar *expr, const int size)
+proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
+ gchar *result, gchar *expr, const int size)
{
guint32 u_integer;
gint32 integer;
@@ -3430,7 +3430,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gchar *result,
guint32 n_addr; /* network-order IPv4 address */
const true_false_string *tfstring;
- int len;
+ int len, last, i, offset=0;
GPtrArray *finfos;
field_info *finfo;
header_field_info* hfinfo;
@@ -3450,172 +3450,207 @@ proto_custom_set(proto_tree* tree, const int field_id, gchar *result,
hfinfo = hfinfo->same_name_next;
continue;
}
- /* get the last one */
- finfo = g_ptr_array_index(finfos, len -1);
- switch(hfinfo->type) {
-
- case FT_NONE: /* Nothing to add */
- result[0] = '\0';
- break;
-
- case FT_PROTOCOL:
- g_strlcpy(result, "Yes", size);
- break;
-
- case FT_UINT_BYTES:
- case FT_BYTES:
- bytes = fvalue_get(&finfo->value);
- g_strlcpy(result, bytes_to_str(bytes, fvalue_length(&finfo->value)), size);
- break;
-
- case FT_ABSOLUTE_TIME:
- g_strlcpy(result,
- abs_time_to_str(fvalue_get(&finfo->value), hfinfo->display, TRUE),
- size);
- break;
-
- case FT_RELATIVE_TIME:
- g_strlcpy(result, rel_time_to_secs_str(fvalue_get(&finfo->value)), size);
- break;
-
- case FT_BOOLEAN:
- u_integer = fvalue_get_uinteger(&finfo->value);
- tfstring = (const true_false_string *)&tfs_true_false;
- if (hfinfo->strings) {
- tfstring = (const struct true_false_string*) hfinfo->strings;
- }
- g_strlcpy(result, u_integer ? tfstring->true_string : tfstring->false_string, size);
- break;
-
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- u_integer = fvalue_get_uinteger(&finfo->value);
- if (hfinfo->strings) {
- if (hfinfo->display & BASE_RANGE_STRING) {
- g_strlcpy(result, rval_to_str(u_integer, hfinfo->strings, "%u"), size);
- } else if (hfinfo->display & BASE_EXT_STRING) {
- g_strlcpy(result, val_to_str_ext(u_integer, (value_string_ext *) (hfinfo->strings), "%u"), size);
- } else {
- g_strlcpy(result, val_to_str(u_integer, cVALS(hfinfo->strings), "%u"), size);
- }
- } else if (IS_BASE_DUAL(hfinfo->display)) {
- g_snprintf(result, size, hfinfo_uint_value_format(hfinfo), u_integer, u_integer);
- } else {
- g_snprintf(result, size, hfinfo_uint_value_format(hfinfo), u_integer);
- }
- break;
-
- case FT_INT64:
- case FT_UINT64:
- g_snprintf(result, size, "%" G_GINT64_MODIFIER "u", fvalue_get_integer64(&finfo->value));
- break;
-
- /* XXX - make these just FT_INT? */
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- integer = fvalue_get_sinteger(&finfo->value);
- if (hfinfo->strings) {
- if (hfinfo->display & BASE_RANGE_STRING) {
- g_strlcpy(result, rval_to_str(integer, hfinfo->strings, "%d"), size);
- } else if (hfinfo->display & BASE_EXT_STRING) {
- g_strlcpy(result, val_to_str_ext(integer, (value_string_ext *) (hfinfo->strings), "%d"), size);
- } else {
- g_strlcpy(result, val_to_str(integer, cVALS(hfinfo->strings), "%d"), size);
- }
- } else if (IS_BASE_DUAL(hfinfo->display)) {
- g_snprintf(result, size, hfinfo_int_value_format(hfinfo), integer, integer);
- } else {
- g_snprintf(result, size, hfinfo_int_value_format(hfinfo), integer);
- }
- break;
-
- case FT_IPv4:
- ipv4 = fvalue_get(&finfo->value);
- n_addr = ipv4_get_net_order_addr(ipv4);
- g_strlcpy(result, ip_to_str((guint8 *)&n_addr), size);
- break;
-
- case FT_IPv6:
- ipv6 = fvalue_get(&finfo->value);
- SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
- address_to_str_buf(&addr, result, size);
- break;
-
- case FT_ETHER:
- g_strlcpy(result, bytes_to_str_punct(fvalue_get(&finfo->value), 6, ':'), size);
- break;
-
- case FT_GUID:
- g_strlcpy(result, guid_to_str((e_guid_t *)fvalue_get(&finfo->value)), size);
- break;
-
- case FT_OID:
- bytes = fvalue_get(&finfo->value);
- g_strlcpy(result, oid_resolved_from_encoded(bytes, fvalue_length(&finfo->value)), size);
- break;
-
- case FT_FLOAT:
- g_snprintf(result, size, "%." STRINGIFY(FLT_DIG) "f", fvalue_get_floating(&finfo->value));
- break;
-
- case FT_DOUBLE:
- g_snprintf(result, size, "%." STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
- break;
-
- case FT_EBCDIC:
- case FT_STRING:
- case FT_STRINGZ:
- case FT_UINT_STRING:
- bytes = fvalue_get(&finfo->value);
- g_strlcpy(result, format_text(bytes, strlen(bytes)), size);
- break;
-
- case FT_IPXNET: /*XXX really No column custom ?*/
- case FT_PCRE:
- default:
- g_error("hfinfo->type %d (%s) not handled\n",
- hfinfo->type,
- ftype_name(hfinfo->type));
- DISSECTOR_ASSERT_NOT_REACHED();
- break;
- }
-
- switch(hfinfo->type) {
-
- case FT_BOOLEAN:
- g_snprintf(expr, size, "%u", fvalue_get_uinteger(&finfo->value) ? 1 : 0);
- break;
-
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- g_snprintf(expr, size, hfinfo_numeric_value_format(hfinfo), fvalue_get_uinteger(&finfo->value));
- break;
-
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- g_snprintf(expr, size, hfinfo_numeric_value_format(hfinfo), fvalue_get_sinteger(&finfo->value));
- break;
-
- case FT_OID:
- bytes = fvalue_get(&finfo->value);
- g_strlcpy(expr, oid_encoded2string(bytes, fvalue_length(&finfo->value)), size);
- break;
-
- default:
- g_strlcpy(expr, result, size);
- break;
- }
+ /* Are there enough occurrences of the field? */
+ if ((occurrence > len) || (occurrence < -len) )
+ return "";
+
+ /* calculate single index or set outer bounderies */
+ if (occurrence < 0) {
+ i = occurrence + len;
+ last = i;
+ } else if (occurrence > 0) {
+ i = occurrence - 1;
+ last = i;
+ } else {
+ i = 0;
+ last = len - 1;
+ }
+
+ while (i <= last) {
+ finfo = g_ptr_array_index(finfos, i);
+
+ if (offset && (offset < size-2))
+ result[offset++]=',';
+
+ switch(hfinfo->type) {
+
+ case FT_NONE: /* Nothing to add */
+ result[0] = '\0';
+ break;
+
+ case FT_PROTOCOL:
+ /* prevent multiple "yes" entries by setting result directly */
+ g_strlcpy(result, "Yes", size);
+ break;
+
+ case FT_UINT_BYTES:
+ case FT_BYTES:
+ bytes = fvalue_get(&finfo->value);
+ offset += g_strlcpy(result+offset, bytes_to_str(bytes, fvalue_length(&finfo->value)), size-offset);
+ break;
+
+ case FT_ABSOLUTE_TIME:
+ offset += g_strlcpy(result+offset,
+ abs_time_to_str(fvalue_get(&finfo->value), hfinfo->display, TRUE),
+ size-offset);
+ break;
+
+ case FT_RELATIVE_TIME:
+ offset += g_strlcpy(result+offset, rel_time_to_secs_str(fvalue_get(&finfo->value)), size-offset);
+ break;
+
+ case FT_BOOLEAN:
+ u_integer = fvalue_get_uinteger(&finfo->value);
+ tfstring = (const true_false_string *)&tfs_true_false;
+ if (hfinfo->strings) {
+ tfstring = (const struct true_false_string*) hfinfo->strings;
+ }
+ offset += g_strlcpy(result+offset, u_integer ? tfstring->true_string : tfstring->false_string, size-offset);
+ break;
+
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_FRAMENUM:
+ u_integer = fvalue_get_uinteger(&finfo->value);
+ if (hfinfo->strings) {
+ if (hfinfo->display & BASE_RANGE_STRING) {
+ offset += g_strlcpy(result+offset, rval_to_str(u_integer, hfinfo->strings, "%u"), size-offset);
+ } else if (hfinfo->display & BASE_EXT_STRING) {
+ offset += g_strlcpy(result+offset, val_to_str_ext(u_integer, (value_string_ext *) (hfinfo->strings), "%u"), size-offset);
+ } else {
+ offset += g_strlcpy(result+offset, val_to_str(u_integer, cVALS(hfinfo->strings), "%u"), size-offset);
+ }
+ } else if (IS_BASE_DUAL(hfinfo->display)) {
+ g_snprintf(result+offset, size-offset, hfinfo_uint_value_format(hfinfo), u_integer, u_integer);
+ offset = strlen(result);
+ } else {
+ g_snprintf(result+offset, size-offset, hfinfo_uint_value_format(hfinfo), u_integer);
+ offset = strlen(result);
+ }
+ break;
+
+ case FT_INT64:
+ case FT_UINT64:
+ g_snprintf(result+offset, size-offset, "%" G_GINT64_MODIFIER "u", fvalue_get_integer64(&finfo->value));
+ offset = strlen(result);
+ break;
+
+ /* XXX - make these just FT_INT? */
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ integer = fvalue_get_sinteger(&finfo->value);
+ if (hfinfo->strings) {
+ if (hfinfo->display & BASE_RANGE_STRING) {
+ offset += g_strlcpy(result+offset, rval_to_str(integer, hfinfo->strings, "%d"), size-offset);
+ } else if (hfinfo->display & BASE_EXT_STRING) {
+ offset += g_strlcpy(result+offset, val_to_str_ext(integer, (value_string_ext *) (hfinfo->strings), "%d"), size-offset);
+ } else {
+ offset += g_strlcpy(result+offset, val_to_str(integer, cVALS(hfinfo->strings), "%d"), size-offset);
+ }
+ } else if (IS_BASE_DUAL(hfinfo->display)) {
+ g_snprintf(result+offset, size-offset, hfinfo_int_value_format(hfinfo), integer, integer);
+ offset = strlen(result);
+ } else {
+ g_snprintf(result+offset, size-offset, hfinfo_int_value_format(hfinfo), integer);
+ offset = strlen(result);
+ }
+ break;
+
+ case FT_IPv4:
+ ipv4 = fvalue_get(&finfo->value);
+ n_addr = ipv4_get_net_order_addr(ipv4);
+ offset += g_strlcpy(result+offset, ip_to_str((guint8 *)&n_addr), size-offset);
+ break;
+
+ case FT_IPv6:
+ ipv6 = fvalue_get(&finfo->value);
+ SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
+ address_to_str_buf(&addr, result+offset, size-offset);
+ offset = strlen(result);
+ break;
+
+ case FT_ETHER:
+ offset += g_strlcpy(result+offset, bytes_to_str_punct(fvalue_get(&finfo->value), 6, ':'), size-offset);
+ break;
+
+ case FT_GUID:
+ offset += g_strlcpy(result+offset, guid_to_str((e_guid_t *)fvalue_get(&finfo->value)), size-offset);
+ break;
+
+ case FT_OID:
+ bytes = fvalue_get(&finfo->value);
+ offset += g_strlcpy(result+offset, oid_resolved_from_encoded(bytes, fvalue_length(&finfo->value)), size-offset);
+ break;
+
+ case FT_FLOAT:
+ g_snprintf(result+offset, size-offset, "%." STRINGIFY(FLT_DIG) "f", fvalue_get_floating(&finfo->value));
+ offset = strlen(result);
+ break;
+
+ case FT_DOUBLE:
+ g_snprintf(result+offset, size-offset, "%." STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
+ offset = strlen(result);
+ break;
+
+ case FT_EBCDIC:
+ case FT_STRING:
+ case FT_STRINGZ:
+ case FT_UINT_STRING:
+ bytes = fvalue_get(&finfo->value);
+ offset += g_strlcpy(result+offset, format_text(bytes, strlen(bytes)), size-offset);
+ break;
+
+ case FT_IPXNET: /*XXX really No column custom ?*/
+ case FT_PCRE:
+ default:
+ g_error("hfinfo->type %d (%s) not handled\n",
+ hfinfo->type,
+ ftype_name(hfinfo->type));
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
+ }
+ i++;
+ }
+
+ if(occurrence) {
+ switch(hfinfo->type) {
+
+ case FT_BOOLEAN:
+ g_snprintf(expr, size, "%u", fvalue_get_uinteger(&finfo->value) ? 1 : 0);
+ break;
+
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_FRAMENUM:
+ g_snprintf(expr, size, hfinfo_numeric_value_format(hfinfo), fvalue_get_uinteger(&finfo->value));
+ break;
+
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ g_snprintf(expr, size, hfinfo_numeric_value_format(hfinfo), fvalue_get_sinteger(&finfo->value));
+ break;
+
+ case FT_OID:
+ bytes = fvalue_get(&finfo->value);
+ g_strlcpy(expr, oid_encoded2string(bytes, fvalue_length(&finfo->value)), size);
+ break;
+
+ default:
+ g_strlcpy(expr, result, size);
+ break;
+ }
+ }
+ /*XXSLBXX*/
+
return hfinfo->abbrev;
}
return "";
diff --git a/epan/proto.h b/epan/proto.h
index ee672a7555..19aff82ff7 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -1822,11 +1822,13 @@ proto_check_field_name(const gchar *field_name);
/** Check if given string is a valid field name
@param tree the tree to append this item to
@param field_id the field id used for custom column
+ @param occurrence the occurrence of the field used for custom column
@param result the buffer to fill with the field string
@param expr the filter expression
@param size the size of the string buffer */
const gchar *
proto_custom_set(proto_tree* tree, const int field_id,
+ gint occurrence,
gchar *result,
gchar *expr, const int size );