title: Wireshark Lua Dissector - How to use a TAP?
body: <p>I would like to do some analysis on top of my custom protocol that is dissected via my lua dissector. Therefore I tried to do this</p>
  
  <pre><code>myproto_proto = Proto("myproto", "Myproto Protocol")
  m_dest = ProtoField.uint16("myproto.dest", "Destination", base.HEX)
  m_src = ProtoField.uint16("myproto.src", "Source", base.HEX)
  myproto_proto.fields = { sm_dest, sm_src }
  
  dofile(MYPROTO_PROTO_PATH.."parser.lua")
  
  function myproto_proto.dissector(buffer, pinfo, tree)
     pinfo.cols.protocol = "MYPROTO"
  
     local subtree = tree:add(myproto_proto, buffer(), "Myproto Protocol Data")
     parse_msg(buffer, pinfo, subtree) -- does the actual parsing and sets the fields
  end
  
  udp_table = DissectorTable.get("udp.port")
  udp_table:add(9000,myproto_proto)
  
  -- LISTENER / TAP
  
  f_test = Field.new("myproto.dest") -- fails because "field does not exist"
  local function my_tap()
     local window = TextWindow.new("Myproto Tap")
     local tap = Listener.new(nil, "myproto")
  
     local counter = 0
     function remove()
        tap:remove()
     end
  
     window:set_atclose(remove)
  
     function tap.packet(pinfo, buffer)
        counter = counter + 1
     end
  
     function tap.draw(t)
        window:append("Counter: \t" .. counter .. "\n")
     end
  
     function tap.reset()
        window:clear()
        counter = 0
     end
     retap_packets()
  end
  
  register_menu("My Tap", my_tap, MENU_TOOLS_UNSORTED)
  </code></pre>
  
  <p>My problem is, I'm unable to access the dissected data with a field extractor. So how else could I get the dissected data in my lua tap?</p>
  
  <p>Thanks in advance.</p>