2.1.4 TCP

When TCP is used as a transport for this protocol, it requires an additional framing so that the TURN control messages can be identified within the TCP data stream. This additional framing consists of a header followed by the TURN datagram. This framing header MUST be used for all TURN messages and data sent to the TURN server. The framing header MUST NOT be used for the pseudo-TLS session establishment messages.

TCP Framing Header


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Type

Reserved

Length

Type (1 byte): The data contained in this frame is a TURN control message or end-to-end data. This MUST be set to "0x02" to identify a TURN control message or it MUST be set to "0x03" to identify end-to-end data.

Reserved (1 byte): Not used and MUST be set to zero.

Length (2 bytes): The number of bytes of the frame following immediately after the Length field itself.