Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do you determine the PDU length when there is no length field?

Perhaps you don't. For HTTP, for example, there's no length field for the HTTP header - it continues until there's a blank line - so reassembling HTTP requests and replies doesn't use tcp_dissect_pdus(). The routine that does reassembly for "request/response protocols", meaning "protocols that work somewhat like HTTP", req_resp_hdrs_do_reassembly() handles the blank-line terminator for the header and the Content-Length header for the body.

tcp_dissect_pdus() is for protocols where 1) there's a minimum length for a PDU and 2) if you have that many bytes of data from the beginning of the PDU, you can determine the length, either by extracting it from a length field, or by looking at the PDU type and determining the length based on that, or some other such mechanism.

There's currently no built-in mechanism to handle reassembly of arbitrary protocols where the length is determined by a terminator, so you'd have to implement reassembly yourself. Sadly, there's not much in the way of helper routines or documentation for how to do that. You might get some hints by looking at the way that req_resp_hdrs_do_reassembly() handles reassembling the HTTP header.