diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-10-04 10:12:55 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-10-04 10:12:55 +0000 |
commit | 21dbaea38718c2a549cacc22164cd7ae3f9b498b (patch) | |
tree | b589e60f7d61875937fc56939e033c717c928871 /epan/proto.c | |
parent | 6a847b1f308cbe63b433be33b53f8b8485a7687e (diff) |
Add proto_unregister_field().
This can be used to unregister fields registered in dissector UAT's.
svn path=/trunk/; revision=39248
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] = { |