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

Cannot create ProtoField with ftypes.NONE

0

Hello,

i'm trying to create a dissector in .lua for Wireshark (1.10.7 x64) and i cannot add a field with ftypes.NONE, because Wireshark complains about "invalid ftypes".

So my question here is: Is this a bug, or is it supposed to be like that?

Edit: Sorry i forgot the sample code. Im trying to convert this old dissector written in c to lua: C-Code:

static hf_register hf[] = {
{ &hf_myproto, { "Data", "myproto.data", FT_NONE, BASE_NONE, NULL, 0x0, "myprotoPDU", HFILL}},
{ &hf_myproto_header, { "Header", "myproto.header", FT_NONE, BASE_NONE, NULL, 0x0, "myprotoHeader", HFILL}},
{ &hf_myproto_packet, { "Packet", "myproto.packet", FT_NONE, BASE_NONE, NULL, 0x0, "myprotoPacket", HFILL}}, 
...
}

Lua-Code:

local ncp = p_myproto.fields
ncp.hf_myproto = ProtoField.new("Data", "myproto.data", ftypes.NONE, nil, base.NONE, 0x0, "myprotoPDU")
ncp.hf_myproto_header = ProtoField.new("Header", "myproto.header", ftypes.NONE, nil, base.NONE, 0x0, "myprotoHeader")
ncp.hf_myproto_packet = ProtoField.new("Packet", "myproto.packet", ftypes.NONE, nil, base.NONE, 0x0, "myprotoPacket")
...

There are some more fields with uint16 and such, but they are working just fine, so i removed them here.

-Namikon

asked 30 May '14, 15:52

Namikon's gravatar image

Namikon
11113
accept rate: 0%

edited 22 Jun '14, 11:02

Hadriel's gravatar image

Hadriel
2.7k2939

can you please post some sample code?

(31 May '14, 07:24) Kurt Knochner ♦

One Answer:

0

So my question here is: Is this a bug, or is it supposed to be like that?

It's not a bug, per se. ftypes.NONE was explicitly excluded in the internal code; and it is not in the list of types allowed for that third argument of ProtoField.new(), as listed in the API docs for ProtoField.

I'm not sure why it was excluded though... maybe there was a sentiment at the time that FT_NONE would be removed someday?

answered 22 Jun '14, 11:01

Hadriel's gravatar image

Hadriel
2.7k2939
accept rate: 18%