The bizarre packet type numbers in sec. A.1 were chosen to allow a `packet type' to be sent on lines where it is undesirable or impossible to add an explicit type byte. Note that the first byte of an IP packet always contains `4' (the IP protocol version) in the top four bits. And that the most significant bit of the first byte of the compressed header is ignored. Using the packet types in sec. A.1, the type can be encoded in the most significant bits of the outgoing packet using the code
p->dat[0] |= sl_compress_tcp(p, comp);and decoded on the receive side by
if (p->dat[0] & 0x80) type = TYPE_COMPRESSED_TCP; else if (p->dat[0] >= 0x70) { type = TYPE_UNCOMPRESSED_TCP; p->dat[0] &=~ 0x30; } else type = TYPE_IP; status = sl_uncompress_tcp(p, type, comp);