Internet Networking Recitation #3: Header Compression

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Internet Networking

recitation #3

Header Compression

Spring Semester 2010, Dept. of Computer Science, Technion 1


Motivation
The size of network and transport layers headers may be a
significant overhead for small packets.
A problem in the links with
 Low bandwidth
 High bit error rates (BER)
 Long round-trip times (RTT).
Examples:
 VoIP traffic over wireless or cellular medium.
• 16kb/s data rate with a 20ms sampling rate produces packets with
40 bytes of data : 16Kb/s = 320b/20ms = 40Byte/20ms.
 Satellite links: high BER and delays.
 Using Telnet over slow modem connection with small (1byte) data size.
Solution: Compress the headers
 RTP/UDP/IP headers compression is defined in RFC2508.
 TCP/IP headers compression is defined in RFC 1144.

Internet Networking 2
Header Compression
This is not an end to end compression.
Compression is done in the ingress point of the (slow) serial link.
Decompression is done in the egress point of the serial link.
Compression is done between the network and the link layers.
Transparent to the network and transport layers.

RTP RTP

UDP UDP

IP
IP IP

H.C. H.C.
Link Layer
Link Layer Link Link

Internet Networking 3
Basic Idea

The sender and receiver keep track of active


connections.
The receiver keeps a copy of the header from the
last packet from each connection.
Differential coding: The delta between the current
and the previous packet is sent.
A connection number is sent with the compressed
packet.

Internet Networking 4
TCP/IP Headers

Internet Networking 5
Constant Fields

In a TCP connection
many fields are likely
to remain constant.
 A connection is
defined by:
source IP and port,
destination IP and
port.

Internet Networking 6
Unnecessary and Changeable Fields

Some fields are unnecessary


 Total length (redundancy with layer II protocols).
 IP checksum (only Packet ID is left in the IP header).
The other fields may be changed. However, they do
not all change at the same time.
 E.g. in an ACK packet the sequence number may remain
constant.
The sender sends only the fields that are changed.
 It uses the copy of the last packet that was sent for each
connection.
 A bit mask that indicates which fields were sent precedes
these fields.

Internet Networking 7
Changeable Fields

How the fields change?


 The difference between current and previous Packet ID is
small (usually 1).
 The difference between current and previous sequence
number is less than 216 (i.e. 2 bytes).
The differences in the changing fields are sent
rather than the fields themselves.

Internet Networking 8
Compressed Packet Format

Internet Networking 9
Compressed Packet Format

The first byte is a bit mask that identifies which of


the fields are actually changed.
TCP Checksum of the original packet is located in
the compressed header.
 An end-to-end integrity check is still valid.
 Used for error detection and resynchronization.
Connection Number may be omitted if is identical
to the Connection Number of the previous packet
sent.

Internet Networking 10
Packet Types

The sender can send 3 types of packets.


The packet type is stored in the header of the link layer protocol.
TYPE_IP - regular uncompressed IP packets.
UNCOMPRESSED_TCP - identical to the original packets
except the IP protocol field is replaced with a connection
number.
 Use to (re-)synchronizes the receiver.
 Use to send a TCP packet of new connection.
COMPRESSED_TCP

Internet Networking 11
The Compression System
IP packets go through the compressor.
TYPE_IP is selected if
 Non-TCP packets.
 IP fragments.
UNCOMPRESSED_TCP is selected if
 The connection is new.
 One of the constant fields has changed.
 The delta in one of the changeable fields is large or negative.
Otherwise, COMPRESSED_TCP is selected.

Internet Networking 12
The Compression System
The decompressor checks the type of incoming packets.
TYPE_IP packets are simply pass through.
UNCOMPRESSED_TCP packets
 The connection number is extracted and used as an index in the
array of saved headers.
 The header is copied into the array.
 The TCP protocol number is restored to the protocol field in the IP
header.
COMPRESSED_TCP packets
 The last packet from that connection is extracted from the array of
saved header using the connection number.
 The compressed header is used to restore a new TCP/IP header
and construct a new TCP/IP packet.
 The new header is stored in the array.

Internet Networking 13
Error detection

Error detection should be provided by layer-II.


 Transmission errors are detected by the egress point of the line.
 In such a case all following “COMPRESSED_TCP “ packets
without a connection number is discarded, until a “TYPE_IP” or
“UNCOMPRESSED_TCP” appears.
Problem: a missed packet cannot be detected by the egress
node of the line.
 This can corrupt all the packets that follow.
