rfc2508.txt

来自「RFC 的详细文档!」· 文本 代码 · 共 1,348 行 · 第 1/5 页

TXT
1,348
字号
   number for each packet.  (Some systems increment the ID with the
   bytes swapped, which results in slightly less compression.)  In the
   IPv6 base header, there is no packet ID nor header checksum and only
   the payload length field changes.







Casner & Jacobson           Standards Track                     [Page 5]

RFC 2508             Compressing IP/UDP/RTP Headers        February 1999


   In the UDP header, the length field is redundant with the IP total
   length field and the length indicated by the link layer.  The UDP
   check-sum field will be a constant zero if the source elects not to
   generate UDP checksums.  Otherwise, the checksum must be communicated
   intact in order to preserve the lossless compression.  Maintaining
   end-to-end error detection for applications that require it is an
   important principle.

   In the RTP header, the SSRC identifier is constant in a given context
   since that is part of what identifies the particular context.  For
   most packets, only the sequence number and the timestamp will change
   from packet to packet.  If packets are not lost or misordered
   upstream from the compressor, the sequence number will increment by
   one for each packet.  For audio packets of constant duration, the
   timestamp will increment by the number of sample periods conveyed in
   each packet.  For video, the timestamp will change on the first
   packet of each frame, but then stay constant for any additional
   packets in the frame.  If each video frame occupies only one packet,
   but the video frames are generated at a constant rate, then again the
   change in the timestamp from frame to frame is constant.  Note that
   in each of these cases the second-order difference of the sequence
   number and timestamp fields is zero, so the next packet header can be
   constructed from the previous packet header by adding the first-order
   differences for these fields that are stored in the session context
   along with the previous uncompressed header.  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 size can be
   reduced by encoding the new first-order difference and transmitting
   it rather than the absolute value.

   The M bit will be set on the first packet of an audio talkspurt and
   the last packet of a video frame.  If it were treated as a constant
   field such that each change required sending the full RTP header,
   this would reduce the compression significantly.  Therefore, one bit
   in the compressed header will carry the M bit explicitly.

   If the packets are flowing through an RTP mixer, most commonly for
   audio, then the CSRC list and CC count will also change.  However,
   the CSRC list will typically remain constant during a talkspurt or
   longer, so it need be sent only when it changes.

3.3.  The protocol

   The compression protocol must maintain a collection of shared
   information in a consistent state between the compressor and
   decompressor.  There is a separate session context for each
   IP/UDP/RTP packet stream, as defined by a particular combination of
   the IP source and destination addresses, UDP source and destination



Casner & Jacobson           Standards Track                     [Page 6]

RFC 2508             Compressing IP/UDP/RTP Headers        February 1999


   ports, and the RTP SSRC field.  The number of session contexts to be
   maintained MAY be negotiated between the compressor and decompressor.
   Each context is identified by an 8- or 16-bit identifier, depending
   upon the number of contexts negotiated, so the maximum number is
   65536.  Both uncompressed and compressed packets MUST carry the
   context ID and a 4-bit sequence number used to detect packet loss
   between the compressor and decompressor.  Each context has its own
   separate sequence number space so that a single packet loss need only
   invalidate one context.

   The shared information in each context consists of the following
   items:

      o The full IP, UDP and RTP headers, possibly including a CSRC
        list, for the last packet sent by the compressor or
        reconstructed by the decompressor.

      o The first-order difference for the IPv4 ID field, initialized to
        1 whenever an uncompressed IP header for this context is
        received and updated each time a delta IPv4 ID field is received
        in a compressed packet.

      o The first-order difference for the RTP timestamp field,
        initialized to 0 whenever an uncompressed packet for this
        context is received and updated each time a delta RTP timestamp
        field is received in a compressed packet.

      o The last value of the 4-bit sequence number, which is used to
        detect packet loss between the compressor and decompressor.

      o The current generation number for non-differential coding of UDP
        packets with IPv6 (see [3]).  For IPv4, the generation number
        may be set to zero if the COMPRESSED_NON_TCP packet type,
        defined below, is never used.

      o A context-specific delta encoding table (see section 3.3.4) may
        optionally be negotiated for each context.

   In order to communicate packets in the various uncompressed and
   compressed forms, this protocol depends upon the link layer being
   able to provide an indication of four new packet formats in addition
   to the normal IPv4 and IPv6 packet formats:

      FULL_HEADER - communicates the uncompressed IP header plus any
      following headers and data to establish the uncompressed header
      state in the decompressor for a particular context.  The FULL-
      HEADER packet also carries the 8- or 16-bit session context
      identifier and the 4-bit sequence number to establish



Casner & Jacobson           Standards Track                     [Page 7]

