diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-10-04 10:12:55 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-10-04 10:12:55 +0000 |
commit | ea1218657c84a24a4c769eed68218fc93c4d80b3 (patch) | |
tree | b589e60f7d61875937fc56939e033c717c928871 /epan/proto.c | |
parent | 007edc515aa724f12aaa4042c8ad035b4c1c2deb (diff) |
Add proto_unregister_field().
This can be used to unregister fields registered in dissector UAT's.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39248 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/epan/proto.c b/epan/proto.c index adbcb53dc8..64f6261e20 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -4701,6 +4701,34 @@ proto_register_field_array(const int parent, hf_register_info *hf, const int num } } +/* unregister already registered fields */ +void +proto_unregister_field (const int parent, gint hf_id) +{ + hf_register_info *hf; + protocol_t *proto; + GList *field; + + if (hf_id == -1 || hf_id == 0) + return; + + proto = find_protocol_by_id (parent); + if (!proto || !proto->fields) { + return; + } + + for (field = g_list_first (proto->fields); field; field = g_list_next (field)) { + hf = field->data; + if (*hf->p_id == hf_id) { + /* Found the hf_id in this protocol */ + g_tree_remove (gpa_name_tree, hf->hfinfo.abbrev); + proto->fields = g_list_remove_link (proto->fields, field); + proto->last_field = g_list_last (proto->fields); + break; + } + } +} + /* chars allowed in field abbrev */ static const guchar fld_abbrev_chars[256] = { |