You are here: Elements > Decoder Script Reference > PAYLOAD_IS_BYTE_STREAM

PAYLOAD_IS_BYTE_STREAM

PAYLOAD_IS_BYTE_STREAM is used in conjunction with BYTE_STREAM_FRAMER for cases where the payload for that layer is just one part of a byte stream that includes the payloads from frames before and/or after it. It means that the payload of all the coming layers should be considered a continuous stream and the divisions of the physical frames should be ignored.

For example, assume you have a custom protocol called MyCustomProtocol. This protocol traverses to higher layers in the stack. The payload for MyCustomProtocol can be split up among several physical frames. In order to correctly decode MyCustomProtocol, you need to take the MyCustomProtocol payloads from several frames and string them all together. PAYLOAD_IS_BYTE_STREAM tells the decoder to do this.

Then you need a way to tell when one MyCustomProtocol layer ends and the next begins, very much like a frame recognizer. For efficiency and technical reasons, we can't use the real frame recognizer, so we created a way to make a frame recognizer for cases like this. BYTE_STREAM_FRAMER invokes a method that acts as a frame recognizer for these embedded byte streams.

To use this feature, put the PAYLOAD_IS_BYTE_STREAM keyword in the header of your BYTE_STREAM_FRAMER keyword in the header and reference a method that can correctly determine when the MyCustomProtocol layer is finished.

When MyCustomProtocol traverses to IP, the BYTE_STREAM_FRAMER method is invoked and the payloads of the next frames are joined to the payload of the first frame until the end of the MyCustomProtocol frame is reached.

If MyCustomProtocol should traverse to a protocol that doesn't have the BYTE_STREAM_FRAMER keyword in it, then the physical packets are the frame boundaries.