Hi everyone. I'm writing the Lua dissector for some custom proxy protocol, say FOO, which uses TCP for transport. I have completed the TCP reassembly. The protocol run on FOO is simply TLS. After TCP reassembly, the FOO segments look like this (I'll try my best for illustration, since I can't post images :):
<-- FOO Header --><------- FOO Payload -------><-- FOO Header --><------- FOO Payload -------><--- ... --->
<------------------- FOO Segment 1 ------------------><------------------- FOO Segment 2 ------------------><--- ... --->
The FOO Payload is actually a TLS segment. Therefore, I tried to call TLS dissector directly:
--- Suppose the FOO Header is of length L
local tls_dissector = Dissector.get("tls")
--- Some code
tls_dissector(tvb(L):tvb(), pktinfo, tree)
However, it seems that such method does not reassemble TLS segments well. If a TLS Application Data record spans to two (or more) FOO segments, these segments except for the first one could not be dissected correctly. As a result, except for the first record, the remaining records shows no column information or mark as "Continuation Data".
Therefore, I think I should hand the FOO Payload as some new Tvb to the TLS dissector, like how TCP hands its payload to FOO dissector. I looked at Section 1.7 of README.dissector. It seems that tvb_new_subset_remaining could achieve this. I wonder whether Lua APIs provides this mechanism (I didn't find it in the Lua API Reference)?
Any suggestions would be appreciated!