Wireshark mailing list archives
Re: Fields with symbolic values defined in another file
From: Evan Huus <eapache () gmail com>
Date: Tue, 23 Jul 2013 09:23:06 -0400
Is it enough to create a packet-scsi-osd.h file and expose the necessary values there for packet-scsi.c to include? Evan On Tue, Jul 23, 2013 at 5:44 AM, Javier Godoy <mail () rjgodoy com ar> wrote:
In the SCSI dissector, I would like to add support for the OSD attribute
identification sense data descriptor.
The descriptor is a list of attribute page and attribute number fields.
The code would be added to dissect_scsi_descriptor_snsinfo in packet-scsi.c
because the SCSI dissector does not forward sense data to the sub-dissector.
My issue is that symbolic names for attribute pages and attribute numbers
are defined in packet-scsi-osd.c (page names are just a string_value array,
and attribute number names are given by function osd_lookup_attribute).
What approach do you recommend for including the attribute names in the
fields of the sense data descriptor?
For reference, in packet-scsi-osd.c the fields that represent page/number
values are defined as
{ &hf_scsi_osd_attributes_page,
{"Attributes Page", "scsi_osd.attributes.page", FT_UINT32, BASE_HEX,
VALS(attributes_page_vals), 0, NULL, HFILL}},
{ &hf_scsi_osd_attribute_number,
{"Attribute Number", "scsi_osd.attribute.number", FT_UINT32, BASE_HEX,
NULL, 0, NULL, HFILL}},
And they are dissected as:
const attribute_page_numbers_t *apn;
proto_item *item;
item=proto_tree_add_item(tt, hf_scsi_osd_attribute_number, tvb, offset, 4,
ENC_BIG_ENDIAN);
apn= osd_lookup_attribute(page,number);
if (!apn) {
expert_add_info(pinfo, item, &ei_osd_attr_unknown);
proto_item_append_text(item, " (Unknown)");
} else {
proto_item_append_text(item, " (%s)", apn->name);
}
Best Regards
Javier
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives: http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Fields with symbolic values defined in another file Javier Godoy (Jul 23)
- Re: Fields with symbolic values defined in another file Evan Huus (Jul 23)
- Re: Fields with symbolic values defined in another file mmann78 (Jul 23)
- Re: Fields with symbolic values defined in another file Javier Godoy (Jul 23)
- Re: Fields with symbolic values defined in another file Evan Huus (Jul 23)
