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

Probably one for the core development team.

The Lua API reference manual doesn't mention this, but if you define a ProtoField whose abbr matches an already existing one contributed by another dissector, it is accepted unless its definition differs from that of the existing one.

It is even possible to refer to your own translation table in the ProtoField definition, and such table may be a local one so it clearly doesn't interfere with the other dissector's one.

As this turned out to be quite useful, my question is whether it is a controlled property and thus it is going to stay like that and should be explicitly documented, or whether it has just "happened" and thus it cannot be relied upon for the future.

asked 18 Jun '17, 08:34

sindy's gravatar image

sindy
6.0k4851
accept rate: 24%


Yes, this is a feature and will thus likely stick around. From README.dissector:

It is OK to have header fields with a different format be registered with
the same abbreviation. For instance, the following is valid:

static hf_register_info hf[] = {

    { &hf_field_8bit, /* 8-bit version of proto.field */
    { "Field (8 bit)", "proto.field", FT_UINT8, BASE_DEC, NULL,
        0x00, "Field represents FOO", HFILL }},

    { &hf_field_32bit, /* 32-bit version of proto.field */
    { "Field (32 bit)", "proto.field", FT_UINT32, BASE_DEC, NULL,
        0x00, "Field represents FOO", HFILL }}
};
permanent link

answered 19 Jun '17, 07:41

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

Thanks a lot. Does it make sense to advertise this feature at the Lua API wiki?

(19 Jun '17, 08:00) sindy

I don't see why not.

(19 Jun '17, 11:36) JeffMorriss ♦

I do :-) First, I cannot decide which would be the right place for this information in the Lua API reference manual, and second(ary), it is not a Wiki so I can only send the text to the core developers once I find the right place and, subsequently, wording.

(20 Jun '17, 12:07) sindy

Actually the reference manual is stored in git so a patch would be the best way to change that (not an email).

Given that I have probably never used the Lua documentation I couldn't suggest a place for it...

(26 Jun '17, 06:38) JeffMorriss ♦
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×431
×12

question asked: 18 Jun '17, 08:34

question was seen: 788 times

last updated: 26 Jun '17, 06:38

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