forked from osmocom/wireshark
Add FT_STRINGZTRUNC.
FT_STRINGZPAD is for null-*padded* strings, where the field is in an area of specified length, and, if the string is shorter than that length, all bytes past the end of the string are NULs. FT_STRINGZTRUNC is for null-*truncated* strings, where the field is in an area of specified length and, if the string is shorter than that length, there's a null character (which might be more than one byte, for UCS-2, UTF-16, or UTF-32), and anything after that is not guaranteed to have any particular value. Use IS_FT_STRING() in some places rather than enumerating all the string types, so that those places get automatically changed if the set of string types changes.osmith/wip
parent
7811c06272
commit
272502790b
|
@ -916,6 +916,15 @@ The type of value this field holds. The current field types are:
|
|||
This is typically used for fixed-length fields
|
||||
that contain a string value that might be shorter
|
||||
than the fixed length.
|
||||
FT_STRINGZTRUNC A NULL-truncated string of characters.
|
||||
The length is given in the proto_tree_add_item()
|
||||
call, but may be larger than the length of
|
||||
the string, with a NULL character after the last
|
||||
character of the string, and the remaining bytes
|
||||
being padding with unspecified contents. This is
|
||||
typically used for fixed-length fields that contain
|
||||
a string value that might be shorter than the fixed
|
||||
length.
|
||||
FT_UINT_STRING A counted string of characters, consisting
|
||||
of a count (represented as an integral value,
|
||||
of width given in the proto_tree_add_item()
|
||||
|
@ -1327,7 +1336,7 @@ Note that the formats used must all belong to the same group as defined below:
|
|||
- FT_INT40, FT_INT48, FT_INT56 and FT_INT64
|
||||
- FT_UINT40, FT_UINT48, FT_UINT56, FT_UINT64 and FT_EUI64
|
||||
- FT_ABSOLUTE_TIME and FT_RELATIVE_TIME
|
||||
- FT_STRING, FT_STRINGZ, FT_UINT_STRING and FT_STRINGZPAD
|
||||
- FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, and FT_STRINGZTRUNC
|
||||
- FT_FLOAT and FT_DOUBLE
|
||||
- FT_BYTES, FT_UINT_BYTES, FT_ETHER, FT_AX25, FT_VINES and FT_FCWWN
|
||||
- FT_OID, FT_REL_OID and FT_SYSTEM_ID
|
||||
|
|
|
@ -137,6 +137,7 @@ gboolean decode_as_default_reset(const gchar *name, gconstpointer pattern)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
dissector_reset_string(name, (!pattern)?"":(const gchar *) pattern);
|
||||
return TRUE;
|
||||
default:
|
||||
|
@ -164,6 +165,7 @@ gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gcon
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
dissector_change_string(name, (!pattern)?"":(const gchar *) pattern, *dissector);
|
||||
return TRUE;
|
||||
default:
|
||||
|
@ -358,6 +360,7 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
decode_as_row = g_strdup_printf(
|
||||
DECODE_AS_ENTRY ": %s,%s,%s,%s\n",
|
||||
table_name, (gchar *)key, initial_proto_name,
|
||||
|
@ -470,6 +473,7 @@ decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
item->ddi_selector.sel_string = g_strdup((char *)key);
|
||||
break;
|
||||
|
||||
|
@ -508,6 +512,7 @@ decode_clear_all(void)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
dissector_reset_string(item->ddi_table_name,
|
||||
item->ddi_selector.sel_string);
|
||||
g_free(item->ddi_selector.sel_string);
|
||||
|
|
|
@ -121,11 +121,13 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
switch (b) {
|
||||
case FT_STRING:
|
||||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -215,6 +217,7 @@ mk_fvalue_from_val_string(dfwork_t *dfw, header_field_info *hfinfo, char *s)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
case FT_EUI64:
|
||||
case FT_PCRE:
|
||||
case FT_GUID:
|
||||
|
@ -360,6 +363,7 @@ is_bytes_type(enum ftenum type)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
case FT_BOOLEAN:
|
||||
case FT_FRAMENUM:
|
||||
case FT_CHAR:
|
||||
|
|
|
@ -1486,7 +1486,7 @@ proto_register_ipx(void)
|
|||
|
||||
{ &hf_sap_server_name,
|
||||
{ "Server Name", "ipxsap.server.name",
|
||||
FT_STRINGZPAD, BASE_NONE, NULL, 0x0,
|
||||
FT_STRINGZTRUNC, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_sap_server_network,
|
||||
|
|
|
@ -328,11 +328,40 @@ ftype_register_string(void)
|
|||
len,
|
||||
slice,
|
||||
};
|
||||
static ftype_t stringztrunc_type = {
|
||||
FT_STRINGZTRUNC, /* ftype */
|
||||
"FT_STRINGZTRUNC", /* name */
|
||||
"Character string", /* pretty name */
|
||||
0, /* wire_size */
|
||||
string_fvalue_new, /* new_value */
|
||||
string_fvalue_free, /* free_value */
|
||||
val_from_unparsed, /* val_from_unparsed */
|
||||
val_from_string, /* val_from_string */
|
||||
string_to_repr, /* val_to_string_repr */
|
||||
string_repr_len, /* len_string_repr */
|
||||
|
||||
{ .set_value_string = string_fvalue_set_string }, /* union set_value */
|
||||
{ .get_value_ptr = value_get }, /* union get_value */
|
||||
|
||||
cmp_eq,
|
||||
cmp_ne,
|
||||
cmp_gt,
|
||||
cmp_ge,
|
||||
cmp_lt,
|
||||
cmp_le,
|
||||
NULL, /* cmp_bitwise_and */
|
||||
cmp_contains, /* cmp_contains */
|
||||
CMP_MATCHES,
|
||||
|
||||
len,
|
||||
slice,
|
||||
};
|
||||
|
||||
ftype_register(FT_STRING, &string_type);
|
||||
ftype_register(FT_STRINGZ, &stringz_type);
|
||||
ftype_register(FT_UINT_STRING, &uint_string_type);
|
||||
ftype_register(FT_STRINGZPAD, &stringzpad_type);
|
||||
ftype_register(FT_STRINGZTRUNC, &stringztrunc_type);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -48,9 +48,9 @@ enum ftenum {
|
|||
FT_DOUBLE,
|
||||
FT_ABSOLUTE_TIME,
|
||||
FT_RELATIVE_TIME,
|
||||
FT_STRING,
|
||||
FT_STRINGZ, /* for use with proto_tree_add_item() */
|
||||
FT_UINT_STRING, /* for use with proto_tree_add_item() */
|
||||
FT_STRING, /* counted string, with no null terminator */
|
||||
FT_STRINGZ, /* null-terminated string */
|
||||
FT_UINT_STRING, /* counted string, with count being the first part of the value */
|
||||
FT_ETHER,
|
||||
FT_BYTES,
|
||||
FT_UINT_BYTES,
|
||||
|
@ -66,8 +66,9 @@ enum ftenum {
|
|||
FT_VINES,
|
||||
FT_REL_OID, /* RELATIVE-OID */
|
||||
FT_SYSTEM_ID,
|
||||
FT_STRINGZPAD, /* for use with proto_tree_add_item() */
|
||||
FT_STRINGZPAD, /* null-padded string */
|
||||
FT_FCWWN,
|
||||
FT_STRINGZTRUNC, /* null-truncated string */
|
||||
FT_NUM_TYPES /* last item number plus one */
|
||||
};
|
||||
|
||||
|
@ -98,7 +99,8 @@ enum ftenum {
|
|||
#define IS_FT_TIME(ft) \
|
||||
((ft) == FT_ABSOLUTE_TIME || (ft) == FT_RELATIVE_TIME)
|
||||
#define IS_FT_STRING(ft) \
|
||||
((ft) == FT_STRING || (ft) == FT_STRINGZ || (ft) == FT_STRINGZPAD)
|
||||
((ft) == FT_STRING || (ft) == FT_STRINGZ || (ft) == FT_STRINGZPAD || \
|
||||
(ft) == FT_STRINGZTRUNC)
|
||||
|
||||
/* field types lengths */
|
||||
#define FT_ETHER_LEN 6
|
||||
|
|
|
@ -1468,6 +1468,7 @@ find_string_dtbl_entry(dissector_table_t const sub_dissectors, const gchar *patt
|
|||
case FT_STRING:
|
||||
case FT_STRINGZ:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
/*
|
||||
* You can do a string lookup in these tables.
|
||||
*/
|
||||
|
@ -1531,6 +1532,7 @@ dissector_add_string(const char *name, const gchar *pattern,
|
|||
case FT_STRING:
|
||||
case FT_STRINGZ:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
/*
|
||||
* You can do a string lookup in these tables.
|
||||
*/
|
||||
|
@ -2460,6 +2462,7 @@ register_dissector_table(const char *name, const char *ui_name, const int proto,
|
|||
case FT_STRING:
|
||||
case FT_STRINGZ:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
sub_dissectors->hash_func = g_str_hash;
|
||||
sub_dissectors->hash_table = g_hash_table_new_full(g_str_hash,
|
||||
g_str_equal,
|
||||
|
|
75
epan/proto.c
75
epan/proto.c
|
@ -1791,7 +1791,7 @@ get_stringzpad_value(wmem_allocator_t *scope, tvbuff_t *tvb, gint start,
|
|||
* terminated, so a "zero-padded" string
|
||||
* isn't special. If we represent string
|
||||
* values as something that includes a counted
|
||||
* array of bytes, we'll need to strip
|
||||
* array of bytes, we'll need to strip the
|
||||
* trailing NULs.
|
||||
*/
|
||||
if (length == -1) {
|
||||
|
@ -1801,6 +1801,26 @@ get_stringzpad_value(wmem_allocator_t *scope, tvbuff_t *tvb, gint start,
|
|||
return tvb_get_string_enc(scope, tvb, start, length, encoding);
|
||||
}
|
||||
|
||||
/* For FT_STRINGZTRUNC */
|
||||
static inline const guint8 *
|
||||
get_stringztrunc_value(wmem_allocator_t *scope, tvbuff_t *tvb, gint start,
|
||||
gint length, gint *ret_length, const guint encoding)
|
||||
{
|
||||
/*
|
||||
* XXX - currently, string values are null-
|
||||
* terminated, so a "zero-truncated" string
|
||||
* isn't special. If we represent string
|
||||
* values as something that includes a counted
|
||||
* array of bytes, we'll need to strip everything
|
||||
* starting with the terminating NUL.
|
||||
*/
|
||||
if (length == -1) {
|
||||
length = tvb_ensure_captured_length_remaining(tvb, start);
|
||||
}
|
||||
*ret_length = length;
|
||||
return tvb_get_string_enc(scope, tvb, start, length, encoding);
|
||||
}
|
||||
|
||||
/*
|
||||
* Deltas between the epochs for various non-UN*X time stamp formats and
|
||||
* the January 1, 1970, 00:00:00 (proleptic?) UTC epoch for the UN*X time
|
||||
|
@ -2862,6 +2882,23 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
|
|||
new_fi->length = length;
|
||||
break;
|
||||
|
||||
case FT_STRINGZTRUNC:
|
||||
stringval = get_stringztrunc_value(wmem_packet_scope(),
|
||||
tvb, start, length, &length, encoding);
|
||||
proto_tree_set_string(new_fi, stringval);
|
||||
|
||||
/* Instead of calling proto_item_set_len(), since we
|
||||
* don't yet have a proto_item, we set the
|
||||
* field_info's length ourselves.
|
||||
*
|
||||
* XXX - our caller can't use that length to
|
||||
* advance an offset unless they arrange that
|
||||
* there always be a protocol tree into which
|
||||
* we're putting this item.
|
||||
*/
|
||||
new_fi->length = length;
|
||||
break;
|
||||
|
||||
case FT_ABSOLUTE_TIME:
|
||||
/*
|
||||
* Absolute times can be in any of a number of
|
||||
|
@ -3229,8 +3266,11 @@ ptvcursor_add_ret_string(ptvcursor_t* ptvc, int hf, gint length, const guint enc
|
|||
case FT_STRINGZPAD:
|
||||
value = get_stringzpad_value(scope, ptvc->tvb, offset, length, &item_length, encoding);
|
||||
break;
|
||||
case FT_STRINGZTRUNC:
|
||||
value = get_stringztrunc_value(scope, ptvc->tvb, offset, length, &item_length, encoding);
|
||||
break;
|
||||
default:
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, or FT_STRINGZPAD",
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, or FT_STRINGZTRUNC",
|
||||
hfinfo->abbrev);
|
||||
}
|
||||
|
||||
|
@ -3564,8 +3604,11 @@ proto_tree_add_item_ret_string_and_length(proto_tree *tree, int hfindex,
|
|||
case FT_STRINGZPAD:
|
||||
value = get_stringzpad_value(scope, tvb, start, length, lenretval, encoding);
|
||||
break;
|
||||
case FT_STRINGZTRUNC:
|
||||
value = get_stringztrunc_value(scope, tvb, start, length, lenretval, encoding);
|
||||
break;
|
||||
default:
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, or FT_STRINGZPAD",
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, or FT_STRINGZTRUNC",
|
||||
hfinfo->abbrev);
|
||||
}
|
||||
|
||||
|
@ -3588,6 +3631,7 @@ proto_tree_add_item_ret_string_and_length(proto_tree *tree, int hfindex,
|
|||
|
||||
case FT_STRINGZ:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
case FT_UINT_STRING:
|
||||
break;
|
||||
|
||||
|
@ -3646,6 +3690,10 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
|
|||
value = get_stringzpad_value(scope, tvb, start, length, lenretval, encoding);
|
||||
*retval = hfinfo_format_text(scope, hfinfo, value);
|
||||
break;
|
||||
case FT_STRINGZTRUNC:
|
||||
value = get_stringztrunc_value(scope, tvb, start, length, lenretval, encoding);
|
||||
*retval = hfinfo_format_text(scope, hfinfo, value);
|
||||
break;
|
||||
case FT_BYTES:
|
||||
value = tvb_get_ptr(tvb, start, length);
|
||||
*retval = hfinfo_format_bytes(scope, hfinfo, value, length);
|
||||
|
@ -3658,7 +3706,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
|
|||
*lenretval = length + n;
|
||||
break;
|
||||
default:
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, FT_BYTES, or FT_UINT_BYTES",
|
||||
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, FT_STRINGZTRUNC, FT_BYTES, or FT_UINT_BYTES",
|
||||
hfinfo->abbrev);
|
||||
}
|
||||
|
||||
|
@ -3674,6 +3722,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
proto_tree_set_string(new_fi, value);
|
||||
break;
|
||||
|
||||
|
@ -3696,6 +3745,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
|
|||
|
||||
case FT_STRINGZ:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
case FT_UINT_STRING:
|
||||
break;
|
||||
|
||||
|
@ -4782,8 +4832,9 @@ proto_tree_set_system_id_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint len
|
|||
proto_tree_set_system_id(fi, tvb_get_ptr(tvb, start, length), length);
|
||||
}
|
||||
|
||||
/* Add a FT_STRING, FT_STRINGZ, or FT_STRINGZPAD to a proto_tree. Creates
|
||||
* own copy of string, and frees it when the proto_tree is destroyed. */
|
||||
/* Add a FT_STRING, FT_STRINGZ, FT_STRINGZPAD, or FT_STRINGZTRUNC to a
|
||||
* proto_tree. Creates own copy of string, and frees it when the proto_tree
|
||||
* is destroyed. */
|
||||
proto_item *
|
||||
proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
|
||||
gint length, const char* value)
|
||||
|
@ -5814,9 +5865,10 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint
|
|||
*/
|
||||
if (*length == -1) {
|
||||
/*
|
||||
* For FT_NONE, FT_PROTOCOL, FT_BYTES, FT_STRING, and
|
||||
* FT_STRINGZPAD fields, a length of -1 means "set the
|
||||
* length to what remains in the tvbuff".
|
||||
* For FT_NONE, FT_PROTOCOL, FT_BYTES, FT_STRING,
|
||||
* FT_STRINGZPAD, and FT_STRINGZTRUNC fields, a length
|
||||
* of -1 means "set the length to what remains in the
|
||||
* tvbuff".
|
||||
*
|
||||
* The assumption is either that
|
||||
*
|
||||
|
@ -5891,6 +5943,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint
|
|||
case FT_BYTES:
|
||||
case FT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
/*
|
||||
* We allow FT_PROTOCOLs to be zero-length -
|
||||
* for example, an ONC RPC NULL procedure has
|
||||
|
@ -6056,6 +6109,7 @@ get_full_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start,
|
|||
break;
|
||||
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
case FT_ABSOLUTE_TIME:
|
||||
case FT_RELATIVE_TIME:
|
||||
case FT_IEEE_11073_SFLOAT:
|
||||
|
@ -6608,6 +6662,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
bytes = (guint8 *)fvalue_get(&finfo->value);
|
||||
str = hfinfo_format_text(NULL, hfinfo, bytes);
|
||||
offset_r += protoo_strlcpy(result+offset_r,
|
||||
|
@ -8349,6 +8404,7 @@ tmp_fld_check_assert(header_field_info *hfinfo)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
switch (hfinfo->display) {
|
||||
case STR_ASCII:
|
||||
case STR_UNICODE:
|
||||
|
@ -9081,6 +9137,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
bytes = (guint8 *)fvalue_get(&fi->value);
|
||||
tmp = hfinfo_format_text(NULL, hfinfo, bytes);
|
||||
label_fill(label_str, 0, hfinfo, tmp);
|
||||
|
|
24
epan/proto.h
24
epan/proto.h
|
@ -263,16 +263,13 @@ void proto_report_dissector_bug(const char *format, ...)
|
|||
IS_FT_UINT((hfinfo)->type))
|
||||
|
||||
#define __DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
|
||||
(REPORT_DISSECTOR_BUG("%s:%u: field %s is not of type FT_STRING, FT_STRINGZ, or FT_STRINGZPAD", \
|
||||
(REPORT_DISSECTOR_BUG("%s:%u: field %s is not of type FT_STRING, FT_STRINGZ, FT_STRINGZPAD, or FT_STRINGZTRUNC", \
|
||||
__FILE__, __LINE__, (hfinfo)->abbrev))
|
||||
|
||||
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
|
||||
((void) (((hfinfo)->type == FT_STRING || (hfinfo)->type == FT_STRINGZ || \
|
||||
(hfinfo)->type == FT_STRINGZPAD) ? (void)0 : \
|
||||
((void) (IS_FT_STRING((hfinfo)->type) ? (void)0 : \
|
||||
__DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING ((hfinfo)))) \
|
||||
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == FT_STRING || \
|
||||
(hfinfo)->type == FT_STRINGZ || \
|
||||
(hfinfo)->type == FT_STRINGZPAD)
|
||||
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(IS_FT_STRING((hfinfo)->type))
|
||||
|
||||
#define __DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
|
||||
(REPORT_DISSECTOR_BUG("%s:%u: field %s is not of type FT_ABSOLUTE_TIME or FT_RELATIVE_TIME", \
|
||||
|
@ -1939,7 +1936,8 @@ WS_DLL_PUBLIC proto_item *
|
|||
proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
|
||||
gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
|
||||
|
||||
/** Add a FT_STRING or FT_STRINGZPAD to a proto_tree.
|
||||
/** Add an FT_STRING, FT_STRINGZ, FT_STRINGZPAD, or FT_STRINGZTRUNC to a
|
||||
proto_tree.
|
||||
@param tree the tree to append this item to
|
||||
@param hfindex field index
|
||||
@param tvb the tv buffer of the current data
|
||||
|
@ -1951,9 +1949,9 @@ WS_DLL_PUBLIC proto_item *
|
|||
proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
|
||||
gint length, const char* value);
|
||||
|
||||
/** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
|
||||
format generating the string for the value and with the field name
|
||||
being included automatically.
|
||||
/** Add a formatted FT_STRING, FT_STRINGZ, FT_STRINGZPAD, or FT_STRINGZTRUNC
|
||||
to a proto_tree, with the format generating the string for the value
|
||||
and with the field name being included automatically.
|
||||
@param tree the tree to append this item to
|
||||
@param hfindex field index
|
||||
@param tvb the tv buffer of the current data
|
||||
|
@ -1968,9 +1966,9 @@ proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
|
|||
gint start, gint length, const char* value, const char *format, ...)
|
||||
G_GNUC_PRINTF(7,8);
|
||||
|
||||
/** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
|
||||
format generating the entire string for the entry, including any field
|
||||
name.
|
||||
/** Add a formatted FT_STRING, FT_STRINGZ, FT_STRINGZPAD, or FT_STRINGZTRUNC
|
||||
to a proto_tree, with the format generating the entire string for the
|
||||
entry, including any field name.
|
||||
@param tree the tree to append this item to
|
||||
@param hfindex field index
|
||||
@param tvb the tv buffer of the current data
|
||||
|
|
|
@ -743,6 +743,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
|
|||
case FT_UINT_STRING:
|
||||
case FT_AX25:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
WSLUA_ARG_ERROR(ProtoField_new,TYPE,"Unsupported ProtoField field type");
|
||||
break;
|
||||
/* FT_PCRE isn't a valid field type. */
|
||||
|
|
|
@ -203,14 +203,14 @@ apiChecks.append(APICheck('proto_tree_add_item_ret_uint', { 'FT_CHAR', 'FT_UINT8
|
|||
apiChecks.append(APICheck('proto_tree_add_item_ret_int', { 'FT_INT8', 'FT_INT16', 'FT_INT24', 'FT_INT32'}))
|
||||
apiChecks.append(APICheck('ptvcursor_add_ret_uint', { 'FT_CHAR', 'FT_UINT8', 'FT_UINT16', 'FT_UINT24', 'FT_UINT32'}))
|
||||
apiChecks.append(APICheck('ptvcursor_add_ret_int', { 'FT_INT8', 'FT_INT16', 'FT_INT24', 'FT_INT32'}))
|
||||
apiChecks.append(APICheck('ptvcursor_add_ret_string', { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING', 'FT_STRINGZPAD'}))
|
||||
apiChecks.append(APICheck('ptvcursor_add_ret_string', { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING', 'FT_STRINGZPAD', 'FT_STRINGZTRUNC'}))
|
||||
apiChecks.append(APICheck('ptvcursor_add_ret_boolean', { 'FT_BOOLEAN'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_uint64', { 'FT_UINT40', 'FT_UINT48', 'FT_UINT56', 'FT_UINT64'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_int64', { 'FT_INT40', 'FT_INT48', 'FT_INT56', 'FT_INT64'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_boolean', { 'FT_BOOLEAN'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_string_and_length', { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING', 'FT_STRINGZPAD'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_string_and_length', { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING', 'FT_STRINGZPAD', 'FT_STRINGZTRUNC'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_display_string_and_length', { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING',
|
||||
'FT_STRINGZPAD', 'FT_BYTES', 'FT_UINT_BYTES'}))
|
||||
'FT_STRINGZPAD', 'FT_STRINGZTRUNC', 'FT_BYTES', 'FT_UINT_BYTES'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_item_ret_time_string', { 'FT_ABSOLUTE_TIME', 'FT_RELATIVE_TIME'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_uint', { 'FT_CHAR', 'FT_UINT8', 'FT_UINT16', 'FT_UINT24', 'FT_UINT32', 'FT_FRAMENUM'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_uint_format_value', { 'FT_CHAR', 'FT_UINT8', 'FT_UINT16', 'FT_UINT24', 'FT_UINT32', 'FT_FRAMENUM'}))
|
||||
|
@ -230,9 +230,9 @@ apiChecks.append(APICheck('proto_tree_add_float_format_value', { 'FT_FLOAT'}))
|
|||
apiChecks.append(APICheck('proto_tree_add_double', { 'FT_DOUBLE'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_double_format', { 'FT_DOUBLE'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_double_format_value', { 'FT_DOUBLE'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string_format', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string_format_value', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD', 'FT_STRINGZTRUNC'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string_format', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD', 'FT_STRINGZTRUNC'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_string_format_value', { 'FT_STRING', 'FT_STRINGZ', 'FT_STRINGZPAD', 'FT_STRINGZTRUNC'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_guid', { 'FT_GUID'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_oid', { 'FT_OID'}))
|
||||
apiChecks.append(APICheck('proto_tree_add_none_format', { 'FT_NONE'}))
|
||||
|
|
|
@ -347,6 +347,7 @@ gboolean decode_as_command_option(const gchar *cl_param)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
/* The selector for this table is a string. */
|
||||
break;
|
||||
|
||||
|
@ -468,6 +469,7 @@ gboolean decode_as_command_option(const gchar *cl_param)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
/* The selector for this table is a string. */
|
||||
dissector_change_string(table_name, selector_str, dissector_matching);
|
||||
break;
|
||||
|
|
|
@ -556,6 +556,7 @@ QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value)
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
entry_str = (const char *)value;
|
||||
break;
|
||||
|
||||
|
@ -686,6 +687,7 @@ void DecodeAsModel::gatherChangedEntries(const gchar *table_name,
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
model->changed_string_entries_ << CharPtrPair(table_name, (const char *) key);
|
||||
break;
|
||||
default:
|
||||
|
@ -757,6 +759,7 @@ void DecodeAsModel::applyChanges()
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
byteArray = item->selectorString_.toUtf8();
|
||||
selector_value = (gconstpointer) byteArray.constData();
|
||||
break;
|
||||
|
|
|
@ -203,6 +203,7 @@ static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
ti = new DissectorTablesItem((const char *)key, proto_name, pdl_ptr);
|
||||
pdl_ptr->prependChild(ti);
|
||||
break;
|
||||
|
@ -245,6 +246,7 @@ static void gatherTableNames(const char *short_name, const char *table_name, gpo
|
|||
case FT_STRINGZ:
|
||||
case FT_UINT_STRING:
|
||||
case FT_STRINGZPAD:
|
||||
case FT_STRINGZTRUNC:
|
||||
dt_ti = new DissectorTablesItem(table_name, short_name, tables->string_table);
|
||||
tables->string_table->prependChild(dt_ti);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue