This is our old Q&A Site. Please post any new questions and answers at

Is there some way to create a dissector from XML file?

I have few messages which are defined in XML files. I'd like to use some generic dissector so that one will have to use only the XML file in order to define the packet (all messages are based on UDP), the dissector will read all the XML files and will parse the data based on it.

asked 27 Jul '17, 22:24

BMWE's gravatar image

accept rate: 100%

You may want to have a look at this project. It is not fed by xml directly but you may use a script to convert your xml descriptions into the syntax required by this project.

Other approach would be to somewhat duplicate that project by using Lua to read your xml description of the protocol and create protocol fields at startup, but I am not really sure you can read from a file during the initialisation phase. In Lua, you can use constructs like

all_my_fields = {} local n=0

and then, for each protocol field description extracted from XML:

all_my_fields[n] = ProtoField.uint8(field_abbr_from_XML,field_name_from_XML,base.HEX, all_my_field_values_table_from_XML[n],field_bit_mask_from_XML) n=n+1

choosing the right ProtoField type (uint8 in this case) and base (base.HEX in this case) which I suspect must be literals, and then probably (I've never tested it so a different syntax may be necessary) you can use

my_proto.fields = all_my_fields

The tables for translation of numeric values to text strings must be complete before you use them to create a ProtoField as for some reason they are copied, not referred to.

permanent link

answered 28 Jul '17, 03:07

sindy's gravatar image

accept rate: 24%

This project seems to be very useful. Thank you

(28 Jul '17, 22:29) BMWE
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 27 Jul '17, 22:24

question was seen: 1,496 times

last updated: 10 Aug '17, 01:37

p​o​w​e​r​e​d by O​S​Q​A