RFC 2118

Microsoft Point-To-Point Compression (MPPC) Protocol

πŸ“… published March 1997, from ietf

RFC 2118: Microsoft Point-To-Point Compression (MPPC) Protocol βœ¨πŸŽ€

Network Working Group Β· πŸ’– Request for Comments: 2118 πŸ’–

Author: G. Pall, Microsoft Corporation πŸ’» Category: Informational πŸ¦‹ Date: March 1997 πŸ“…

Okay bestie, this one is all about MPPC, the Microsoft Point-To-Point Compression protocol, and how it squishes PPP packets down so they take up less space on a link. It's a lowkey iconic piece of networking history πŸ‘‘

Status of this Memo 🌸

This memo gives information to the Internet community. It is not an Internet standard of any kind, and anyone is allowed to distribute it without limits. πŸ’…

Abstract 🫢

PPP (the Point-to-Point Protocol) [1] is the standard way to send multi-protocol datagrams over point-to-point links. πŸ”—

The PPP Compression Control Protocol [2] is what lets two ends negotiate and use compression protocols on those PPP-encapsulated links. 🀝

This document is all about the Microsoft Point to Point Compression protocol (MPPC, as we'll call it from here) and how it compresses PPP-encapsulated packets. πŸŽ€

Table of Contents πŸ“š

1.     Introduction ..........................................    2
   1.1       Licensing .......................................    2
   1.2.      Specification of Requirements ...................    2
2.     Configuration Option Format ...........................    3
3.     MPPC Packets ..........................................    4
   3.1       Packet Format....................................    5
4. Description of Compressor and Encoding ....................    6
   4.1       Literal Encoding ................................    7
   4.2       Copy Tuple Encoding .............................    7
       4.2.1     Offset Encoding .............................    7
       4.2.2     Length-of-Match Encoding ....................    7
   4.3       Synchronization .................................    8
SECURITY CONSIDERATIONS ......................................    8
REFERENCES ...................................................    9
ACKNOWLEDGEMENTS .............................................    9
CHAIR'S ADDRESS    ...........................................    9
AUTHORS' ADDRESS .............................................    9

1. Introduction ✨

So MPPC is basically a way to represent any PPP packet in a compressed form. 🧚 The whole algorithm is built to be easy on the processor and the bandwidth, so one box can handle a ton of connections at once. πŸ’ͺ It's also tuned for typical PPP setups, like the usual 1500 byte MTU and friends. πŸ“

Under the hood, MPPC uses an LZ [3] style algorithm with a sliding window history buffer. 🌈

MPPC keeps one continuous history. After 8192 bytes of data have been sent compressed, there are always 8192 bytes of history to compress against, unless the history gets flushed. 🫢

1.1. Licensing πŸ’–

MPPC can only be used in products that implement the Point to Point Protocol AND only to interoperate with other MPPC and Point to Point Protocol implementations. πŸ”’

Source and object licenses are available on a non-discriminatory basis from Stac Electronics. If you want to reach out, here's the contact info:

      Cheryl Poland
      Stac Electronics
      12636 High Bluff Drive,
      San Deigo, CA 92130
      Phone: (619)794-4534
      Email: cherylp@stac.com

1.2. Specification of Requirements πŸ“

This document uses a handful of words to signal how strict a requirement is. They're often written in capitals, so keep an eye out for them. πŸ‘€

  • MUST: This word (or the adjective "required") means the definition is an absolute requirement of the specification. πŸ”₯
  • MUST NOT: This phrase means the definition is an absolute prohibition of the specification. 🚫
  • SHOULD: This word (or the adjective "recommended") means there may be valid reasons in particular circumstances to ignore this item. Even so, the full implications MUST be understood and carefully weighed before picking a different path. πŸ€”
  • MAY: This word (or the adjective "optional") means this item is one of an allowed set of alternatives. An implementation that doesn't include this option MUST still be prepared to interoperate with another implementation that does include it. πŸ¦‹

2. Configuration Option Format πŸŽ€

Description

The CCP Configuration Option is how the two ends negotiate MPPC on the link. 🀝 If there's ultimate disagreement (or nothing gets agreed on by default), no compression is used. πŸ’€

Here's a quick summary of the CCP Configuration Option format. The fields go from left to right. πŸ‘‰

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |        Supported Bits         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       Supported Bits          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type

18 πŸ”’

Length

6 πŸ“

Supported Bits

This field is 4 octets long, most significant octet first. If the least significant bit in the least significant octet is set to 1, it means the sender wants to negotiate MPPC. βœ…

All other bits MUST be set to 0. πŸ™…β€β™€οΈ

3. MPPC Packets πŸ“¦

Before any MPPC packets can be sent, PPP has to reach the Network-Layer Protocol phase, and the CCP Control Protocol has to reach the Opened state. 🚦

Each MPPC datagram is encapsulated in the PPP Information field, one per datagram. 🎁 The PPP Protocol field is set to hex 00FD for all compressed datagrams. πŸ’œ

The biggest an MPPC datagram can get over a PPP link is the same as the maximum length of the Information field of a PPP encapsulated packet. Since the history buffer is capped at 8192 bytes, this length can't go past 8192 bytes either. πŸ“

Only packets with PPP Protocol numbers from hex 0021 to hex 00FA get compressed. Everything else skips the MPPC processor and goes out with its original PPP Protocol number. πŸ™ˆ

Padding

Padding isn't recommended with MPPC, because it totally defeats the purpose of compression. πŸ™ƒ If the sender really has to use padding, it MUST negotiate the Self-Describing-Padding Configuration option during the LCP phase and use self-describing pads. 🧸

Reliability and Sequencing

MPPC doesn't need a reliable link. πŸ€·β€β™€οΈ Instead, every packet carries a 12 bit coherency count, and that's what keeps the history buffers in sync. πŸ” If the receiver notices that the coherency count in a packet doesn't match the one it's expecting, it sends a CCP Reset-Request packet to resynchronize its history buffer with the sender's. πŸ”„

MPPC expects packets to arrive in sequence. Otherwise, history buffer re-synchronization won't happen. 😭

MPPC MAY be used over a reliable link, as described in "PPP Reliable Transmision" [5]. It's usually just extra overhead, though, since only the coherency count is needed. πŸ’…

Data Expansion

If compressing the data makes it bigger (data expansion), the original data gets sent as an uncompressed MPPC packet. The sender must flush the history before compressing any more data, and it has to set the FLUSHED bit on the next outgoing packet. 🧹✨

3.1. Packet Format πŸŽ€

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         PPP Protocol          |A|B|C|D| Coherency Count       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Compressed Data...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

PPP Protocol

The PPP Protocol field is described in the Point-to-Point Protocol Encapsulation [1]. πŸ“–

Once MPPC is successfully negotiated by the PPP Compression Control Protocol, the value is hex 00FD. πŸ’– That value MAY be compressed when Protocol-Field-Compression is negotiated. πŸ—œοΈ

Bit A

Bit A tells you the history buffer was just initialized before this packet was generated. πŸ†• This packet can ALWAYS be decompressed, because it isn't based on any previous history. 🌟 It's usually sent to tell the peer that the sender initialized its history buffer before compressing, so the receiving peer has to initialize its own history buffer before decompressing. In this document, this bit is called the FLUSHED bit. 🧹

Implementation Note: Compression and decompression histories are always initialized with all zeroes. 0️⃣

Bit B

Bit B says the packet was moved to the front of the history buffer, usually because there wasn't any room left at the end of it. πŸƒβ€β™€οΈ This bit tells the decompressor to set its history pointer to the beginning of the history buffer. πŸ‘ˆ

Implementation Notes:

  1. It's implied that this bit must be set at least once for every 8192 bytes of data sent compressed. ⏰
  2. It's also implied that this bit can be set even if the sender's history buffer isn't full. Initialized history that hasn't been used for compressing data must not be referred to in the compressed packets. πŸ™…β€β™€οΈ

Bit C

If this bit is set, it means the packet is compressed. πŸ—œοΈβœ…

Bit D

This bit must be set to 0. 0️⃣

Coherency Count

The coherency count is how we make sure packets arrive in the right order and that none got dropped. πŸ•΅οΈβ€β™€οΈ It starts at 0 and goes up by 1 every time, and it NEVER decreases or goes back. πŸ“ˆ When all bits are 1, it wraps back around to 0. πŸ”

Compressed Data

The compressed data begins with the protocol field. For example, for an IP packet (0021 followed by an IP header), the compressor will first try to compress the 0021 protocol field, and then compress the IP header. 🧩

If the packet has header compression, the MPPC compressor is applied AFTER the header compression is performed, and it MUST be applied to the compressed header too. For example, if a packet carried protocol 002d for a compressed TCP/IP header, the compressor would first try to compress 002d, then try to compress the compressed Van-Jacobsen TCP/IP header. 🧠

4. Description of Compressor and Encoding πŸ§šβ€β™€οΈ

The compressor goes through the whole frame and outputs either a Literal (a byte that gets sent uncompressed) or an <Offset, Length-of-Match> Copy tuple. Offset is how many bytes back in the history the match lies, and Length-of-Match is how many bytes to copy from the spot that Offset points to. πŸͺ„

Let's look at an example string:

0         1         2         3         4
012345678901234567890123456789012345678901234567890
for whom the bell tolls, the bell tolls for thee.

The compressor would produce:

for whom the bell tolls,<16,15> <40,4><19,3>e.

The Literal and Copy tuple tokens are then encoded according to the MPPC encoding scheme. βœ¨πŸ’œ

4.1 Literal Encoding

Okay so literals are just bytes that get sent totally uncompressed πŸ’…. If the value of a Literal is below hex 80, it gets encoded as its own value, no extra steps 🌸. If the Literal is bigger than hex 7F, it's sent as bits 10 followed by the lower 7 bits of the Literal ✨.

Example:

Literal hex 56 is transmitted as  01010110
Literal hex E7 is transmitted as 101100111

4.2 Copy Tuple Encoding

Copy tuples are where the compressed data lives πŸ¦‹. A tuple has two elements, the Offset and the Length-of-Match, and the Offset always gets encoded before the Length-of-Match. The order is giving structure πŸ‘‘.

4.2.1 Offset Encoding

Offset values less than 64 are encoded as bits 1111 followed by the lower 6 bits of the value 🧚.

Offset values between 64 and 320 are encoded as bits 1110 followed by the lower 8 bits of the computation (value - 64) πŸ’œ.

Offset values between 320 and 8191 are encoded as bits 110 followed by the lower 13 bits of the computation (value - 320) 🌈.

Examples:

Offset value of 3 is encoded as:     1111 000011
Offset value of 128 is encoded as:   1110 01000000
Offset value of 1024 is encoded as:   110 0001011000000

4.2.2 Length-of-Match Encoding

Length of 3 is encoded with bit 0 πŸ“.

Length values from 4 to 7 are encoded as 10 followed by lower 2 bits of the value.

Length values from 8 to 15 are encoded as 110 followed by lower 3 bits of the value.

Length values from 16 to 31 are encoded as 1110 followed by lower 4 bits of the value.

Length values from 32 to 63 are encoded as 11110 followed by lower 5 bits of the value.

Length values from 64 to 127 are encoded as 111110 followed by lower 6 bits of the value.

Length values from 128 to 255 are encoded as 1111110 followed by lower 7 bits of the value.

Length values from 256 to 511 are encoded as 11111110 followed by lower 8 bits of the value.

Length values from 512 to 1023 are encoded as 111111110 followed by lower 9 bits of the value.

Length values from 1024 to 2047 are encoded as 1111111110 followed by lower 10 bits of the value.

Length values from 2048 to 4095 are encoded as 11111111110 followed by lower 11 bits of the value.

Length values from 4096 to 8191 are encoded as 111111111110 followed by lower 12 bits of the value.

Examples:

Length of 15 is encoded as:           110 111
Length of 120 is encoded as:       111110 111000
Length of 4097 is encoded as:111111111110 000000000001

The largest Length value that can be encoded is 8191 πŸ”₯.

4.3 Synchronization

Packets can get lost during transfer, which is the whole reason this section exists πŸ™ˆ. If the coherency count the decompressor is maintaining doesn't match the coherency count in the compressed packet, the decompressor drops that packet and sends a CCP Reset-Request packet. When the compressor gets that packet, it flushes the history buffer and sets the FLUSHED bit in the next packet it sends. When the decompressor gets a packet with its FLUSHED bit set, it flushes its own history buffer and sets its coherency count to the one the compressor transmitted in that packet. So synchronization is achieved without a CCP Reset-Ack packet, and honestly that's so clean 🫢✨.

Security Considerations πŸ”’

Security issues are not discussed in this memo.

References πŸ“š

  • [1] Simpson, W., Editor, "The Point-to-Point Protocol (PPP)", STD 51, RFC 1661, Daydreamer, July 1994.
  • [2] Rand, D., "The PPP Compression Control Protocol (CCP)", RFC 1962, Novell, June 1996.
  • [3] Lempel, A. and Ziv, J., "A Universal Algorithm for Sequential Data Compression", IEEE Transactions On Information Theory, Vol. IT-23, No. 3, May 1977.
  • [4] Rand, D., "PPP Reliable Transmission", RFC 1663, Novell, July 1994.

Acknowledgments πŸ’–

Thomas Dimitri made significant contributions towards the design and development of Microsoft Point-To-Point Compression Protocol. Robert Friend of Stac Technology provided editoral input. Huge thanks to them both, they're literally the reason this works πŸ‘‘.

Chair's Address πŸŽ€

The working group can be contacted via the current chair:

      Karl F. Fox
      Ascend Communications
      3518 Riverside Dr., Suite 101
      Columbus, Ohio  43221

      (614) 451-1883

      EMail: karl@ascend.Com

Author's Address πŸ¦‹

Questions about this memo can also be directed to:

      Gurdeep Singh Pall
      1, Microsoft Way,
      Redmond, WA 98052

      (206) 882-8080

      Email: gurdeep@microsoft.com

That's the whole thing, bestie πŸŒˆπŸ’…βœ¨

πŸ“¦ where this page comes from