Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: [Wireshark-users] Having problems searching Lua dissector data

From: Robert Young <ryoung@xxxxxxxxxxxx>
Date: Thu, 04 Mar 2010 14:18:19 -0500
Hi there,

I'm trying to write my first Lua dissector for Wireshark. I have a really simple dissector set up which I attached below. It populates the data tree alright, but I would like to be able to search on the field I defined, wc.packetid. wc.packetid shows up as a searchable type in the expression field, but doesn't seem to be populated. Could someone tell me what I'm missing?

Rob Y

-- trivial protocol example
-- declare our protocol
trivial_proto = Proto("WC","WC Protocol")
-- create a function to dissect it

xdPacketFieldProto = ProtoField.uint32("wc.packetid", "Packet ID")

trivial_proto.fields = {wcPacketFieldProto}

function trivial_proto.dissector(buffer,pinfo,tree)
   pinfo.cols.protocol = "XC"
   local subtree = tree:add(trivial_proto,buffer(),"WC Protocol")
subtree:add(ProtoField.uint32("xd.packetid", "Packet ID"),"Protocol Type is: " .. buffer(15,1):uint())

-- load the udp.port table
udp_table = DissectorTable.get("udp.port")

-- register our protocol to handle udp port 21230