How to add a column from ProtoField value
Hi,
I wrote a Lua dissector script to capture a in-house developed protocol.
I want to add a column "source" "target" into wireshark view.
I can add protocol name but how can I add a column called source
and assign it a value from ProtoField?
I tried pinfo.cols.source = mybussnifer_can.fields.source.name
but I get error.
local mybussnifer_can = Proto("mysniffer", "Sniffer plugin")
local can_protocol_fields = mybussnifer_can.fields
can_protocol_fields.priority = ProtoField.string("priority", "Priority")
can_protocol_fields.proto_dataformat = ProtoField.uint8("dataformat" , "DFormat ", base.HEX, protocol.str, nil, "Protocol Format")
can_protocol_fields.source = ProtoField.uint8("mysniffer.source", "Source", base.HEX, services.name_str , nil, "Source ID")
can_protocol_fields.target = ProtoField.uint8("mysniffer.target" , "Target", base.HEX, services.name_str , nil, "Target ID")
function mybussnifer_can.dissector(buffer, pinfo, tree)
local buf_len = buffer:len()
local offset = 0
local packet_len = f_frame_len().value
local subtree = tree:add(mybussnifer_can, buffer(offset, packet_len))
pinfo.cols.protocol = mybussnifer_can.name
end