I've added an option to compress NETROM (L4) frames. As large blocks of data compress better than small ones it takes all data queued to be sent on a connection and compresses them using Deflate. The compressed data is then split up into packets (default size 236) to be sent over the link. Once all the compressed packets have been received the data is expanded and passed to the session partner.
There is a trade off between compression efficiency and latency - the receiving end has to receive the whole compressed message before it can be expanded and sent on. So the code limits the number of compressed packets (default is 3) that can be sent. If the compressed data exceeds this limit the input data is split and re-compressed in chunks. Both the send packet size and limit on frames is configurable.
Compression is only used if both ends of the connection have compression enabled.
Configuration.
L4Compress=1 turns on compression. default is off.
L4CompMaxframe=n limits number of frames of compressed data to send. Default 3.
L4CompPaclen=n sets packet size of compressed frames. Default it 236.
Compatibility.
The code uses a spare bit in the NETROM Opcode to indicate compressed frames and a spare bit in the BPQ NETROM Connect Request extensions to request and confirm compression. This is backwards compatible with earlier versions of BPQ. There is a possibility that these bits could be handled differently in other node software so please check for problems if communicating with other software.
Monitoring.
In BPQ monitor output compressed frames have a C on end of monitor header, eg MB7NPW to G8BPQ-9 ttl 21 cct=09F2
At the end of each session a line is written to syslog (Linux) or DebugView log (Windows) giving compression stats.
L4 Compression Stats G8BPQ-9 MB7NPW TX 171 133 22% RX 1157 1311 13%. Numbers are input then output so for receive the bytes output is greater than the bytes input.