2016-10-20 2 views
0

나는 Ethercat 프로토콜을 위해 루아에서 쇠사슬로 된 해부학자를 쓰고있다. 나는 쇠사슬로 묶인 해부학사라는 이름을지었습니다.루아의 쇠사슬

내가 지금까지 가지고있는 것에 대해 littlecat은 원하는 필드를 정확하게 분석합니다. 그러나 내장 된 ecat 해독기를 실행 한 후에 littlecat이 완벽하게 처리합니다.

이것은 내 루아 코드의 끝에있는 등록 정보입니다.

-- 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을 실행 한 후에 내 디 사이 터를 실행할 수 있습니까?

답변

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)