do -- Configure Dissector -- We will use the User USER0 link -- local my_proto = Proto("myproto","My Encapsulation Protocol"); local vs_protos = { [0] = "Unknown", [1] = "Ethernet", [4] = "IP Version 4", [6] = "IP Version 6", [9] = "PPP", -- add new channels here } local vs_directions = { [0] = "Up", [1] = "Down" } local f_channel = ProtoField.uint8("myprot.channel","Channel" ,base.DEC,vs_protos,0x7F) local f_direction = ProtoField.uint8("myprot.direction","Direction",base.DEC,vs_directions,0x80); my_proto.fields = {f_channel,f_direction} local data_dis = Dissector.get("data") local protos = { [0] = Dissector.get("data"), [1] = Dissector.get("eth"), [4] = Dissector.get("ip"), [6] = Dissector.get("ipv6"), [9] = Dissector.get("ppp"), } function my_proto.dissector(buf,pkt,root) local t = root:add(my_proto,buf(0,1)) -- Just one byte for our protocol t:add(f_channel,buf(0,1)) t:add(f_direction,buf(0,1)) local proto_id = buf(0,1):uint() if(proto_id > 127) then proto_id = proto_id - 128 end local dissector = protos[proto_id] if dissector ~= nil then dissector:call(buf(1):tvb(),pkt,root) else data_dis:call(buf,pkt,root) end end local wtap_encap_table = DissectorTable.get("wtap_encap") wtap_encap_table:add(wtap.USER0,my_proto) end