2016-10-20 9 views
0

私はEthercatプロトコルのためにLuaの連鎖ディセクタを書いています。私は私の連鎖された解剖学的リトルキャットという名前をつけたLuaの鎖交したディセクタ

私が今までに持っていたことについては、littlecatが、私が望むフィールドを正しく解剖しました。しかし、組み込みのecatディセクタの後で実行する代わりに、littlecatは完全にそれを引き継ぎます。

これは私のルアコードの終わりの登録がどのように見えるかです。 ECATが実行された後、私は私の解剖器具を実行させることができどのよう

-- 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) 

答えて

0

解決策が見つかりました。解剖の関数の前に解剖器具テーブルと元解剖器具を定義

  1. :デフォルトの解剖器具が呼び出されることを確認し、[カスタム解剖する

  2. 解剖機能内で元の解剖を呼び出します。

-- 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) 
関連する問題