IrTTP - Tiny Transport Protocol
The IrTTP layer uses the IrLMP and IrLAP layers to offer high-level connection and flow control services.
The IrTTP flow control between two nodes uses a credit-based system.
There is considerable overlap between the IrTTP and IrLMP layers with the C/D bit in the IrLMP header also used.
IrTTP supports these services:
IrTTP services add a 1-byte overhead to the IrLMP frame with the appending of the IrTTP credit after the IrLMP header.
As for IrLMP, all IrTTP frames are I frames. As for IrLMP, the connect and disconnect services use IrLMP/IrTTP control frames, ie C/D = 1. All other services use IrLMP/IrTTP data frames, ie C/D = 0.
Briefly, another service that IrTTP provides is segmentation and reassembly (SAR). This is used when a large data object cannot fit into a frame and must be partitioned then re-joined. The 1-bit More flag (M) is used to indicate frames that comprise part of a data object, ie the non-last frame(s) have M = 1, the last frame has M = 0. For IrDA lite, where SAR is not used, in all frames, M = 0.
Service 1 of 3 - Connection
An IrTTP connect serves to connect to allow higher level, eg IrCOMM, application data to be transferred. As part of the IrTTP connect, an initial credit value is specified.
Service 2 of 3 - Data Transfer
Higher level data is transferred using IrTTP data I frames where each data frame sent consumes one credit at the remote node.
When a node is able to receive N frames of higher level data, eg IrCOMM data, that node gives N credits to the remote node either:
Each credit relates to the availability and allocation of a receive buffer from the buffer pool of the remote node.
The IrTTP advance-credit message does not need a remote credit nor does it consume a remote credit, ie it may be sent at any time. This works in a similar way to XON/XOFF flow control where a XON may be sent at any time to resume data transfer and does not contain data.
Service 3 of 3 - Disconnection
As for IrLMP, after an IrTTP disconnect, the link state reverts back to basic IrLAP NRM, ie there is still a logical connection at the IrLAP layer.
The simplest possible credit scheme is used. For the primary stack, a credit of one issued:
For the secondary stack, a credit of one issued:
Thus, the remote stack is always enabled to transmit data without being restricted by the IrTTP current credit status.
As SAR is not supported, for all IrTTP frames, M = 0.