SWG Packet Compression
The compression algorithm used on SWG packets is a standard ZLIB algorithm.
Please refer to ZLIB documentation on how the algorithm functions, for the sake of simplicity, we use the ZLIB's Compress/Decompress functions on the data at a standard level of compression.
The data that is compressed is between the SOE Opcode and the footer. So far no stand-alone SWG Packets have been recorded that are compressed.
If data is compressed, the first byte of the footer (which is a compression byteflag) is 1. If it is not compressed, it is a 0.
Compression will occur BEFORE encryption, and BEFORE a CRC value is appended.
Compression is applied on all network status updates (both client and server), and on packets that are generally > 100 bytes. The largest any packet can be uncompressed is 496 bytes, which includes the footer. If it is larger it must be fragmented first.