diff options
-rw-r--r-- | epan/dissectors/packet-nfs.c | 27 | ||||
-rw-r--r-- | epan/value_string.c | 36 | ||||
-rw-r--r-- | epan/value_string.h | 19 |
3 files changed, 31 insertions, 51 deletions
diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 932f3102f6..822e493010 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -6706,9 +6706,17 @@ dissect_nfs_fattr4_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree) { if (expire_type == FH4_PERSISTENT) { - proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s", - decode_enumerated_bitfield(expire_type, 0xFFFFFFFF, 32, - nfs4_fattr4_fh_expire_type_names, "%s")); + char *p, *buf; + + /* TODO: this should be replaced with a named field and + * proto_tree_add_item */ + buf = (char *)ep_alloc(1025); + p = decode_bitfield_value(buf, expire_type, 0xFFFFFFFF, 32); + g_snprintf(p, (gulong) (1024-(p-buf)), "%s", + val_to_str_const(expire_type, + nfs4_fattr4_fh_expire_type_names, + "Unknown")); + proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s", buf); } else { @@ -12758,3 +12766,16 @@ proto_reg_handoff_nfs(void) fhandle_handle=create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs); dissector_add_uint("nfs_fhandle.type", FHT_UNKNOWN, fhandle_handle); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/value_string.c b/epan/value_string.c index 2c97801094..64eddb7480 100644 --- a/epan/value_string.c +++ b/epan/value_string.c @@ -498,42 +498,6 @@ value_string_ext_match_type_str(const value_string_ext *vse) return "[Match Type not initialized or invalid]"; } -/* Functions for bitfield generation, do they even belong here? */ - -/* Generate a string describing an enumerated bitfield (an N-bit field - with various specific values having particular names). */ -const char * -decode_enumerated_bitfield(const guint32 val, const guint32 mask, - const int width, const value_string *tab, const char *fmt) -{ - static char buf[1025]; - char *p; - - p = decode_bitfield_value(buf, val, mask, width); - g_snprintf(p, (gulong) (1024-(p-buf)), fmt, val_to_str_const(val & mask, tab, "Unknown")); - return buf; -} - -/* Generate a string describing an enumerated bitfield (an N-bit field - with various specific values having particular names). */ -const char * -decode_enumerated_bitfield_shifted(const guint32 val, const guint32 mask, - const int width, const value_string *tab, const char *fmt) -{ - static char buf[1025]; - char *p; - int shift = 0; - - /* Compute the number of bits we have to shift the bitfield right - to extract its value. */ - while ((mask & (1<<shift)) == 0) - shift++; - - p = decode_bitfield_value(buf, val, mask, width); - g_snprintf(p, (gulong) (1024-(p-buf)), fmt, val_to_str_const((val & mask) >> shift, tab, "Unknown")); - return buf; -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/value_string.h b/epan/value_string.h index cdb8a8272a..de12e52a52 100644 --- a/epan/value_string.h +++ b/epan/value_string.h @@ -135,17 +135,12 @@ try_rval_to_str_idx(const guint32 val, const range_string *rs, gint *idx); /* MISC (generally do not use) */ -gboolean value_string_ext_validate(const value_string_ext *vse); -const gchar *value_string_ext_match_type_str(const value_string_ext *vse); - -/* Generate a string describing an enumerated bitfield (an N-bit field - with various specific values having particular names). */ -WS_DLL_PUBLIC const char *decode_enumerated_bitfield(const guint32 val, const guint32 mask, - const int width, const value_string *tab, const char *fmt); - -/* Generate a string describing an enumerated bitfield (an N-bit field - with various specific values having particular names). */ -WS_DLL_PUBLIC const char *decode_enumerated_bitfield_shifted(const guint32 val, const guint32 mask, - const int width, const value_string *tab, const char *fmt); +WS_DLL_LOCAL +gboolean +value_string_ext_validate(const value_string_ext *vse); + +WS_DLL_LOCAL +const gchar* +value_string_ext_match_type_str(const value_string_ext *vse); #endif /* __VALUE_STRING_H__ */ |