RFC 1978
PPP Predictor Compression Protocol
RFC 1978: PPP Predictor Compression Protocol π
okay bestie, this is RFC 1978 π It's called PPP Predictor Compression Protocol, written by D. Rand from Novell, and it came out in August 1996 π It's an Informational doc, so it's just sharing info with the Internet community, not a formal standard. It doesn't obsolete or update any other RFCs (none are listed in its header), so no drama there β¨
Status of This Memo π
this memo gives info to the Internet community, and it does NOT specify an Internet standard of any kind π distribution is unlimited, so share it with everyone π«Ά
Abstract π¦
PPP (the Point-to-Point Protocol) [1] gives you a standard way to encapsulate multiple protocol datagrams over point-to-point links π
the PPP Compression Control Protocol [2] gives you a way to transport multi-protocol datagrams over PPP encapsulated links π§
this document is all about using the Predictor compression algorithm to compress PPP encapsulated packets π
Table of Contents ποΈ
1. Introduction ...................................... 1
2. Licensing ......................................... 2
3. Predictor Packets ................................. 2
3.1 Predictor theory ............................ 2
3.2 Encapsulation for Predictor type 1 .......... 7
3.3 Encapsulation for Predictor type 2 .......... 8
4. Configuration Option Format ....................... 9
SECURITY CONSIDERATIONS .................................. 9
REFERENCES ............................................... 9
ACKNOWLEDGEMENTS ......................................... 9
CHAIR'S ADDRESS .......................................... 9
AUTHOR'S ADDRESS ......................................... 9
1. Introduction β¨
okay so Predictor is a high speed compression algorithm, and it's license-fee free π ngl its compression ratio isn't as good as some other algorithms, BUT it's still one of the fastest ones out there ποΈπ¨
note that the people who wrote this took care to make sure the code doesn't infringe any patents, but there's no guarantee it isn't covered by a patent π
2. Licensing πΈ
there are no license fees or costs for using the Predictor algorithm π₯³
use the following code at your own risk β οΈ
3. Predictor Packets π¦
before any Predictor packets can be communicated, PPP has to reach the Network-Layer Protocol phase, AND the Compression Control Protocol has to reach the Opened state π
exactly one Predictor datagram gets encapsulated in the PPP Information field, and the PPP Protocol field says the type is hex 00FD (compressed datagram) π
the maximum length of the Predictor datagram sent over a PPP link is the same as the maximum length of the Information field of a PPP encapsulated packet π
before compression, the uncompressed data starts with the PPP Protocol number π’ this value MAY be compressed when Protocol-Field-Compression is negotiated π
PPP Link Control Protocol packets MUST NOT be sent within compressed data π ββοΈ no exceptions, bestie
3.1. Predictor theory π§
okay the main idea is this: Predictor fills a guess table with values, based on a hash of the previous characters it saw. since we're either emitting the source data OR depending on the guess table, we add a flag bit for every byte of input. that flag tells the decompressor whether to grab the byte from the compressed data stream or from the guess table π§
the cute part is that we block the input into groups of 8 characters, so we don't have to bit-insert the compressed output. a flag byte comes before every 8 bytes of compressed data, and each bit of the flag byte matches one byte of reconstructed data π¦
let's look at the source file first π
000000 4141 4141 4141 410a 4141 4141 4141 410a AAAAAAA.AAAAAAA.
000010 4141 4141 4141 410a 4141 4141 4141 410a AAAAAAA.AAAAAAA.
000020 4142 4142 4142 410a 4241 4241 4241 420a ABABABA.BABABAB.
000030 7878 7878 7878 780a xxxxxxx.
compressing that data gives you this:
000000 6041 4141 4141 0a60 4141 4141 410a 6f41 `AAAAA.`AAAAA.oA
000010 0a6f 410a 4142 4142 4142 0a60 4241 4241 .oA.ABABAB.`BABA
000020 420a 6078 7878 7878 0a B.`xxxxx.
and here's how to read the above π€
flag = 0x60 - 2 bytes in this block were guessed correctly, 5 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: A A A A A
Guess table: A A
flag = 0x60 - 2 bytes in this block were guessed correctly, 5 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: A A A A A
Guess table: A A
flag = 0x6f - 6 bytes in this block were guessed correctly, 0-3, 5 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: A
Guess table: A A A A A A
flag = 0x6f - 6 bytes in this block were guessed correctly, 0-3, 5 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: A
Guess table: A A A A A A
flag = 0x41 - 2 bytes in this block were guessed correctly, 0 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: B A B A B
Guess table: A A
flag = 0x60 - 2 bytes in this block were guessed correctly, 5 and 6.
Reconstructed data is: 0 1 2 3 4 5 6 7
File: B A B A B
Guess table: A B
flag = 0x60 - 2 bytes in this block were guessed correctly, 5 and 6
Reconstructed data is: 0 1 2 3 4 5 6 7
File: x x x x x
Guess table: x x
okay now for the source π» the code has been modified to work with a split block. if your data stream can't be split within a block (like when you're compressing packets), then the code dealing with "final" and the memcpy aren't required π you can spot this situation (or errors, honestly) by noticing that the flag byte says more data is needed from the compressed data stream, but you're out of data (len in decompress is <= 0). it is ok if len == 0 and the flags say guess table usage β¨
the actual code is coming up next, bestie π
3.2. Encapsulation for Predictor type 1 β¨
okay bestie, so the packet layout for type 1 goes like this: the protocol type first, then 1 bit that says whether the data is compressed or not, then 15 bits for the uncompressed data length in octets, then the compressed data, then a CRC-16 of those two length octets (in network byte order), and finally the original uncompressed packet π
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CCP Protocol Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| * | Uncompressed length (octets) | * is compressed flag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1 means data is compressed
| Compressed data... | 0 means data is not compressed |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CRC - 16 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The CCP Protocol Identifier that starts the packet is always 0xfd πΈ If PPP Protocol field compression hasn't been negotiated, it MUST be a 16-bit field. no skipping this one, babe π
The compressed data is the Protocol Identifier and the Info fields of the original PPP packet described in [1], but not the Address, Control, FCS, or Flag. The CCP Protocol field MAY be compressed as described in [1], regardless of whether the Protocol field of the CCP Protocol Identifier is compressed or whether PPP Protocol field compression has been negotiated. so flexible, it's giving π¦
Fields don't have to land on an even word boundary, and the compressed data can be any length π§ Now the scary part: if the CRC-16 doesn't match the decoded frame during decoding, it means the compress or decompress process has gone desynchronized π This happens when a frame gets lost in transit and LAPB isn't being used. The fix is to send a new configure-request, and CCP drops out of the open state. Once the configure-ack comes back, the predictor tables get cleared to zero, and compression can pick back up with no data loss. iconic recovery arc π
3.3. Encapsulation for Predictor type 2 π
the type 2 layout is giving a different vibe π You get the protocol type, followed by the data stream. Inside that stream you've got the current frame length (uncompressed), the compressed data, and a CRC-16 of the two-octet unsigned length in network byte order, then the original uncompressed data. The data stream can get chopped up at any convenient spot for encapsulation purposes. With type 2, LAPB is basically essential for correct delivery, so don't play with fire here π₯
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CCP Protocol Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| * | Uncompressed length (octets) | * is compressed flag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1 means data is compressed
| Compressed data... | 0 means data is not compressed |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CRC-16 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| * | Uncompressed length (octets) | * is compressed flag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ...
The CCP Protocol Identifier that starts the packet is always 0xfd. If PPP Protocol field compression hasn't been negotiated, it MUST be a 16-bit field. same energy as before, we don't skip it π
The compressed data is the Protocol Identifier and the Info fields of the original PPP packet described in [1], but not the Address, Control, FCS, or Flag. The CCP Protocol field MAY be compressed as described in [1], regardless of whether the Protocol field of the CCP Protocol Identifier is compressed or whether PPP Protocol field compression
the original text cuts off right here mid-sentence, so this is where the source ends, bestie π
Fields don't have to land on an even word boundary, and the compressed data can be any length. If the CRC-16 doesn't match the decoded frame during decoding, the compress or decompress process has desynchronized. That happens when a frame is lost in transit and LAPB isn't used. The fix is the same vibe as type 1: a new configure-request gets sent, CCP drops out of the open state, and once the configure-ack arrives, the predictor tables are cleared to zero so compression can resume without data loss π¦
4. Configuration Option Format β¨
there are no options for Predictor type one or two π zero config, zero stress π
Security Considerations π
Security issues are not discussed in this memo. π That's the whole story, no hidden plot twist.
References
- [1] Simpson, W., "The Point-to-Point Protocol", STD 51, RFC 1661, July 1994.
- [2] Rand, D., "The PPP Compression Control Protocol (CCP)", RFC 1962, June 1996.
- [3] Rand, D., "PPP Reliable Transmission", RFC 1663, July 1994.
Acknowledgments π«Ά
The predictor algorithm was originally implemented by Timo Raita, at the ACM SIG Conference, New Orleans, 1987. Legend.
Bill Simpson helped with the document formatting. β¨
Chair's Address πΈ
The working group can be contacted via the current chair:
Karl Fox
Ascend Communications
3518 Riverside Drive, Suite 101
Columbus, Ohio 43221
EMail: karl@ascend.com
Author's Address π
Questions about this memo can also be directed to:
Dave Rand
Novell, Inc.
2180 Fortune Drive
San Jose, CA 95131
+1 408 321-1259
EMail: dave_rand@novell.com
π¦ where this page comes from
- ietf: rfc1978 1996-08
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms