Wireshark mailing list archives
Re: Making oui_base_custom available more generally
From: Richard Sharpe <realrichardsharpe () gmail com>
Date: Sat, 19 Aug 2017 08:29:01 -0700
On Sat, Aug 19, 2017 at 8:10 AM, Michael Mann via Wireshark-dev <wireshark-dev () wireshark org> wrote:
I don't know exactly how far BASE_CUSTOM goes back, but it is for "custom" display of a field. But if there are enough fields with the same "custom" formatting, it's probably time to make it a field type (or add BASE_ type)
OK, it does go back that far.
In looking at adding FT_OUI, some of it is obvious, but I am not sure
what this code is doing in proto_item_fill_label
                case FT_ETHER:
                        bytes = (guint8 *)fvalue_get(&fi->value);
                        addr.type = AT_ETHER;
                        addr.len  = 6;
                        addr.data = bytes;
                        addr_str =
(char*)address_with_resolution_to_str(NULL, &addr);
                        g_snprintf(label_str, ITEM_LABEL_LENGTH,
                                   "%s: %s", hfinfo->name, addr_str);
                        wmem_free(NULL, addr_str);
                        break;
and I suspect that the code I need to add is more like this:
                case FT_OID:
                        bytes = (guint8 *)fvalue_get(&fi->value);
                        name = oid_resolved_from_encoded(NULL, bytes,
fvalue_length(&fi->value));
                        tmp = oid_encoded2string(NULL, bytes,
fvalue_length(&fi->value));
                        if (name) {
                                label_fill_descr(label_str, 0, hfinfo,
tmp, name);
                                wmem_free(NULL, name);
                        } else {
                                label_fill(label_str, 0, hfinfo, tmp);
                        }
                        wmem_free(NULL, tmp);
                        break;
with oid_resolved_from_encoded etc replaced with
get_manuf_name_if_known and a few other changes.
Does that seem reasonable to you?
There's a couple of other places in there where I am not sure what is
going on, but I can stumble through ...
-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Making oui_base_custom available more generally Richard Sharpe (Aug 18)
- Re: Making oui_base_custom available more generally Dario Lombardo (Aug 19)
- Re: Making oui_base_custom available more generally Roland Knall (Aug 19)
- Re: Making oui_base_custom available more generally Michael Mann via Wireshark-dev (Aug 19)
 - Re: Making oui_base_custom available more generally Alexis La Goutte (Aug 19)
 - Re: Making oui_base_custom available more generally Michael Mann via Wireshark-dev (Aug 19)
 
 - Re: Making oui_base_custom available more generally Richard Sharpe (Aug 19)
 - Re: Making oui_base_custom available more generally Michael Mann via Wireshark-dev (Aug 19)
 - Re: Making oui_base_custom available more generally Richard Sharpe (Aug 19)
 - Re: Making oui_base_custom available more generally Michael Mann via Wireshark-dev (Aug 19)
 - Re: Making oui_base_custom available more generally Richard Sharpe (Aug 19)
 
 - Re: Making oui_base_custom available more generally Roland Knall (Aug 19)
 
 - Re: Making oui_base_custom available more generally Dario Lombardo (Aug 19)
 
