我正在为Ethercat协议在Lua写一个链式分解器。我给我的带链子的拆尸器起了个名字。
到目前为止,我所拥有的一切都正确地剖析了我想要的领域。然而,没有在ecat分解后执行,littlecat完全接管了它。
这就是我的Lua代码末尾的注册内容。
-- Initialize Protocol
function littlecat.init()
end
-- Register Chained Dissector Ethercat Port
local ethercat_dissector_table = DissectorTable.get("ecatf.type")
dissector = ethercat_dissector_table:get_dissector(1)
-- Dissector can be called from littlecat.dissector
-- So the previous dissector gets called
ethercat_dissector_table:add(1, littlecat)
在执行ecat之后,我如何让我的部门执行?
发布于 2016-11-03 17:53:24
我找到了解决办法。
若要确保调用默认拆分,然后调用自定义拆分:
示例
-- Initialize Protocol
-- Initialize Protocol Fields
-- Define dissector table and default dissector here
-- so they can be called within the dissection func.
local dissector_table = DissectorTable.get("shortname")
dissector = dissector_table:get_dissector(PORT)
-- Dissection Function
function dissectorname.dissector (tvbuf, pktinfo, root)
-- Call default dissector.
dissector(tvbuf, pktinfo, root)
-- Continue dissection....
end
-- Initialize Protocol
function dissectorname.init()
end
-- Dissector can be called from dissectorname.dissector
-- So the previous dissector gets called
dissector_table:add(PORT, dissectorname)
https://stackoverflow.com/questions/40163541
复制相似问题