This is our old Q&A Site. Please post any new questions and answers at

Hi there,

i'm trying to analyze some custom parts of a frame for benchmarking to check if frames are transported through a system and when transported i try to calculate the delay based on input and output frame timestamps. The Input and Output Frames are identified by a sequence number added to the testframe. With the LUA Script the sequence number decoding works. Now i want to calculate the Delay by comparing the sequence bumber of input/output. This is also (lookslike) working but i'm unable to add the delay to the ui tree. Looks like it is overwritten. Here's the code:

    local f = sptlog.fields 
    f.seq = ProtoField.uint32("sptlog.seq", "Sequence of Packet")
    f.sig = ProtoField.uint32("sptlog.sig", "Signature")
    f.tdiff = ProtoField.float("sptlog.tdiff", "Time Diff")

    function sptlog.dissector(buffer, pinfo, tree)

            if buffer:len() > 50 then
                --We first have to find the offset
                SIG_OFF = 0
                diff =0
                for lc = 1,buffer:len()-3,1 do
                    local part = tostring(buffer:range(lc,3))
                    if part == "535443" then
                        SIG_OFF = lc
                        SIG_OFF = SIG_OFF + 3
                        lc = buffer:len()
                if SIG_OFF ~= 0 then
                    subtree = tree:add(sptlog, buffer(),"STC DATA")
                    subtree:add(f.sig, buffer:range(SIG_OFF-3,3))
                    seq = buffer:range(SIG_OFF,2):uint()
                    if not pinfo.visited then
                            if not stp_array[seq] then
                                    local timestamp = NSTime(pinfo.abs_ts, select(2,math.modf(pinfo.abs_ts)) * 10^9)
                                    stp_array[seq] = timestamp
                                local timestamp = NSTime(pinfo.abs_ts, select(2,math.modf(pinfo.abs_ts)) * 10^9)
                                diff = timestamp - stp_array[seq]
                    warn (pinfo.abs_ts)
                    warn (diff)
                    warn ("--------")
                    subtree:add(f.seq, buffer:range(SIG_OFF,2)) 



The subtree:add(f.tdiff,diff):set_generated() is not working or gets overwritten. Looks like the script parses two packets in the testcapture five times..

Any idea? Thanks!



asked 05 Nov '15, 09:31

tsillaber's gravatar image

accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Nov '15, 09:31

question was seen: 864 times

last updated: 05 Nov '15, 09:31

p​o​w​e​r​e​d by O​S​Q​A