summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-12-17 11:38:49 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2014-12-18 11:03:42 +0000
commit361ea8215d1e39a51579b45eadbedd8288d14b20 (patch)
tree12b4b8fd9357743f45c3a5f510e16218b683dd54
parentf5cd21543d332f6c14da88ebd50730750f791dd4 (diff)
downloadwireshark-361ea8215d1e39a51579b45eadbedd8288d14b20.tar.gz
Add support for multifields in custom column
You can now add column with Custom type with more than one field by using OR "||" splitter. Bug: 9695 Change-Id: Ia82a91e7a35b867647d36cb9626e3870f46c0d85 Reviewed-on: https://code.wireshark.org/review/5804 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
-rw-r--r--epan/column-info.h2
-rw-r--r--epan/column-utils.c51
-rw-r--r--epan/epan.c4
-rw-r--r--epan/epan.h2
-rw-r--r--epan/proto.c525
-rw-r--r--epan/proto.h2
6 files changed, 313 insertions, 273 deletions
diff --git a/epan/column-info.h b/epan/column-info.h
index 527121e1f0..81d4888e51 100644
--- a/epan/column-info.h
+++ b/epan/column-info.h
@@ -54,7 +54,7 @@ struct epan_column_info {
gchar **col_title; /**< Column titles */
gchar **col_custom_field; /**< Custom column field */
gint *col_custom_occurrence;/**< Custom column field occurrence */
- gint *col_custom_field_id; /**< Custom column field id */
+ GSList **col_custom_field_ids; /**< Custom column field id */
struct epan_dfilter **col_custom_dfilter; /**< Compiled custom column field */
const gchar **col_data; /**< Column data */
gchar **col_buf; /**< Buffer into which to copy data for column */
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 4bcfded6ee..95615d9961 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -59,7 +59,10 @@ col_setup(column_info *cinfo, const gint num_cols)
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_field_ids = g_new(GSList *, num_cols);
+ for (i = 0; i < num_cols; i++) {
+ cinfo->col_custom_field_ids[i] = NULL;
+ }
cinfo->col_custom_dfilter = g_new(struct epan_dfilter*, num_cols);
cinfo->col_data = g_new(const gchar*, num_cols);
cinfo->col_buf = g_new(gchar*, num_cols);
@@ -73,6 +76,12 @@ col_setup(column_info *cinfo, const gint num_cols)
}
}
+static void
+col_custom_field_ids_free(gpointer data)
+{
+ g_free(data);
+}
+
/* Cleanup all the data structures for constructing column data; undoes
the allocations that col_setup() does. */
void
@@ -87,6 +96,8 @@ col_cleanup(column_info *cinfo)
dfilter_free(cinfo->col_custom_dfilter[i]);
g_free(cinfo->col_buf[i]);
g_free(cinfo->col_expr.col_expr_val[i]);
+ if (cinfo->col_custom_field_ids[i])
+ g_slist_free_full(cinfo->col_custom_field_ids[i], col_custom_field_ids_free);
}
g_free(cinfo->col_fmt);
@@ -96,7 +107,7 @@ col_cleanup(column_info *cinfo)
g_free(cinfo->col_title);
g_free(cinfo->col_custom_field);
g_free(cinfo->col_custom_occurrence);
- g_free(cinfo->col_custom_field_id);
+ g_free(cinfo->col_custom_field_ids);
g_free(cinfo->col_custom_dfilter);
/*
* XXX - MSVC doesn't correctly handle the "const" qualifier; it thinks
@@ -290,9 +301,9 @@ void col_custom_set_edt(epan_dissect_t *edt, column_info *cinfo)
i <= cinfo->col_last[COL_CUSTOM]; i++) {
if (cinfo->fmt_matx[i][COL_CUSTOM] &&
cinfo->col_custom_field[i] &&
- 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_field_ids[i]) {
+ cinfo->col_data[i] = cinfo->col_buf[i];
+ cinfo->col_expr.col_expr[i] = epan_custom_set(edt, cinfo->col_custom_field_ids[i],
cinfo->col_custom_occurrence[i],
cinfo->col_buf[i],
cinfo->col_expr.col_expr_val[i],
@@ -311,14 +322,38 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
for (i = cinfo->col_first[COL_CUSTOM];
i <= cinfo->col_last[COL_CUSTOM]; i++) {
+ int i_list = 0;
+
+ if (cinfo->col_custom_field_ids[i])
+ g_slist_free_full(cinfo->col_custom_field_ids[i], col_custom_field_ids_free);
+
+ cinfo->col_custom_field_ids[i] = NULL;
- cinfo->col_custom_field_id[i] = -1;
if (cinfo->fmt_matx[i][COL_CUSTOM] &&
cinfo->col_custom_dfilter[i]) {
epan_dissect_prime_dfilter(edt, cinfo->col_custom_dfilter[i]);
if (cinfo->col_custom_field) {
- header_field_info* hfinfo = proto_registrar_get_byname(cinfo->col_custom_field[i]);
- cinfo->col_custom_field_id[i] = hfinfo ? hfinfo->id : -1;
+ gchar **fields;
+ gchar *field;
+ int i_field = 0;
+
+ fields = g_strsplit(cinfo->col_custom_field[i], " || ", -1);
+
+ while((field = fields[i_field++])) {
+ int id;
+
+ header_field_info* hfinfo = proto_registrar_get_byname(field);
+ id = hfinfo ? hfinfo->id : -1;
+ if (id >= 0) {
+ int *idx;
+
+ idx = g_new(int, 1);
+ *idx = id;
+ cinfo->col_custom_field_ids[i] = g_slist_insert(cinfo->col_custom_field_ids[i], idx, i_list);
+ i_list += 1;
+ }
+ }
+ g_strfreev(fields);
}
}
}
diff --git a/epan/epan.c b/epan/epan.c
index 2d5ebfe21d..230eebeff3 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -424,12 +424,12 @@ epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
/* ----------------------- */
const gchar *
-epan_custom_set(epan_dissect_t *edt, int field_id,
+epan_custom_set(epan_dissect_t *edt, GSList *field_ids,
gint occurrence,
gchar *result,
gchar *expr, const int size )
{
- return proto_custom_set(edt->tree, field_id, occurrence, result, expr, size);
+ return proto_custom_set(edt->tree, field_ids, occurrence, result, expr, size);
}
void
diff --git a/epan/epan.h b/epan/epan.h
index dfab1126af..a5a08df86c 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -228,7 +228,7 @@ epan_dissect_free(epan_dissect_t* edt);
/** Sets custom column */
const gchar *
-epan_custom_set(epan_dissect_t *edt, int id, gint occurrence,
+epan_custom_set(epan_dissect_t *edt, GSList *ids, gint occurrence,
gchar *result, gchar *expr, const int size);
/**
diff --git a/epan/proto.c b/epan/proto.c
index 3d40fc2303..e583ca1c1e 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4141,7 +4141,7 @@ hfinfo_same_name_get_prev(const header_field_info *hfinfo)
/* -------------------------- */
const gchar *
-proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
+proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
gchar *result, gchar *expr, const int size)
{
guint32 number;
@@ -4163,319 +4163,324 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
char number_buf[32];
const char *number_out;
char *tmpbuf;
+ int *field_idx;
+ int field_id;
+ int ii = 0;
- g_assert(field_id >= 0);
+ g_assert(field_ids != NULL);
+ while ((field_idx = (int *) g_slist_nth_data(field_ids, ii++))) {
+ field_id = *field_idx;
+ PROTO_REGISTRAR_GET_NTH((guint)field_id, hfinfo);
- PROTO_REGISTRAR_GET_NTH((guint)field_id, hfinfo);
+ /* do we need to rewind ? */
+ if (!hfinfo)
+ return "";
- /* do we need to rewind ? */
- if (!hfinfo)
- return "";
-
- if (occurrence < 0) {
- /* Search other direction */
- while (hfinfo->same_name_prev_id != -1) {
- PROTO_REGISTRAR_GET_NTH(hfinfo->same_name_prev_id, hfinfo);
+ if (occurrence < 0) {
+ /* Search other direction */
+ while (hfinfo->same_name_prev_id != -1) {
+ PROTO_REGISTRAR_GET_NTH(hfinfo->same_name_prev_id, hfinfo);
+ }
}
- }
- while (hfinfo) {
- finfos = proto_get_finfo_ptr_array(tree, hfinfo->id);
+ while (hfinfo) {
+ finfos = proto_get_finfo_ptr_array(tree, hfinfo->id);
- if (!finfos || !(len = g_ptr_array_len(finfos))) {
- if (occurrence < 0) {
- hfinfo = hfinfo->same_name_next;
- } else {
- hfinfo = hfinfo_same_name_get_prev(hfinfo);
+ if (!finfos || !(len = g_ptr_array_len(finfos))) {
+ if (occurrence < 0) {
+ hfinfo = hfinfo->same_name_next;
+ } else {
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
+ }
+ continue;
+ }
+
+ /* Are there enough occurrences of the field? */
+ if (((occurrence - prev_len) > len) || ((occurrence + prev_len) < -len)) {
+ if (occurrence < 0) {
+ hfinfo = hfinfo->same_name_next;
+ } else {
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
+ }
+ prev_len += len;
+ continue;
}
- continue;
- }
- /* Are there enough occurrences of the field? */
- if (((occurrence - prev_len) > len) || ((occurrence + prev_len) < -len)) {
+ /* Calculate single index or set outer bounderies */
if (occurrence < 0) {
- hfinfo = hfinfo->same_name_next;
+ i = occurrence + len + prev_len;
+ last = i;
+ } else if (occurrence > 0) {
+ i = occurrence - 1 - prev_len;
+ last = i;
} else {
- hfinfo = hfinfo_same_name_get_prev(hfinfo);
+ i = 0;
+ last = len - 1;
}
- prev_len += len;
- continue;
- }
- /* Calculate single index or set outer bounderies */
- if (occurrence < 0) {
- i = occurrence + len + prev_len;
- last = i;
- } else if (occurrence > 0) {
- i = occurrence - 1 - prev_len;
- last = i;
- } else {
- i = 0;
- last = len - 1;
- }
+ prev_len += len; /* Count handled occurrences */
- prev_len += len; /* Count handled occurrences */
+ while (i <= last) {
+ finfo = (field_info *)g_ptr_array_index(finfos, i);
- while (i <= last) {
- finfo = (field_info *)g_ptr_array_index(finfos, i);
+ if (offset_r && (offset_r < (size - 2)))
+ result[offset_r++] = ',';
- if (offset_r && (offset_r < (size - 2)))
- result[offset_r++] = ',';
+ if (offset_e && (offset_e < (size - 2)))
+ expr[offset_e++] = ',';
- if (offset_e && (offset_e < (size - 2)))
- expr[offset_e++] = ',';
+ switch (hfinfo->type) {
- switch (hfinfo->type) {
+ case FT_NONE: /* Nothing to add */
+ if (offset_r == 0) {
+ result[0] = '\0';
+ } else if (result[offset_r-1] == ',') {
+ result[offset_r-1] = '\0';
+ }
+ break;
- case FT_NONE: /* Nothing to add */
- if (offset_r == 0) {
- result[0] = '\0';
- } else if (result[offset_r-1] == ',') {
- result[offset_r-1] = '\0';
- }
- break;
+ case FT_PROTOCOL:
+ /* prevent multiple "yes" entries by setting result directly */
+ g_strlcpy(result, "Yes", size);
+ 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 = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
+ bytes ? bytes_to_ep_str(bytes, fvalue_length(&finfo->value)) : "<MISSING>",
+ size-offset_r);
+ break;
- case FT_UINT_BYTES:
- case FT_BYTES:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
- bytes ? bytes_to_ep_str(bytes, fvalue_length(&finfo->value)) : "<MISSING>",
- size-offset_r);
- break;
+ case FT_ABSOLUTE_TIME:
+ tmpbuf = abs_time_to_str(NULL, (const nstime_t *)fvalue_get(&finfo->value), (absolute_time_display_e)hfinfo->display, TRUE);
+ offset_r += protoo_strlcpy(result+offset_r,
+ tmpbuf,
+ size-offset_r);
+ wmem_free(NULL, tmpbuf);
+ break;
- case FT_ABSOLUTE_TIME:
- tmpbuf = abs_time_to_str(NULL, (const nstime_t *)fvalue_get(&finfo->value), (absolute_time_display_e)hfinfo->display, TRUE);
- offset_r += protoo_strlcpy(result+offset_r,
- tmpbuf,
- size-offset_r);
- wmem_free(NULL, tmpbuf);
- break;
+ case FT_RELATIVE_TIME:
+ tmpbuf = rel_time_to_secs_str(NULL, (const nstime_t *)fvalue_get(&finfo->value));
+ offset_r += protoo_strlcpy(result+offset_r,
+ tmpbuf,
+ size-offset_r);
+ wmem_free(NULL, tmpbuf);
+ break;
- case FT_RELATIVE_TIME:
- tmpbuf = rel_time_to_secs_str(NULL, (const nstime_t *)fvalue_get(&finfo->value));
- offset_r += protoo_strlcpy(result+offset_r,
- tmpbuf,
- size-offset_r);
- wmem_free(NULL, tmpbuf);
- break;
+ case FT_BOOLEAN:
+ number = 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_r += protoo_strlcpy(result+offset_r,
+ number ?
+ tfstring->true_string :
+ tfstring->false_string, size-offset_r);
- case FT_BOOLEAN:
- number = 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_r += protoo_strlcpy(result+offset_r,
- number ?
- tfstring->true_string :
- tfstring->false_string, size-offset_r);
+ offset_e += protoo_strlcpy(expr+offset_e,
+ number ? "1" : "0", size-offset_e);
+ break;
- offset_e += protoo_strlcpy(expr+offset_e,
- number ? "1" : "0", size-offset_e);
- break;
+ /* XXX - make these just FT_NUMBER? */
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_FRAMENUM:
+ hf_str_val = NULL;
+ number = IS_FT_INT(hfinfo->type) ?
+ (guint32) fvalue_get_sinteger(&finfo->value) :
+ fvalue_get_uinteger(&finfo->value);
- /* XXX - make these just FT_NUMBER? */
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- hf_str_val = NULL;
- number = IS_FT_INT(hfinfo->type) ?
- (guint32) fvalue_get_sinteger(&finfo->value) :
- fvalue_get_uinteger(&finfo->value);
+ if ((hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_CUSTOM) {
+ gchar tmp[ITEM_LABEL_LENGTH];
+ custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hfinfo->strings;
- if ((hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_CUSTOM) {
- gchar tmp[ITEM_LABEL_LENGTH];
- custom_fmt_func_t fmtfunc = (custom_fmt_func_t)hfinfo->strings;
+ DISSECTOR_ASSERT(fmtfunc);
+ fmtfunc(tmp, number);
- DISSECTOR_ASSERT(fmtfunc);
- fmtfunc(tmp, number);
+ offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
- offset_r += protoo_strlcpy(result+offset_r, tmp, size-offset_r);
+ } else if (hfinfo->strings) {
+ number_out = hf_str_val = hf_try_val_to_str(number, hfinfo);
- } else if (hfinfo->strings) {
- number_out = hf_str_val = hf_try_val_to_str(number, hfinfo);
+ if (!number_out)
+ number_out = hfinfo_number_value_format_display(hfinfo, BASE_DEC, number_buf, number);
- if (!number_out)
- number_out = hfinfo_number_value_format_display(hfinfo, BASE_DEC, number_buf, number);
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
- offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ } else {
+ number_out = hfinfo_number_value_format(hfinfo, number_buf, number);
- } else {
- number_out = hfinfo_number_value_format(hfinfo, number_buf, number);
+ offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
+ }
- offset_r += protoo_strlcpy(result+offset_r, number_out, size-offset_r);
- }
+ if (hf_str_val && (hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_NONE) {
+ g_snprintf(expr+offset_e, size-offset_e, "\"%s\"", hf_str_val);
+ } else {
+ number_out = hfinfo_numeric_value_format(hfinfo, number_buf, number);
- if (hf_str_val && (hfinfo->display & FIELD_DISPLAY_E_MASK) == BASE_NONE) {
- g_snprintf(expr+offset_e, size-offset_e, "\"%s\"", hf_str_val);
- } else {
- number_out = hfinfo_numeric_value_format(hfinfo, number_buf, number);
+ g_strlcpy(expr+offset_e, number_out, size-offset_e);
+ }
- g_strlcpy(expr+offset_e, number_out, size-offset_e);
- }
+ offset_e = (int)strlen(expr);
+ break;
- offset_e = (int)strlen(expr);
- break;
+ case FT_INT64:
+ /* XXX: Should handle BASE_CUSTOM ? */
+ g_snprintf(result+offset_r, size-offset_r,
+ "%" G_GINT64_MODIFIER "d",
+ fvalue_get_integer64(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
+ case FT_UINT64:
+ g_snprintf(result+offset_r, size-offset_r,
+ /* XXX: Should handle BASE_CUSTOM ? */
+ "%" G_GINT64_MODIFIER "u",
+ fvalue_get_integer64(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
+ case FT_EUI64:
+ offset_r += protoo_strlcpy(result+offset_r,
+ eui64_to_str(fvalue_get_integer64(&finfo->value)),
+ size-offset_r);
+ break;
- case FT_INT64:
- /* XXX: Should handle BASE_CUSTOM ? */
- g_snprintf(result+offset_r, size-offset_r,
- "%" G_GINT64_MODIFIER "d",
- fvalue_get_integer64(&finfo->value));
- offset_r = (int)strlen(result);
- break;
- case FT_UINT64:
- g_snprintf(result+offset_r, size-offset_r,
- /* XXX: Should handle BASE_CUSTOM ? */
- "%" G_GINT64_MODIFIER "u",
- fvalue_get_integer64(&finfo->value));
- offset_r = (int)strlen(result);
- break;
- case FT_EUI64:
- offset_r += protoo_strlcpy(result+offset_r,
- eui64_to_str(fvalue_get_integer64(&finfo->value)),
- size-offset_r);
- break;
+ case FT_IPv4:
+ ipv4 = (ipv4_addr *)fvalue_get(&finfo->value);
+ n_addr = ipv4_get_net_order_addr(ipv4);
+ offset_r += protoo_strlcpy(result+offset_r,
+ ip_to_str((guint8 *)&n_addr),
+ size-offset_r);
+ break;
- case FT_IPv4:
- ipv4 = (ipv4_addr *)fvalue_get(&finfo->value);
- n_addr = ipv4_get_net_order_addr(ipv4);
- offset_r += protoo_strlcpy(result+offset_r,
- ip_to_str((guint8 *)&n_addr),
- size-offset_r);
- break;
+ case FT_IPv6:
+ ipv6 = (struct e_in6_addr *)fvalue_get(&finfo->value);
+ SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
+ address_to_str_buf(&addr, result+offset_r, size-offset_r);
+ offset_r = (int)strlen(result);
+ break;
- case FT_IPv6:
- ipv6 = (struct e_in6_addr *)fvalue_get(&finfo->value);
- SET_ADDRESS (&addr, AT_IPv6, sizeof(struct e_in6_addr), ipv6);
- address_to_str_buf(&addr, result+offset_r, size-offset_r);
- offset_r = (int)strlen(result);
- break;
+ case FT_ETHER:
+ offset_r += protoo_strlcpy(result+offset_r,
+ bytes_to_ep_str_punct((const guint8 *)fvalue_get(&finfo->value),
+ FT_ETHER_LEN, ':'),
+ size-offset_r);
+ break;
- case FT_ETHER:
- offset_r += protoo_strlcpy(result+offset_r,
- bytes_to_ep_str_punct((const guint8 *)fvalue_get(&finfo->value),
- FT_ETHER_LEN, ':'),
- size-offset_r);
- break;
+ case FT_GUID:
+ offset_r += protoo_strlcpy(result+offset_r,
+ guid_to_ep_str((e_guid_t *)fvalue_get(&finfo->value)),
+ size-offset_r);
+ break;
- case FT_GUID:
- offset_r += protoo_strlcpy(result+offset_r,
- guid_to_ep_str((e_guid_t *)fvalue_get(&finfo->value)),
- size-offset_r);
- break;
+ case FT_REL_OID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
+ rel_oid_resolved_from_encoded(bytes,
+ fvalue_length(&finfo->value)),
+ size-offset_r);
+ offset_e += protoo_strlcpy(expr+offset_e,
+ rel_oid_encoded2string(bytes, fvalue_length(&finfo->value)),
+ size-offset_e);
+ break;
- case FT_REL_OID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
- rel_oid_resolved_from_encoded(bytes,
- fvalue_length(&finfo->value)),
- size-offset_r);
- offset_e += protoo_strlcpy(expr+offset_e,
- rel_oid_encoded2string(bytes, fvalue_length(&finfo->value)),
- size-offset_e);
- break;
+ case FT_OID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
+ oid_resolved_from_encoded(bytes,
+ fvalue_length(&finfo->value)),
+ size-offset_r);
+ offset_e += protoo_strlcpy(expr+offset_e,
+ oid_encoded2string(bytes, fvalue_length(&finfo->value)),
+ size-offset_e);
+ break;
- case FT_OID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
- oid_resolved_from_encoded(bytes,
- fvalue_length(&finfo->value)),
- size-offset_r);
- offset_e += protoo_strlcpy(expr+offset_e,
- oid_encoded2string(bytes, fvalue_length(&finfo->value)),
- size-offset_e);
- break;
+ case FT_SYSTEM_ID:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
+ print_system_id(bytes, fvalue_length(&finfo->value)),
+ size-offset_r);
+ offset_e += protoo_strlcpy(expr+offset_e,
+ print_system_id(bytes, fvalue_length(&finfo->value)),
+ size-offset_e);
+ break;
- case FT_SYSTEM_ID:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
- print_system_id(bytes, fvalue_length(&finfo->value)),
- size-offset_r);
- offset_e += protoo_strlcpy(expr+offset_e,
- print_system_id(bytes, fvalue_length(&finfo->value)),
- size-offset_e);
- break;
+ case FT_FLOAT:
+ g_snprintf(result+offset_r, size-offset_r,
+ "%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
- case FT_FLOAT:
- g_snprintf(result+offset_r, size-offset_r,
- "%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
- offset_r = (int)strlen(result);
- break;
+ case FT_DOUBLE:
+ g_snprintf(result+offset_r, size-offset_r,
+ "%." G_STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
+ offset_r = (int)strlen(result);
+ break;
- case FT_DOUBLE:
- g_snprintf(result+offset_r, size-offset_r,
- "%." G_STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
- offset_r = (int)strlen(result);
- break;
+ case FT_STRING:
+ case FT_STRINGZ:
+ case FT_UINT_STRING:
+ case FT_STRINGZPAD:
+ bytes = (guint8 *)fvalue_get(&finfo->value);
+ offset_r += protoo_strlcpy(result+offset_r,
+ hfinfo_format_text(hfinfo, bytes),
+ size-offset_r);
+ break;
- case FT_STRING:
- case FT_STRINGZ:
- case FT_UINT_STRING:
- case FT_STRINGZPAD:
- bytes = (guint8 *)fvalue_get(&finfo->value);
- offset_r += protoo_strlcpy(result+offset_r,
- hfinfo_format_text(hfinfo, bytes),
- size-offset_r);
+ 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++;
+ }
+
+ switch (hfinfo->type) {
+
+ case FT_BOOLEAN:
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ case FT_FRAMENUM:
+ case FT_INT8:
+ case FT_INT16:
+ case FT_INT24:
+ case FT_INT32:
+ case FT_OID:
+ case FT_REL_OID:
+ case FT_SYSTEM_ID:
+ /* for these types, "expr" is filled in the loop above */
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();
+ /* for all others, just copy "result" to "expr" */
+ g_strlcpy(expr, result, size);
break;
}
- i++;
- }
-
- switch (hfinfo->type) {
- case FT_BOOLEAN:
- case FT_UINT8:
- case FT_UINT16:
- case FT_UINT24:
- case FT_UINT32:
- case FT_FRAMENUM:
- case FT_INT8:
- case FT_INT16:
- case FT_INT24:
- case FT_INT32:
- case FT_OID:
- case FT_REL_OID:
- case FT_SYSTEM_ID:
- /* for these types, "expr" is filled in the loop above */
- break;
-
- default:
- /* for all others, just copy "result" to "expr" */
- g_strlcpy(expr, result, size);
- break;
- }
-
- if (!abbrev) {
- /* Store abbrev for return value */
- abbrev = hfinfo->abbrev;
- }
+ if (!abbrev) {
+ /* Store abbrev for return value */
+ abbrev = hfinfo->abbrev;
+ }
- if (occurrence == 0) {
- /* Fetch next hfinfo with same name (abbrev) */
- hfinfo = hfinfo_same_name_get_prev(hfinfo);
- } else {
- hfinfo = NULL;
+ if (occurrence == 0) {
+ /* Fetch next hfinfo with same name (abbrev) */
+ hfinfo = hfinfo_same_name_get_prev(hfinfo);
+ } else {
+ hfinfo = NULL;
+ }
}
}
diff --git a/epan/proto.h b/epan/proto.h
index dcc97f248a..9512ba5380 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -2427,7 +2427,7 @@ proto_check_field_name(const gchar *field_name);
@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,
+proto_custom_set(proto_tree* tree, GSList *field_id,
gint occurrence,
gchar *result,
gchar *expr, const int size );