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

From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Sat, 30 Oct 2021 17:31:17 +0200
Hi Jirka,

from packet-skinny.c.in
# Dependencies:
# - python2.x
# - cog.py: (pip install cogapp / http://nedbatchelder.com/code/cog/)
# - python.xml
# - python.xml.sax
#

Tested on Ubuntu 18.04 (TLS) (with python2) and work for me..



On Sat, Oct 30, 2021 at 4:39 PM Jirka Novak <j.novak@xxxxxxxxxxxx> wrote:
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

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe