diff options
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/epan/proto.c b/epan/proto.c index 9746c5476f..ffc4227cbd 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -5078,8 +5078,8 @@ hfinfo_numeric_format(header_field_info *hfinfo) * You do not need to [g_]free() this string since it will be automatically * freed once the next packet is dissected. */ -gboolean -proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt, +static gboolean +construct_match_selected_string(field_info *finfo, epan_dissect_t *edt, char **filter) { header_field_info *hfinfo; @@ -5282,3 +5282,31 @@ proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt, return TRUE; } + +/* + * Returns TRUE if we can do a "match selected" on the field, FALSE + * otherwise. + */ +gboolean +proto_can_match_selected(field_info *finfo, epan_dissect_t *edt) +{ + return construct_match_selected_string(finfo, edt, NULL); +} + +/* This function attempts to construct a "match selected" display filter + * string for the specified field; if it can do so, it returns a pointer + * to the string, otherwise it returns NULL. + * + * The string is allocated with packet lifetime scope. + * You do not need to [g_]free() this string since it will be automatically + * freed once the next packet is dissected. + */ +char* +proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt) +{ + char *filter; + + if (!construct_match_selected_string(finfo, edt, &filter)) + return NULL; + return filter; +} |