RFC 2508             Compressing IP/UDP/RTP Headers        February 1999


      synchronization between the compressor and decompressor.  The
      format is shown in section 3.3.1.

      COMPRESSED_UDP - communicates the IP and UDP headers compressed to
      6 or fewer bytes (often 2 if UDP checksums are disabled), followed
      by any subsequent headers (possibly RTP) in uncompressed form,
      plus data.  This packet type is used when there are differences in
      the usually constant fields of the (potential) RTP header.  The
      RTP header includes a potentially changed value of the SSRC field,
      so this packet may redefine the session context.  The format is
      shown in section 3.3.3.

      COMPRESSED_RTP - indicates that the RTP header is compressed along
      with the IP and UDP headers.  The size of this header may still be
      just two bytes, or more if differences must be communicated.  This
      packet type is used when the second-order difference (at least in
      the usually constant fields) is zero.  It includes delta encodings
      for those fields that have changed by other than the expected
      amount to establish the first-order differences after an
      uncompressed RTP header is sent and whenever they change.  The
      format is shown in section 3.3.2.

      CONTEXT_STATE - indicates a special packet sent from the
      decompressor to the compressor to communicate a list of context
      IDs for which synchronization has or may have been lost.  This
      packet is only sent across the point-to-point link so it requires
      no IP header.  The format is shown in section 3.3.5.

   When this compression scheme is used with IPv6 as part of the general
   header compression framework specified in [3], another packet type
   MAY be used:

      COMPRESSED_NON_TCP - communicates the compressed IP and UDP
      headers as defined in [3] without differential encoding.  If it
      were used for IPv4, it would require one or two bytes more than
      the COMPRESSED_UDP form listed above in order to carry the IPv4 ID
      field.  For IPv6, there is no ID field and this non-differential
      compression is more resilient to packet loss.

   Assignments of numeric codes for these packet formats in the Point-
   to-Point Protocol [4] are to be made by the Internet Assigned Numbers
   Authority.

3.3.1.  FULL_HEADER (uncompressed) packet format

   The definition of the FULL_HEADER packet given here is intended to be
   the consistent with the definition given in [3].  Full details on
   design choices are given there.



Casner & Jacobson           Standards Track                     [Page 8]

RFC 2508             Compressing IP/UDP/RTP Headers        February 1999


   The format of the FULL_HEADER packet is the same as that of the
   original packet.  In the IPv4 case, this is usually an IP header,
   followed by a UDP header and UDP payload that may be an RTP header
   and its payload.  However, the FULL_HEADER packet may also carry IP
   encapsulated packets, in which case there would be two IP headers
   followed by UDP and possibly RTP.  Or in the case of IPv6, the packet
   may be built of some combination of IPv6 and IPv4 headers.  Each
   successive header is indicated by the type field of the previous
   header, as usual.

   The FULL_HEADER packet differs from the corresponding normal IPv4 or
   IPv6 packet in that it must also carry the compression context ID and
   the 4-bit sequence number.  In order to avoid expanding the size of
   the header, these values are inserted into length fields in the IP
   and UDP headers since the actual length may be inferred from the
   length provided by the link layer.  Two 16-bit length fields are
   needed; these are taken from the first two available headers in the
   packet.  That is, for an IPv4/UDP packet, the first length field is
   the total length field of the IPv4 header, and the second is the
   length field of the UDP header.  For an IPv4 encapsulated packet, the
   first length field would come from the total length field of the
   first IP header, and the second length field would come from the
   total length field of the second IP header.

   As specified in Sections 5.3.2 of [3], the position of the context ID
   (CID) and 4-bit sequence number varies depending upon whether 8- or
   16-bit context IDs have been selected, as shown in the following
   diagram (16 bits wide, with the most-significant bit is to the left):

           For 8-bit context ID:

           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |0|1| Generation|      CID      |  First length field
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |            0          |  seq  |  Second length field
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

           For 16-bit context ID:

           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |1|1| Generation|   0   |  seq  |  First length field
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |              CID              |  Second length field
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



Casner & Jacobson           Standards Track                     [Page 9]

RFC 2508             Compressing IP/UDP/RTP Headers        February 1999


   The first bit in the first length field indicates the length of the
   CID.  The length of the CID MUST either be constant for all contexts
   or two additional distinct packet types MUST be provided to
   separately indicate COMPRESSED_UDP and COMPRESSED_RTP packet formats
   with 8- and 16-bit CIDs.  The second bit in the first length field is
   1 to indicate that the 4-bit sequence number is present, as is always
   the case for this IP/UDP/RTP compression scheme.

   The generation field is used with IPv6 for COMPRESSED_NON_TCP packets
   as described in [3].  For IPv4-only implementations that do not use
   COMPRESSED_NON_TCP packets, the compressor SHOULD set the generation
   value to zero.  For consistent operation between IPv4 and IPv6, the
   generation value is stored in the context when it is received by the
   decompressor, and the most recent value is returned in the
   CONTEXT_STATE packet.

   When a FULL_HEADER packet is received, the complete set of headers is
   stored into the context selected by the context ID.  The 4-bit
   sequence number is also stored in the context, thereby
   resynchronizing the decompressor to the compressor.

   When COMPRESSED_NON_TCP packets are used, the 4-bit sequence number
   is inserted into the "Data Field" of that packet and the D bit is set
   as described in Section 6 of [3].  When a COMPRESSED_NON_TCP packet
   is received, the generation number is compared to the value stored in
   the context.  If they are not the same, the context is not up to date
   and MUST be refreshed by a FULL_HEADER packet.  If the generation
   does match, then the compressed IP and UDP header information, the
   4-bit sequence number, and the (potential) RTP header are all stored
   into the saved context.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?