Revision history [back]
Here is a doctored up version of the original Lua above.
The syntax changes are from looking through the Lua Examples on the Wireshark wiki.
f_http2_type = Field.new("http2.type") rpc_pd = Proto("rpc_ext","rpc dissector") function rpc_pd.dissector(buffer,pinfo,tree) finfos = { f_http2_type() } for _, rpc_msg_field in ipairs(finfos) do io.write(pinfo.number) io.write(": ") if (rpc_msg_field.value == 0x00) then io.write("Type: Data\n") elseif (rpc_msg_field.value == 0x01) then io.write("Type: Header\n") else io.write("Type: ") io.write(rpc_msg_field.value) io.write("\n") end end end register_postdissector(rpc_pd)
http2.type
can occur in a packet multiple times (Wireshark uses the term "occurrence". In SNMP it's similar to a multi-instance OID). From the wiki example code:
57 -- extract the field into a table of FieldInfos 58 finfos = { field() }
Then iterate over the array members:
66 for _, finfo in ipairs(finfos) do
Here is a doctored up version of the original Lua above.
The syntax changes are from looking through the Lua Examples on the Wireshark wiki.
f_http2_type = Field.new("http2.type") rpc_pd = Proto("rpc_ext","rpc dissector") function rpc_pd.dissector(buffer,pinfo,tree) finfos = { f_http2_type() } for _, rpc_msg_field in ipairs(finfos) do io.write(pinfo.number) io.write(": ") if (rpc_msg_field.value == 0x00) then io.write("Type: Data\n") elseif (rpc_msg_field.value == 0x01) then io.write("Type: Header\n") else io.write("Type: ") io.write(rpc_msg_field.value) io.write("\n") end end end register_postdissector(rpc_pd)
http2.type
The field `http2.type` can occur
57 -- extract the field into a table of FieldInfos 58 finfos = { field() }
Then iterate over the array members:
66 for _, finfo in ipairs(finfos) do
Here is a doctored up version of the original Lua above.
The syntax changes are from looking through the Lua Examples on the Wireshark wiki.
f_http2_type = Field.new("http2.type") rpc_pd = Proto("rpc_ext","rpc dissector") function rpc_pd.dissector(buffer,pinfo,tree) finfos = { f_http2_type() } for _, rpc_msg_field in ipairs(finfos) do io.write(pinfo.number) io.write(": ") if (rpc_msg_field.value == 0x00) then io.write("Type: Data\n") elseif (rpc_msg_field.value == 0x01) then io.write("Type: Header\n") else io.write("Type: ") io.write(rpc_msg_field.value) io.write("\n") end end end register_postdissector(rpc_pd)
The field `http2.type` can occur (Wireshark uses the term "occurrence". In SNMP it's similar to a multi-instance OID) multiple times in a packet. From the wiki example code:
57 -- extract the field into a table of FieldInfos 58 finfos = { field() }
Then iterate over the array members:
66 for _, finfo in ipairs(finfos) do