aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dfilter/semcheck.c28
-rw-r--r--epan/proto.c7
-rw-r--r--rawshark.c16
-rw-r--r--ui/gtk/dfilter_expr_dlg.c1
4 files changed, 50 insertions, 2 deletions
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index c6df96daf4..3a82d8d332 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -144,6 +144,18 @@ mk_uint32_fvalue(guint32 val)
return fv;
}
+/* Creates a FT_UINT64 fvalue with a given value. */
+static fvalue_t*
+mk_uint64_fvalue(guint64 val)
+{
+ fvalue_t *fv;
+
+ fv = fvalue_new(FT_UINT64);
+ fvalue_set_integer64(fv, val);
+
+ return fv;
+}
+
/* Try to make an fvalue from a string using a value_string or true_false_string.
* This works only for ftypes that are integers. Returns the created fvalue_t*
* or NULL if impossible. */
@@ -171,8 +183,6 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s)
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
- case FT_UINT64:
- case FT_INT64:
case FT_EUI64:
case FT_PCRE:
case FT_GUID:
@@ -185,10 +195,12 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
+ case FT_UINT64:
case FT_INT8:
case FT_INT16:
case FT_INT24:
case FT_INT32:
+ case FT_INT64:
break;
case FT_NUM_TYPES:
@@ -231,6 +243,18 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s)
dfilter_fail("\"%s\" cannot accept [range] strings as values.",
hfinfo->abbrev);
}
+ else if (hfinfo->display & BASE_VAL64_STRING) {
+ const val64_string *vals = (const val64_string *)hfinfo->strings;
+
+ while (vals->strptr != NULL) {
+ if (g_ascii_strcasecmp(s, vals->strptr) == 0) {
+ return mk_uint64_fvalue(vals->value);
+ }
+ vals++;
+ }
+ dfilter_fail("\"%s\" cannot be found among the possible values for %s.",
+ s, hfinfo->abbrev);
+ }
else if (hfinfo->display == BASE_CUSTOM) {
/* If a user wants to match against a custom string, we would
* somehow have to have the integer value here to pass it in
diff --git a/epan/proto.c b/epan/proto.c
index 122aa40b9c..b2bbe1cba4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4764,6 +4764,13 @@ static const value_string hf_display[] = {
{ BASE_DEC_HEX|BASE_RANGE_STRING, "BASE_DEC_HEX|BASE_RANGE_STRING" },
{ BASE_HEX_DEC|BASE_RANGE_STRING, "BASE_HEX_DEC|BASE_RANGE_STRING" },
{ BASE_CUSTOM|BASE_RANGE_STRING, "BASE_CUSTOM|BASE_RANGE_STRING" },
+ { BASE_NONE|BASE_VAL64_STRING, "BASE_NONE|BASE_VAL64_STRING" },
+ { BASE_DEC|BASE_VAL64_STRING, "BASE_DEC|BASE_VAL64_STRING" },
+ { BASE_HEX|BASE_VAL64_STRING, "BASE_HEX|BASE_VAL64_STRING" },
+ { BASE_OCT|BASE_VAL64_STRING, "BASE_OCT|BASE_VAL64_STRING" },
+ { BASE_DEC_HEX|BASE_VAL64_STRING, "BASE_DEC_HEX|BASE_VAL64_STRING" },
+ { BASE_HEX_DEC|BASE_VAL64_STRING, "BASE_HEX_DEC|BASE_VAL64_STRING" },
+ { BASE_CUSTOM|BASE_VAL64_STRING, "BASE_CUSTOM|BASE_VAL64_STRING" },
{ ABSOLUTE_TIME_LOCAL, "ABSOLUTE_TIME_LOCAL" },
{ ABSOLUTE_TIME_UTC, "ABSOLUTE_TIME_UTC" },
{ ABSOLUTE_TIME_DOY_UTC, "ABSOLUTE_TIME_DOY_UTC" },
diff --git a/rawshark.c b/rawshark.c
index c06855a541..bc9a14e1dc 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -1276,6 +1276,8 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
string_fmt_t *sf;
guint32 uvalue;
gint32 svalue;
+ guint64 uvalue64;
+ gint64 svalue64;
const true_false_string *tfstring = &tfs_true_false;
hfinfo = finfo->hfinfo;
@@ -1347,6 +1349,13 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
g_string_append(label_s, val_to_str(svalue, cVALS(hfinfo->strings), "Unknown"));
}
break;
+ case FT_INT64:
+ DISSECTOR_ASSERT(!hfinfo->bitmask);
+ svalue64 = (gint64)fvalue_get_integer64(&finfo->value);
+ if (hfinfo->display & BASE_VAL64_STRING) {
+ g_string_append(label_s, val64_to_str(svalue64, (const val64_string *)(hfinfo->strings), "Unknown"));
+ }
+ break;
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@@ -1360,6 +1369,13 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
g_string_append(label_s, val_to_str(uvalue, cVALS(hfinfo->strings), "Unknown"));
}
break;
+ case FT_UINT64:
+ DISSECTOR_ASSERT(!hfinfo->bitmask);
+ uvalue64 = fvalue_get_integer64(&finfo->value);
+ if (hfinfo->display & BASE_VAL64_STRING) {
+ g_string_append(label_s, val64_to_str(uvalue64, (const val64_string *)(hfinfo->strings), "Unknown"));
+ }
+ break;
default:
break;
}
diff --git a/ui/gtk/dfilter_expr_dlg.c b/ui/gtk/dfilter_expr_dlg.c
index 6c5ec0ac89..bddc40c1fd 100644
--- a/ui/gtk/dfilter_expr_dlg.c
+++ b/ui/gtk/dfilter_expr_dlg.c
@@ -189,6 +189,7 @@ field_select_row_cb(GtkTreeSelection *sel, gpointer tree)
/* XXX: ToDo: Implement "range-string" filter ? */
if ((hfinfo->strings != NULL) &&
! (hfinfo->display & BASE_RANGE_STRING) &&
+ ! (hfinfo->display & BASE_VAL64_STRING) &&
! ((hfinfo->display & BASE_DISPLAY_E_MASK) == BASE_CUSTOM)) {
const value_string *vals = (const value_string *)hfinfo->strings;
if (hfinfo->display & BASE_EXT_STRING)