This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

LUA scripting - Matching multiple instances of multiples fields

0

There is two fields(rtcp.ssrc.fraction and rtcp.ssrc.cum_nr) that can have multiple instances on a single packet. I want to traverse all instances of rtcp.ssrc.fraction and then find the "matching instance" of rtcp.ssrc.cum_nr. See example below.

A packet has three RTCP messages: EXTENDED REPORT (ER), SENDER REPORT (SR), SOURCE DESCRIPTION (SD)

Both ER and SR include instances of rtcp.ssrc.fration but only SR includes an instance of rtcp.ssrc.cum_nr.

local fractions = { rtcp_fraction() }                                
local cumulatives = { rtcp_cumulative() }

print cumulatives[1].value – Prints value of cum_nr on SENDER REPORT print fractions[1].value – Prints value of fraction on EXTENDED REPORT print fractions[2].value – Prints value of fraction on SENDER REPORT

How can I know which fraction corresponds to the cumulative value without knowing the order of the RTCP messages on the packet?

I was hoping the cumulatives table would get filled with nil values for each message that didn’t have a cum_nr value, so I could do something like what you see below, but that is not the case, so the code below would work if the SR came before the ER but if the ER comes before the SR it would match the fraction value of the ER to the cumulative of the SR.

for k,v in pairs(fractions) do 
  if cumulatives[k] ~= nil then 
    print("fraction: " .. v .. " cumulative: " .. cumulatives[k].value)
  end
end

asked 18 Apr '16, 00:11

jotica's gravatar image

jotica
6113
accept rate: 0%

edited 18 Apr '16, 04:06