TCP checksum is not compressed, hence end-to-end reliability
is provided.

Internet Networking 14
IP/UDP/RTP Headers Compression

Real-time Transport Protocol (RFC 1889) provides network


transport functions for real-time applications such as audio
and video.
 Simple Multicast Audio Conference
 Audio and Video Conference
• Audio and video are transmitted in separate RTP sessions.
IP, UDP and RTP are typically used in conjunction when
delivering real-time traffic.
The three headers contain 40 bytes.
When the payload is small (e.g. VoIP) it is desirable to
compress the three headers - Compressed RTP (CRTP).

Internet Networking 15
IP/UDP/RTP Headers

+-------------------------------+--------------------------------+
| Source Port | Destination Port | U
+-------------------------------+--------------------------------+ D
| Length | Checksum | P
+---+-+-+-------+-+-------------+--------------------------------+
|V |P|X| CC |M| PT | Sequence Number +
+----------------------------------------------------------------+
R
| Time Stamp + T
+----------------------------------------------------------------+ P
| Synchronization Source Identifier +
+----------------------------------------------------------------+

Internet Networking 16
RTP header fields
version (V) - version of RTP (2 bits).
extension (X) – set to 1 if the fixed header is followed by exactly one
header extension (1 bit).
CSRC count (CC) - contains the number of CSRC identifiers that
follow the fixed header (4 bits ).
payload type (PT) - the format of the RTP payload (7 bits ).
sequence number (16 bits).
timestamp – the time sampling of the first octet in the packet (32 bits).
 increments by one for each RTP data packet sent.
 receiver matches the video with corresponding audio data using timestamp.
SSRC - the synchronization source (32 bits).
 receiver may need to synchronize data from several sources.
CSRC list - the contributing sources for the payload contained in this
packet. The number of identifiers is given by the CC field (up to 15
items, 32 bits each).
 Set by mixer upon re-synchronizing incoming audio from different sources

Internet Networking 17
Compressed RTP (RFC 2508).

Headers compression is done in the same way as IP/TCP


compression.
 Constant fields are removed.
 Differential coding of the changeable fields.
However,
 Constant first order differences are not sent (Packet ID, Time
Stamp).
 When the second-order difference is not zero, the magnitude of
the change is usually much smaller than the full number of bits in
the field. So the new first order difference is transmitted.
A connection is identified by: source IP and port, destination
IP and port, synchronization source of the RTP.
The identifier serves as an index to a table of stored session
contexts.

Internet Networking 18
Compressible fields

Constant fields
 SSRC identifier is constant in a given context
 CC and CSRC list are mostly unchanged.
Constant difference
 sequence number will increment by one for each packet.
 Timestamp:
• For audio - increment by number of sample periods.
• For video - change on the first packet of each frame.
Redundant fields:
 UDP length field.
 UDP checksum sometimes set to zero and not calculated.

Internet Networking 19
Packet formats

FULL_HEADER - all headers are uncompressed.


COMPRESSED_RTP – IP/UDP/RTP headers are
compressed.
COMPRESSED_UDP – compressed IP/UDP headers
followed by RTP uncompressed.
CONTEXT_STATE - packet sent from the decompressor
to the compressor indicating a list of context IDs with lost
synchronization.
 Sent on point-to-point link, no need in IP header.
COMPRESSED_NON_TCP used for IPv6

Internet Networking 20
Compressed RTP header
+-------------------------------+
| msb of session context ID |
M = RTP marker bit +-------------------------------+
| lsb of session context ID |
S = RTP sequence number +---+---+---+---+---+---+---+---+
| M | S | T | I | link sequence |
T = RTP timestamp +---+---+---+---+---+---+---+---+
| |
I = IPv4 packet ID + UDP checksum +
| |
L = RTP CSRC count and list +-------------------------------+
| M'| S'| T'| I'| CC |
Last bits of the sequence +-------------------------------+
| delta IPv4 ID |
number help loss detection. +-------------------------------+
| delta RTP sequence |
If MSTI bits set, then the real +-------------------------------+
values with CC will follow and | delta RTP timestamp |
CSRC list will fully appear. +-------------------------------+
| |
| CSRC list |
+-------------------------------+
| |
/ RTP data /
+-------------------------------+

Internet Networking 21
Error Detection and Recovery
Relies on a layer II error detection.
A 4-bit sequence number is added to every
compressed packet.
 Used to detect a missing packet.
In case the receiver detects a corrupted or missing
packet, it requests the sender to retransmit the
packet.

Internet Networking 22

You might also like