diff options
author | Bill Meier <wmeier@newsguy.com> | 2010-11-12 19:48:30 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2010-11-12 19:48:30 +0000 |
commit | cfdd78166fe742e2542ecd33588f09446bc7df59 (patch) | |
tree | 35e6efc6d3293430825377f9297cacf781ea6ca7 /epan | |
parent | e2123574dc110c451867603b0c3d18b286a36541 (diff) |
Enhance 'tshark -G values': Add info about extended value strings (including acess method).
svn path=/trunk/; revision=34854
Diffstat (limited to 'epan')
-rw-r--r-- | epan/proto.c | 40 | ||||
-rw-r--r-- | epan/value_string.c | 13 | ||||
-rw-r--r-- | epan/value_string.h | 5 |
3 files changed, 49 insertions, 9 deletions
diff --git a/epan/proto.c b/epan/proto.c index 34c30bcd0e..227508ed17 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -5922,23 +5922,36 @@ proto_registrar_dump_protocols(void) } } -/* Dumps the value_strings, range_strings or true/false strings for fields - * that have them. There is one record per line. Fields are tab-delimited. - * There are three types of records: Value String, Range String - * and True/False String. The first field, 'V', 'R' or 'T', indicates +/* Dumps the value_strings, extended value string headers, range_strings + * or true/false strings for fields that have them. + * There is one record per line. Fields are tab-delimited. + * There are four types of records: Value String, Extended Value String Header, + * Range String and True/False String. The first field, 'V', 'E', 'R' or 'T', indicates * the type of record. * + * Note that a record will be generated only if the value_string,... is referenced + * in a registered hfinfo entry. + * + * * Value Strings * ------------- * Field 1 = 'V' - * Field 2 = field abbreviation to which this value string corresponds + * Field 2 = Field abbreviation to which this value string corresponds * Field 3 = Integer value * Field 4 = String * + * Extended Value String Headers + * ----------------------------- + * Field 1 = 'E' + * Field 2 = Field abbreviation to which this extended value string header corresponds + * Field 3 = Extended Value String "Name" + * Field 4 = Number of entries in the associated value_string array + * Field 5 = Access Type: "Linear Search", "Binary Search", "Direct (indexed) Access" + * * Range Strings * ------------- * Field 1 = 'R' - * Field 2 = field abbreviation to which this range string corresponds + * Field 2 = Field abbreviation to which this range string corresponds * Field 3 = Integer value: lower bound * Field 4 = Integer value: upper bound * Field 5 = String @@ -5946,7 +5959,7 @@ proto_registrar_dump_protocols(void) * True/False Strings * ------------------ * Field 1 = 'T' - * Field 2 = field abbreviation to which this true/false string corresponds + * Field 2 = Field abbreviation to which this true/false string corresponds * Field 3 = True String * Field 4 = False String */ @@ -6006,8 +6019,8 @@ proto_registrar_dump_values(void) hfinfo->type == FT_INT32 || hfinfo->type == FT_INT64)) { - if ((hfinfo->display & BASE_EXT_STRING)) { - vals = VALUE_STRING_EXT_VS_P((value_string_ext *) hfinfo->strings); + if (hfinfo->display & BASE_EXT_STRING) { + vals = VALUE_STRING_EXT_VS_P((value_string_ext *)hfinfo->strings); } else if ((hfinfo->display & BASE_RANGE_STRING) == 0) { vals = hfinfo->strings; } else { @@ -6020,6 +6033,15 @@ proto_registrar_dump_values(void) /* Print value strings? */ if (vals) { + if (hfinfo->display & BASE_EXT_STRING) { + value_string_ext *vse_p = (value_string_ext *)hfinfo->strings; + match_strval_ext(0, vse_p); /* "prime" the extended value_string */ + printf("E\t%s\t%d\t%s\t%s\n", + hfinfo->abbrev, + VALUE_STRING_EXT_VS_NUM_ENTRIES(vse_p), + VALUE_STRING_EXT_VS_NAME(vse_p), + value_string_ext_match_type_str(vse_p)); + } vi = 0; while (vals[vi].strptr) { /* Print in the proper base */ diff --git a/epan/value_string.c b/epan/value_string.c index 4c54b03743..98c36ed6ee 100644 --- a/epan/value_string.c +++ b/epan/value_string.c @@ -297,6 +297,19 @@ _match_strval_ext_init(const guint32 val, value_string_ext *vse) return vse->_vs_match(val, vse); } + +/* (For use by proto_registrar_dump_values() [See proto.c]) */ +gchar * +value_string_ext_match_type_str(value_string_ext *vse) { + if (vse->_vs_match == _match_strval_linear) + return "[Linear Search]"; + if (vse->_vs_match == _match_strval_bsearch) + return "[Binary Search]"; + if (vse->_vs_match == _match_strval_index) + return "[Direct (indexed) Access]"; + return "[Match Type not initialized]"; +} + /* ----------- */ /* Tries to match val against each element in the value_string array vs. diff --git a/epan/value_string.h b/epan/value_string.h index 35c64b3507..d78c62337a 100644 --- a/epan/value_string.h +++ b/epan/value_string.h @@ -126,7 +126,12 @@ typedef struct _value_string_ext { const gchar *_vs_name; /* vse "Name" (for error messages) */ } value_string_ext; +/* "Acessors" */ #define VALUE_STRING_EXT_VS_P(x) (x)->_vs_p +#define VALUE_STRING_EXT_VS_NUM_ENTRIES(x) (x)->_vs_num_entries +#define VALUE_STRING_EXT_VS_NAME(x) (x)->_vs_name +gchar *value_string_ext_match_type_str(value_string_ext *vse); +/* --- --- */ extern const gchar *_match_strval_ext_init(const guint32 val, value_string_ext *vse); #define VALUE_STRING_EXT_INIT(x) { (_value_string_match_t) _match_strval_ext_init, 0, array_length(x)-1, x, #x } |