ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] How to generate epan/dissectors/packet-skinny.c?

From: Jirka Novak <j.novak@xxxxxxxxxxxx>
Date: Sat, 30 Oct 2021 16:39:18 +0200
Hi,

  based on notice of Jörg Mayer (thank you), I tried to generate
epan/dissectors/packet-skinny.c from epan/dissectors/packet-skinny.c.in.
  The command line should be:

cog.py -D xmlfile=tools/SkinnyProtocolOptimized.xml -d -c -o
epan/dissectors/packet-skinny.c epan/dissectors/packet-skinny.c.in

  but it fails with error:

Traceback (most recent call last):
  File "epan/dissectors/packet-skinny.c.in", line 109, in <module>
    skinny = xml2skinny.xml2obj(xmlfile)
  File
"/home/novakji/vyvoj/netsystem.cz/wireshark/wireshark-repo/tools/parse_xml2skinny_dissector.py",
line 974, in xml2obj
    return builder.root._attrs.values()[0]
TypeError: 'dict_values' object is not subscriptable

  It calls tools/parse_xml2skinny_dissector.py internally. My first
worry was that this python script is not designated for python3, but it
is probably not the case.
  I briefly reviewed parse_xml2skinny_dissector.py and I found no error
except it reads tools/SkinnyProtocolOptimized.xml with no syntax error,
but output is empty so line

    return builder.root._attrs.values()[0]

  fails because there is no index 0.

  I'm using Linux/Fedora. Can someone check whether the script works on
different environment?

  BTW it looks that packet-skinny.c was not made from packet-skinny.c.in
for long time as they e.g. use different methods for memory allocation
(pinfo->pool vs. wmem_packet_scope()).

					Best regards,

						Jirka