forked from osmocom/wireshark
Enhance 'tshark -G values': Add info about extended value strings (including acess method).
svn path=/trunk/; revision=34854
This commit is contained in:
parent
e2123574dc
commit
cfdd78166f
40
epan/proto.c
40
epan/proto.c
|
@ -5922,23 +5922,36 @@ proto_registrar_dump_protocols(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dumps the value_strings, range_strings or true/false strings for fields
|
/* Dumps the value_strings, extended value string headers, range_strings
|
||||||
* that have them. There is one record per line. Fields are tab-delimited.
|
* or true/false strings for fields that have them.
|
||||||
* There are three types of records: Value String, Range String
|
* There is one record per line. Fields are tab-delimited.
|
||||||
* and True/False String. The first field, 'V', 'R' or 'T', indicates
|
* 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.
|
* 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
|
* Value Strings
|
||||||
* -------------
|
* -------------
|
||||||
* Field 1 = 'V'
|
* 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 3 = Integer value
|
||||||
* Field 4 = String
|
* 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
|
* Range Strings
|
||||||
* -------------
|
* -------------
|
||||||
* Field 1 = 'R'
|
* 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 3 = Integer value: lower bound
|
||||||
* Field 4 = Integer value: upper bound
|
* Field 4 = Integer value: upper bound
|
||||||
* Field 5 = String
|
* Field 5 = String
|
||||||
|
@ -5946,7 +5959,7 @@ proto_registrar_dump_protocols(void)
|
||||||
* True/False Strings
|
* True/False Strings
|
||||||
* ------------------
|
* ------------------
|
||||||
* Field 1 = 'T'
|
* 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 3 = True String
|
||||||
* Field 4 = False String
|
* Field 4 = False String
|
||||||
*/
|
*/
|
||||||
|
@ -6006,8 +6019,8 @@ proto_registrar_dump_values(void)
|
||||||
hfinfo->type == FT_INT32 ||
|
hfinfo->type == FT_INT32 ||
|
||||||
hfinfo->type == FT_INT64)) {
|
hfinfo->type == FT_INT64)) {
|
||||||
|
|
||||||
if ((hfinfo->display & BASE_EXT_STRING)) {
|
if (hfinfo->display & BASE_EXT_STRING) {
|
||||||
vals = VALUE_STRING_EXT_VS_P((value_string_ext *) hfinfo->strings);
|
vals = VALUE_STRING_EXT_VS_P((value_string_ext *)hfinfo->strings);
|
||||||
} else if ((hfinfo->display & BASE_RANGE_STRING) == 0) {
|
} else if ((hfinfo->display & BASE_RANGE_STRING) == 0) {
|
||||||
vals = hfinfo->strings;
|
vals = hfinfo->strings;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6020,6 +6033,15 @@ proto_registrar_dump_values(void)
|
||||||
|
|
||||||
/* Print value strings? */
|
/* Print value strings? */
|
||||||
if (vals) {
|
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;
|
vi = 0;
|
||||||
while (vals[vi].strptr) {
|
while (vals[vi].strptr) {
|
||||||
/* Print in the proper base */
|
/* Print in the proper base */
|
||||||
|
|
|
@ -297,6 +297,19 @@ _match_strval_ext_init(const guint32 val, value_string_ext *vse)
|
||||||
|
|
||||||
return vse->_vs_match(val, 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.
|
/* Tries to match val against each element in the value_string array vs.
|
||||||
|
|
|
@ -126,7 +126,12 @@ typedef struct _value_string_ext {
|
||||||
const gchar *_vs_name; /* vse "Name" (for error messages) */
|
const gchar *_vs_name; /* vse "Name" (for error messages) */
|
||||||
} value_string_ext;
|
} value_string_ext;
|
||||||
|
|
||||||
|
/* "Acessors" */
|
||||||
#define VALUE_STRING_EXT_VS_P(x) (x)->_vs_p
|
#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);
|
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 }
|
#define VALUE_STRING_EXT_INIT(x) { (_value_string_match_t) _match_strval_ext_init, 0, array_length(x)-1, x, #x }
|
||||||
|
|
Loading…
Reference in New Issue