Robust Header Compression                                   G. Pelletier
Internet-Draft                                               K. Sandlund
Expires: November 26, 2007
Intended status: Standards Track                                Ericsson
                                                            May 25,
Expires: April 4, 2008                                   October 2, 2007

RObust Header Compression Version 2 (RoHCv2): (ROHCv2): Profiles for RTP, UDP, IP,
                            ESP and UDP Lite
             draft-ietf-rohc-rfc3095bis-rohcv2-profiles-01
             draft-ietf-rohc-rfc3095bis-rohcv2-profiles-02

Status of this Memo

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on November 26, 2007. April 4, 2008.

Copyright Notice

   Copyright (C) The IETF Trust (2007).

Abstract

   This document specifies ROHC (Robust Header Compression) profiles
   that efficiently compress RTP/UDP/IP (Real-Time Transport Protocol,
   User Datagram Protocol, Internet Protocol), RTP/UDP-Lite/IP (User
   Datagram Protocol Lite), UDP/IP, UDP-Lite/IP, IP and ESP/IP
   (Encapsulating Security Payload) headers.

   This specification defines a second version of the profiles found in
   RFC 3095, RFC 3843 and RFC 4019; it supersedes their definition, but
   does not obsolete them.

   The RoHCv2 ROHCv2 profiles introduce a number of simplifications to the
   rules and algorithms that govern the behavior of the compression
   endpoints.  It also defines robustness mechanisms that may be used by
   a compressor implementation to increase the probability of
   decompression success when packets can be lost and/or reordered on
   the ROHC channel.  Finally, the RoHCv2 ROHCv2 profiles define its own
   specific set of packet formats, using the ROHC formal notation.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   5   4
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   5   4
   3.  Acronyms  . . . . . . . . . . . . . . . . . . . . . . . . . .   7   6
   4.  Background (Informative)  . . . . . . . . . . . . . . . . . .   7
     4.1.  Classification of header fields . . . . . . . . . . . . .   7
     4.2.  Improvements of ROHCv2 over RFC3095 profiles  . . . . . .   8
     4.3.  Operational Characteristics of RoHCv2 ROHCv2 Profiles  . . . . .   8  10
   5.  Overview of the RoHCv2 ROHCv2 Profiles (Informative) . . . . . . . .   9  10
     5.1.  General Concepts  . . . . . . . . . . . . . . . . . . . .   9
       5.1.1.  Control Fields and Context Updates  . . . . . . . . .   9
     5.2.  Compressor Concepts . . . . . . . . . . . . . . . . . . .  10
       5.2.1.  11
       5.1.1.  Optimistic Approach . . . . . . . . . . . . . . . . .  10
       5.2.2.  11
       5.1.2.  Tradeoff between robustness to losses and to
               reordering  . . . . . . . . . . . . . . . . . . . . .  10
       5.2.3.  11
       5.1.3.  Interactions with the Decompressor Context  . . . . .  12
     5.3.  13
     5.2.  Decompressor Concepts . . . . . . . . . . . . . . . . . .  13
       5.3.1.  14
       5.2.1.  Decompressor State Machine  . . . . . . . . . . . . .  13
       5.3.2.  14
       5.2.2.  Decompressor Context Management . . . . . . . . . . .  16
       5.3.3.  17
       5.2.3.  Feedback logic  . . . . . . . . . . . . . . . . . . .  17  19
   6.  RoHCv2  ROHCv2 Profiles (Normative) . . . . . . . . . . . . . . . . .  18  19
     6.1.  Channel Parameters, Segmentation and Reordering . . . . .  19
     6.2.  Profile Operation, per-context  . . . . . . . . . . . . .  18
     6.2.  19
     6.3.  Control Fields  . . . . . . . . . . . . . . . . . . . . .  19
       6.2.1.  20
       6.3.1.  Master Sequence Number (MSN)  . . . . . . . . . . . .  19
       6.2.2.  21
       6.3.2.  Reordering Ratio  . . . . . . . . . . . . . . . . . .  21
       6.3.3.  IP-ID behavior  . . . . . . . . . . . . . . . . . . .  20
     6.3.  Reconstruction and Verification  21
       6.3.4.  UDP-Lite Coverage Behavior  . . . . . . . . . . . . .  20
     6.4.  Reordering and Segmentation  22
       6.3.5.  Timestamp Stride  . . . . . . . . . . . . . . . .  20
       6.4.1.  Optimistic Approach . .  22
       6.3.6.  Time Stride . . . . . . . . . . . . . . .  21 . . . . . .  22
       6.3.7.  CRC-3 for Control Fields  . . . . . . . . . . . . . .  22
     6.4.  Reconstruction and Verification . . . . . . . . . . . . .  23
     6.5.  Compressed Header Chains  . . . . . . . . . . . . . . . .  21  23
     6.6.  Packet Formats and Encoding Methods . . . . . . . . . . .  22  25
       6.6.1.  baseheader_extension_headers  . . . . . . . . . . . .  22  25
       6.6.2.  baseheader_outer_headers  . . . . . . . . . . . . . .  23  25
       6.6.3.  inferred_udp_length . . . . . . . . . . . . . . . . .  23  25
       6.6.4.  inferred_ip_v4_header_checksum  . . . . . . . . . . .  23  26
       6.6.5.  inferred_mine_header_checksum . . . . . . . . . . . .  24  26
       6.6.6.  inferred_ip_v4_length . . . . . . . . . . . . . . . .  24  27
       6.6.7.  inferred_ip_v6_length . . . . . . . . . . . . . . . .  25  27
       6.6.8.  Scaled RTP Timestamp Encoding . . . . . . . . . . . .  25  28
       6.6.9.  Timer-Based RTP Timestamp Encoding  timer_based_lsb . . . . . . . . .  26 . . . . . . . . . .  29
       6.6.10. inferred_scaled_field . . . . . . . . . . . . . . . .  26  30
       6.6.11. control_crc3_encoding . . . . . . . . . . . . . . . .  27  31
       6.6.12. inferred_sequential_ip_id . . . . . . . . . . . . . .  28  32
       6.6.13. list_csrc(cc_value) . . . . . . . . . . . . . . . . .  28  32
     6.7.  Encoding Methods With External Parameters . . . . . . . .  32  36
     6.8.  Packet Formats  . . . . . . . . . . . . . . . . . . . . .  36  39
       6.8.1.  Initialization and Refresh Packet (IR)  . . . . . . .  36  39
       6.8.2.  IR  Compressed Packet Payload Discard (IR-PD)  . Formats (CO)  . . . . . . . .  37
       6.8.3.  Compressed Packet Formats (CO) . . . . . . . . . . .  38  40
     6.9.  Feedback Formats and Options  . . . . . . . . . . . . . . 100  99
       6.9.1.  Feedback Formats  . . . . . . . . . . . . . . . . . . 100  99
       6.9.2.  Feedback Options  . . . . . . . . . . . . . . . . . . 101
   7.  Security Considerations . . . . . . . . . . . . . . . . . . . 104 103
   8.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . 104 103
   9.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . 106 104
   10. References  . . . . . . . . . . . . . . . . . . . . . . . . . 106 105
     10.1. Normative References  . . . . . . . . . . . . . . . . . . 106 105
     10.2. Informative References  . . . . . . . . . . . . . . . . . 107 106
   Appendix A.    Detailed classification of header fields . . . . 107
   Appendix A.1.    General classification . . . . . . . . . . . . . 108 106
   Appendix A.1.1. A.1.  IPv4 header fields Header Fields . . . . . . . . . . . . . . . . 108 107
   Appendix A.1.2. A.2.  IPv6 header fields Header Fields . . . . . . . . . . . . . . . 110 . 109
   Appendix A.1.3. A.3.  UDP header fields Header Fields  . . . . . . . . . . . . . . . . 111
   Appendix A.1.4. A.4.  UDP-Lite header fields Header Fields . . . . . . . . . . . . . . 111
   Appendix A.1.5. A.5.  RTP header fields Header Fields  . . . . . . . . . . . . . . . . 112
   Appendix A.1.6. A.6.  ESP header fields  . Header Fields  . . . . . . . . . . . . . . 113
   Appendix A.2.    Analysis of change patterns of header fields . . 113 114
   Appendix A.2.1.  IPv4 Identification  . . . . . . . . . . A.7.  IPv6 Extension Header Fields . . . . 116
   Appendix A.2.2.  IP Traffic Class / Type-Of-Service . . . . . . . 117 114
   Appendix A.2.3.  IP Hop-limit / Time-To-Live  . . . . . . . . A.8.  GRE Header Fields  . . 117
   Appendix A.2.4.  IPv4 Don't Fragment . . . . . . . . . . . . . . 117 115
   Appendix A.2.5.  UDP Checksum . . A.9.  MINE Header Fields . . . . . . . . . . . . . . . . 117 116
   Appendix A.2.6.  UDP-Lite Checksum Coverage . . . . . . . . . A.10. AH Header Fields . . 117
   Appendix A.2.7.  UDP-Lite Checksum . . . . . . . . . . . . . . . 117
   Appendix A.2.8.  RTP CSRC Counter . . . . . . . . . B.    Compressor Implementation Guidelines . . . . . . . 117
   Appendix A.2.9.  RTP Marker . . . . . . . . . . . . . . . . . . . 118
   Appendix A.2.10. RTP Padding  . . . B.1.  Reference Management . . . . . . . . . . . . . . . 118
   Appendix A.2.11. RTP Extension  . . . . . . . . . B.2.  Window-based LSB Encoding (W-LSB)  . . . . . . . . 118
   Appendix A.2.12. RTP Payload Type . . . . . . . . . . . . B.3.  W-LSB Encoding and Timer-based Compression . . . . 118
   Appendix A.2.13. RTP Sequence Number  . . . . . . . . . .
   Authors' Addresses  . . . . 118
   Appendix A.2.14. RTP Timestamp . . . . . . . . . . . . . . . . . 118
   Appendix A.2.15. RTP Contributing Sources (CSRC)  . . . . . . . . 119
   Appendix A.2.16. ESP Sequence Number  . . . . . . . . . . . . . . 119
   Appendix B.      Differences between RoHCv2 and RFC3095
                    profiles . . . . . . . . . . . . . . . . . . . . 119
   Authors' Addresses  . . . . . . . . . . . . . . 119
   Intellectual Property and Copyright Statements  . . . . . . . . . 120
   Intellectual Property and Copyright Statements  . . . . . . . . . 121

1.  Introduction

   The ROHC WG has developed a header compression framework on top of
   which various profiles can be defined for different protocol sets or
   compression requirements.  The ROHC framework was first documented in
   [RFC3095], together with profiles for compression of RTP/UDP/IP
   (Real-Time Transport Protocol, User Datagram Protocol, Internet
   Protocol), UDP/IP, IP and ESP/IP (Encapsulating Security Payload)
   headers.  Additional profiles for compression of IP headers [RFC3843]
   and UDP-Lite (User Datagram Protocol Lite) headers [RFC4019] were
   later specified to complete the initial set of ROHC profiles.

   This document defines an updated version for each of the above
   mentioned profiles, and its definition is based on the specification
   of the RoHC ROHC framework as found in
   [I-D.ietf-rohc-rfc3095bis-framework]. [RFC4995].

   Specifically, this document defines header compression schemes for:

   o RTP/UDP/IP      : profile 0x0101
   o UDP/IP          : profile 0x0102
   o ESP/IP          : profile 0x0103
   o IP              : profile 0x0104
   o RTP/UDP-Lite/IP : profile 0x0107
   o UDP-Lite/IP     : profile 0x0108

   ROHCv2 compresses the following type of extension headers:

   o  AH [RFC4302]
   o  GRE [RFC2784][RFC2890]
   o  MINE [RFC2004]
   o  NULL-encrupted  NULL-encrypted ESP [RFC4303]
   o  IPv6 Destination Options header[RFC2460]
   o  IPv6 Hop-by-hop Options header[RFC2460]
   o  IPv6 Routing header [RFC2460].

2.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [RFC2119].

   This document is consistent with the terminology found in the ROHC
   framework [I-D.ietf-rohc-rfc3095bis-framework] [RFC4995] and in the formal notation for ROHC [I-D.ietf-rohc-formal-notation]. [RFC4997].
   In addition, this document uses or defines the following terms:

   Acknowledgment Number
      The Acknowledgment Number identifies what packet is being
      acknowledged in the RoHCv2 feedback element.  The value of this
      field normally corresponds to the Master Sequence Number (MSN) of
      the header that was last successfully decompressed, for the
      compression context (CID) for which the feedback information
      applies.

   Chaining of Items

      A chain of items groups fields based on similar characteristics.
      ROHCv2 defines chain items for static, dynamic and irregular
      fields.  Chaining is done achieved by appending to the chain an item
      for e.g. each header to the
      chain in their order of appearance in the
      uncompressed packet.  Chaining is useful to construct compressed
      headers from an arbitrary number of any of the protocol headers
      for which a ROHCv2 profile defines a compressed format.

   CRC-3 Control Validation

      The CRC-3 control validation refers to the validation of the
      control fields when receiving a CO header that contains a 3-bit
      CRC calculated over the control fields that it carries and over
      specific control fields in the context.  In the formal definition
      of the header formats, the 3-bit CRC is labelled "control_crc3"
      and uses the "control_crc3_encoding" (See also Section 6.6.11).

   Delta

      The delta refers to the difference in terms of the absolute value of a
      field between two consecutive packets and being processed by the same
      compression endpoint.

   Reordering Depth

      The number of packets by which a packet made is received late in within
      its sequence. sequence due to reordering between the compressor and the
      decompressor, i.e. reordering between packets associated with the
      same context (CID).  See definition of sequentially late packet
      below.

   ROHCv2 packet types Packet Types

      ROHCv2 profiles use two different packet types: the Initialization
      and Refresh (IR) packet type, and the Compressed (CO) packet type (CO). type.

   Sequentially early packet Early Packet
      A packet that reaches the decompressor before one or several
      packets that were delayed over the channel, whereas all of the
      said packets belong to the same header-compressed flow and are
      associated to the same compression context (CID).  At the time of
      the arrival of a sequentially early packet, the packet(s) delayed
      on the link cannot be differentiated from lost packet(s).

   Sequentially late packet Late Packet

      A packet is late within its sequence if it reaches the
      decompressor after one or several other packets belonging to the
      same CID have been received, although the sequentially late packet
      was sent from the compressor before the other packet(s).

   Timestamp stride (ts_stride)
      The timestamp stride (TS_STRIDE) is  How the expected increase in
      decompressor detects a sequentially late packet is outside the
      timestamp value between two RTP
      scope of this specification, but it can for example use the MSN to
      this purpose.

   Timestamp Stride (ts_stride)

      The timestamp stride (ts_stride) is the expected increase in the
      timestamp value between two RTP packets with consecutive sequence
      numbers.  For example, for a media encoding with a sample rate of
      8 kHz producing one frame every 20ms, the RTP timestamp will
      typically increase by n * 160 (= 8000 * 0.02), for some integer n.

   Time Stride (time_stride)

      The time stride (time_stride) is the time interval equivalent to
      one ts_stride, e.g., 20 ms in the example for the RTP timestamp
      increment above.

3.  Acronyms

   This section lists most acronyms used for reference, in addition to
   those defined in [I-D.ietf-rohc-rfc3095bis-framework]. [RFC4995].

   AH       Authentication Header.
   ESP      Encapsulating Security Payload.
   GRE      Generic Routing Encapsulation. RFC 2784, RFC 2890.
   IC       Initial Context state (decompressor)
   FC       Full Context state (decompressor) (decompressor).
   IP       Internet Protocol.
   LSB      Least Significant Bits.
   MINE     Minimal Encapsulation in IP IP.
   MSB      Most Significant Bits.
   MSN      Master Sequence Number.
   NC       No Context state (decompressor).
   OA       Optimistic Approach.
   RC       Repair Context state (decompressor).
   ROHC     Header compression framework (RFC4995).
   ROHCv2   Set of header compression profiles defined in this document document.
   RTP      Real-time Transport Protocol.
   SSRC     Synchronization source. Field in RTP header.
   CSRC     Contributing source. Optional list of CSRCs in RTP header.
   TC       Traffic Class. Octet in IPv6 header. See also TOS.
   TOS      Type Of Service. Octet in IPv4 header. See also TC.
   TS       RTP Timestamp.
   UDP      User Datagram Protocol.
   UDP-Lite User Datagram Protocol Lite.

4.  Background (Informative)

   This section provides background information on the compression
   profiles defined in this document.  The fundamentals of general
   header compression and of the ROHC framework may be found in section
   3 and 4 of [I-D.ietf-rohc-rfc3095bis-framework], [RFC4995], respectively.  The fundamentals of the formal
   notation for ROHC are defined in
   [I-D.ietf-rohc-formal-notation]. [RFC4997].  [RFC4224] describes the
   impacts of out-of-order delivery on profiles based on [RFC3095].

4.1.  Classification of header fields

   Section 3.1 of [I-D.ietf-rohc-rfc3095bis-framework] [RFC4995] explains that header compression is possible
   due to the fact that there is much redundancy between field values
   within the headers of a packet, but especially between the headers of
   consecutive packets.

   Appendix A lists and classifies in detail all the header fields
   relevant to this document.  The appendix concludes with
   recommendations on how the various fields should be handled by header
   compression algorithms.

   The main conclusion is that most of the header fields can easily be
   compressed away since they never or seldom change.  A small number of
   fields however need more sophisticated mechanisms.

   These fields are:

   - IPv4 Identification        (16 bits) - IP-ID
   - ESP Sequence Number        (32 bits) - ESP SN
   - UDP Checksum               (16 bits) - Checksum
   - UDP-Lite Checksum          (16 bits) - Checksum
   - UDP-Lite Checksum Coverage (16 bits) - CCov
   - RTP Marker                 ( 1 bit ) - M-bit
   - RTP Sequence Number        (16 bits) - RTP SN
   - RTP Timestamp              (32 bits) - TS

   In particular, for RTP, the analysis in Appendix A reveals that the
   values of the RTP Timestamp (TS) field usually have a strong
   correlation to the RTP Sequence Number (SN), which increments by one
   for each packet emitted by an RTP source.  The RTP M-bit is expected
   to have the same value most of the time, but it needs to be
   communicated explicitly on occasion.

   For UDP, the Checksum field cannot be inferred or recalculated at the
   receiving end without violating its end-to-end properties, and is
   thus sent as-is when enabled (mandatory with IPv6).  The same applies
   to the UDP-Lite Checksum (mandatory with both IPv4 and IPv6), while
   the UDP-Lite Checksum Coverage may in some cases be compressible.

   For IPv4, a similar correlation as the one of the RTP TS to the RTP
   SN is often observed between the Identifier field (IP-ID) and the
   master sequence number used for compression (e.g. the RTP SN when
   compressing RTP headers).

4.2.  Operational Characteristics  Improvements of RoHCv2 Profiles

   Robust header compression ROHCv2 over RFC3095 profiles

   The ROHCv2 profiles can be achieve compression efficiency and robustness
   that are both at least equivalent to RFC3095 profiles, when used over many type of link
   technologies.  Section 4.4 of [I-D.ietf-rohc-rfc3095bis-framework]
   lists
   under the operational characteristics same operating conditions.  In particular, the size and bit
   layout of the ROHC channel.  The
   RoHCv2 profiles address smallest compressed header (i.e.  PT-0 format U/O-0 in
   RFC3095, and pt_0_crc3 in ROHCv2) are identical.

   There are a wide range number of applications, differences and improvements between profiles
   defined in this document and their earlier version defined in RFC3095
   [RFC3095].  This section summarizes provides an overview of some of the operational characteristics that are
   specific most
   significant improvements:

   Tolerance to these profiles.

   Packet length

      ROHCv2 profiles assume reordering
      Profiles defined in RFC3095 require that the lower layer indicates the length
      of a compressed packet.  ROHCv2 compressed headers do not contain
      length information for the payload.

   Out-of-order channel between
      compressor and decompressor provide in-order delivery between
      compression endpoints

      The definition endpoints.  ROHCv2 profiles, however, can handle
      robustly and efficiently a limited amount of reordering before and
      after the RoHCv2 profiles places no strict requirement
      on the delivery sequence between compression point as part of the compression endpoints, i.e.
      packets may be received algorithm
      itself.

   Operational logic

      Profiles in a RFC3095 define multiple operational modes, each with
      different order than the compressor
      sent them updating logic and still have a fair probability to be successfully
      decompressed.

      However, frequent out-of-order delivery and/or significant
      reordering depth will negatively impact the compression
      efficiency.  More specifically, if the compressor can compressed header formats.  ROHCv2
      profiles operate
      using in unidirectional operation until feedback is
      first received for a proper estimate of context (CID), at which point bidirectional
      is used; the reordering characteristics formats are independent of the
      path between the compression endpoints, larger what operational logic is
      used.

   IP extension header

      Profiles in RFC3095 compressed IP Extension headers can be sent
      more often to increase using list
      compression.  ROHCv2 profiles instead treat extension headers in
      the robustness against decompression
      failures due to out-of-order delivery.  Otherwise, same manner as other protocol headers, i.e. using the chaining
      mechanism; it thus assumes that extension header are not added or
      removed during the lifetime of a context (CID), otherwise
      compression
      efficiency will has to be impaired from an increase restarted for this flow.

   IP encapsulation

      Profiles in the frequency of
      decompression failures and recovery attempts.

5.  Overview RFC3095 can compress at most two levels of the RoHCv2 Profiles (Informative)

   This section provides IP headers.
      ROHCv2 profiles can compress an overview arbitrary number of important IP headers.

   List compression

      ROHCv2 profiles does not support reference-based list compression.

   Robustness and useful concepts of repairs

      ROHCv2 profiles.  These concepts may be used as guidelines for
   implementations but they are profiles do not part of the normative definition of define a format for the profiles, as these concepts relates IR-DYN packet;
      instead, each profile defines a compressed header that can be used
      to perform a more robust context repair using a 7-bit CRC
      verification.  This also implies that only the compression efficiency
   of IR header can
      change the protocol without impacting association between a CID and the interoperability
   characteristics profile it uses.

   Feedback
      ROHCv2 profiles define a CRC in the format of an implementation.

5.1.  General Concepts

5.1.1.  Control Fields and Context Updates

   Control fields have the same attributes FEEDBACK-2, and properties as
   uncompressed fields [I-D.ietf-rohc-formal-notation].  These fields
      different feedback options are used for available.

4.3.  Operational Characteristics of ROHCv2 Profiles

   Robust header compression and decompression can be used over many type of some link
   technologies.  Section 4.4 of [RFC4995] lists the
   uncompressed header fields.  Updating operational
   characteristics of the value ROHC channel.  The ROHCv2 profiles address a
   wide range of one or more
   control field(s) is thus no less important than updating context
   values for header fields.  Control fields applications, and this section summarizes some of the
   operational characteristics that are defined in
   [I-D.ietf-rohc-formal-notation]. specific to these profiles.

   Packet types length

      ROHCv2 profiles assume that initialize or update the value lower layer indicates the length
      of one or more
   control field(s) thus include an additional 3-bit CRC, as defined by a compressed packet.  ROHCv2 compressed headers do not contain
      length information for the packet formats in Section 6.8. payload.

   Out-of-order delivery between compression endpoints

      The CRC is calculated using the
   UVALUE definition of the control field(s) that it covers.

   This CRC validates all ROHCv2 profiles places no strict requirement
      on the control fields that are updated.  Failure
   to verify this CRC should be interpreted by delivery sequence between the decompressor as compression endpoints, i.e.
      packets may be received in a
   decompression failure, different order than the compressor
      sent them and still have a fair probability to be successfully
      decompressed.

      However, frequent out-of-order delivery and/or significant
      reordering depth will negatively impact the compression
      efficiency.  More specifically, if the compressor can operate
      using a proper estimate of the reordering characteristics of the
      path between the compression endpoints, larger headers can be sent
      more often to increase the robustness against decompression
      failures due to out-of-order delivery.  Otherwise, the compression
      efficiency will be impaired from an increase in the algorithm it implements frequency of
      decompression failures and recovery attempts.

5.  Overview of the ROHCv2 Profiles (Informative)

   This section provides an overview of concepts that are important and
   useful to assess the
   validity ROHCv2 profiles.  These concepts may be used as
   guidelines for implementations but they are not part of its context.

5.2. the normative
   definition of the profiles, as these concepts relates to the
   compression efficiency of the protocol without impacting the
   interoperability characteristics of an implementation.

5.1.  Compressor Concepts

   Header compression can be conceptually characterized as the
   interaction of a compressor with a decompressor state machine, one
   per context.  The responsability responsibility of the compressor is to convey the
   information needed to successfully decompress a packet, based on a
   certain confidence regarding the state of the decompressor context.

   This confidence is obtained from the frequency and the type of
   information the compressor sends when updating the decompressor
   context, from the optimistic approach (Section 5.2.1) 5.1.1) and optionally
   from feedback messages received from the decompressor.

5.2.1.

5.1.1.  Optimistic Approach

   A compressor always uses the optimistic approach when it performs
   context updates.  The compressor normally repeats the same type of
   update until it is fairly confident that the decompressor has
   successfully received the information.  If the decompressor
   successfully receives any of the headers containing this update,
   state will be available for the decompressor to process smaller
   compressed headers.

   If field X in the uncompressed header changes value, the compressor
   uses a packet type that contains an encoding of field X until it has
   gained confidence that the decompressor has received at least one
   packet containing the new value for X. The compressor normally
   selects a compressed format with the smallest header that can convey
   the changes needed to achieve confidence.

   The number N of repetitions for the optimistic approach that is needed to obtain this confidence is
   normally related to the packet loss and out-of-order delivery
   characteristics of the link where header compression is used; it is
   thus not defined in this document and is left open to
   implementations.

5.2.2.

5.1.2.  Tradeoff between robustness to losses and to reordering

   The ability of a header compression algorithm to handle sequentially
   late packets is mainly limited by two factors: the interpretation
   interval offset of the sliding window used for LSB encoded fields
   [I-D.ietf-rohc-formal-notation],
   [RFC4997], and the optimistic approach (See Section 5.2.1 5.1.1) for seldom
   changing fields.

   LSB encoded fields:

      The interpretation interval offset specifies an upper limit for
      the maximum reordering depth, by which is it possible for the
      decompressor to recover the original value of a dynamically
      changing (i.e. sequentially incrementing) field that is encoded
      using W-LSB.  Its value is bound to the number of LSB compressed
      bits in the compressed header format, and grows with the number of
      bits transmitted.  However, the offset and the LSB encoding only
      provide robustness for the field that it compresses, and
      (implicitly) for other sequentially changing fields that are
      derived from that field.
      This is shown in the figure below:

      <--- interpretation interval (size is 2^k) ---->
      |------------------+---------------------------|
   v_ref-p             v_ref              v_ref + (2^k-1) - p
    Lower                                          Upper
    Bound                                          Bound
      <--- reordering --> <--------- losses --------->

         where delta(SN) = p is the maximum negative delta, corresponding to the
         maximum reordering depth for which the lsb encoding can recover
         the original value of the field;

         where delta(SN) = (2^k-1) - p is the maximum positive delta, corresponding
         to the maximum number of consecutive losses for which the lsb
         encoding can recover the original value of the
      field; field

         where v_ref is the reference value, as defined in the lsb
         encoding method in [I-D.ietf-rohc-formal-notation].

   The optimistic approach (Section 5.2.1) provides the upper limit for
   the maximum reordering depth for seldom changing fields. [RFC4997].

      There is thus a tradeoff between the robustness against reordering
      and the robustness against packet losses, with respect to the
      number of MSN bits needed and the distribution of the
      interpretation interval between negative and positive deltas in
      the MSN.

   Seldom changing fields

      The optimistic approach (Section 5.1.1) provides the upper limit
      for the maximum reordering depth for seldom changing fields.

   There is also thus a tradeoff between compression efficiency and
   robustness.  When only information on the MSN needs to be conveyed to
   the decompressor, the tradeoff relates to the number of compressed
   MSN bits in the compressed header format.  Otherwise, the tradeoff
   relates to the implementation of the optimistic approach.

5.2.3.  Interactions with the Decompressor Context

   The

   In particular, compressor normally starts compression with the initial
   assumption that the decompressor has no useful information implementations should adjust their
   optimistic approach strategy to process
   the new flow, and sends Initialization match both packet loss and Refresh (IR) reordering
   characteristics.  For example, the number of repetitions for each
   update of a non-LSB encoded field can be increased.  The compressor
   can ensure that each update is repeated until it is reasonably
   confident that at least one packet containing the change has reached
   the decompressor before the first packet sent after this sequence.

5.1.3.  Interactions with the Decompressor Context

   The compressor normally starts compression with the initial
   assumption that the decompressor has no useful information to process
   the new flow, and sends Initialization and Refresh (IR) packets.

   Initially, when sending the first IR packet for a compressed flow,
   the compressor does not expect to receive feedback for that flow,
   until such feedback is first received.  At this point, the compressor
   may then assume that the decompressor will continue to send feedback
   in order to repair its context when necessary.  The former is
   referred to as unidirectional operation, while the latter is called
   bidirectional operation.

   The compressor can then adjust the compression level (i.e. what
   header format it selects) based on its confidence that the
   decompressor has the necessary information to successfully process
   the compressed headers that it selects.  In other words, the
   responsibility of the compressor is to ensure that the decompressor
   operates with state information that is sufficient to allow
   decompression of the most efficient compressed header(s), and to
   allow the decompressor to successfully recover that state information
   as soon as possible otherwise.

   The compressor thus has the entire responsability responsibility to ensure that the
   decompressor has the proper information to decompress the type of
   compressed header that it sends.  In other words, the choice of
   compressed header depends on the following factors:

   o  the outcome of the encoding method applied to each field;
   o  the optimistic approach, with respect to the characteristics of
      the channel;
   o  the type of operation (unidirectional or bidirectional), and if in
      birectional operation, feedback received from the decompressor
      (ACKs, NACKs, Static-NACK, STATIC-NACK, and options).

   Encoding methods normally use previous value(s) from a history of
   packets whose headers it has previously compressed.  The optimistic
   approach is meant to ensure that at least one compressed header
   containing the information to update the state for a field is
   received.  Finally, feedback indicates what actions the decompressor
   has taken with respect to its assumptions regarding the validity of
   its context (Section 5.3.2); 5.2.2); it indicates what type of compressed
   header the decompressor can or cannot decompress.

   The decompressor has the means to detect decompression failures for
   any type of compressed (CO) header, using the CRC verification.
   Depending on the frequency and/or on the type of the failure, it
   might send a negative acknowledgement (NACK) or an explicit request
   for a complete context update (Static-NACK). (STATIC-NACK).  However, the
   decompressor does not have the means to identify the cause of the
   failure, and in particular decompression of what field(s) is
   responsible for the failure.  The compressor is thus always
   reponsible
   responsible to figure out determine what is the most suitable response to a
   negative acknowledgement, using the confidence it has in the state of
   the decompressor context, when selecting the type of compressed
   header it will use when compressing a header.

5.3.

5.2.  Decompressor Concepts

   The decompressor normally always uses the last received and successfully
   validated (IR packets) or verified (CO packets) header as the
   reference for future decompression.  If the received packet is older
   than the current reference packet based on the MSN in the compressed
   header, the decompressor may refrain from using this packet as the
   new reference packet, even if the correctness of its header was
   successfully verified.

   The decompressor's responsibility decompressor is thus responsible to minimally and
   consistently always verify the outcome of the
   decompression attempt, to update its context when successful and
   finally to request context repairs by making coherent usage of
   feedback, once it starts has started using it. feedback.

   Specifically, the outcome of every decompression attempt is verified
   using the CRC present in the compressed header; the decompressor
   updates the context information when this outcome is successfully
   verified; finally if the decompressor uses feedback once for a
   compressed flow then it will continue to do so for as long as the
   corresponding context is associated with the same profile.

5.3.1.

5.2.1.  Decompressor State Machine

   The decompressor operation may be represented as a state machine
   defining three states: No Context (NC), Initial Repair Context (IC) (RC) and Full
   Context (FC).

   The decompressor starts with no without a valid context, the NC state.
   Successful CRC-8 validation of  Upon
   receiving an IR packet moves packet, the decompressor to validates the IC state, where it stays until it integrity of
   its header using the CRC-8 validation.  If the IR header is
   successfully verifies a
   decompression attempt for a compressed validated, the decompressor updates the context and uses
   this header with a 7-bit CRC. as the reference header, and moves to the FC state.  The
   decompressor state machine normally does not leave the FC state once
   it has entered this state; only repeated decompression failures will
   force the decompressor to transit downwards to a lower state.  When
   context damage is detected, the decompressor moves to the repair
   context (RC) state, where it stays until it successfully verifies a
   decompression attempt for a compressed header with a 7-bit CRC or for
   an IR header.  When static context damage is detected, the
   decompressor moves back to the NC state.

   Below is the state machine for the decompressor.  Details of the
   transitions between states and decompression logic are given in the
   sub-sections following the figure.

   CRC-8(IR) or
                                                          CRC-8(IR) Validation
    +----->----->----->----->----->----->----->----->----->----->----+
    |                                                  CRC-8(IR)     |
    |  !CRC-8(IR) or      CRC-7(CO) or
    CRC-8(IR)  CRC-8(IR)     CRC-8(IR)                 or CRC-7(CO)  |
    |  PT not allowed     CRC-8(IR)                    or CRC-3(CO)
    Failure    Validation    Validation     Verification  Verification
    +--->---+  +-->---->--+  +-->----->--+  +-->---->--+  +-->---->--+  |
    |  +--->---+         +--->----->----->----->---+  +--->---->---+ |
    |  |       |         |                         |  |            | |       v
    |          v  |       v         |                         v  |            v v
   +-----------------+  +----------------------+  +-------------------+  +--------------------+
   | No Context (NC) |  | Initial Repair Context (IC) (RC)  |  | Full Context (FC)  |
   +-----------------+  +----------------------+  +-------------------+  +--------------------+
     ^                 | ^ CRC-7(CO)      | ^                 |
       | Static Context  | | Failure ^ !CRC-7(CO) or  | | ^ Context Damage  | |
     | | Damage Detected | | PT not allowed | | Detected        | |
     | +--<-----<-----<--+ +----<------<----+ +--<-----<-----<--+ |
     |                                                            |
     |            Static Context Damage Detected                  |
     +--<-----<-----<-----<-----<-----<-----<-----<-----<---------+
   where:
      CRC-8(IR) validation:
      CRC-8(IR): successful CRC-8 validation for the IR header.
      !CRC-8(IR): Unsuccessful CRC-8 validation for the IR header.
      CRC-7(CO) and/or CRC-3(CO) verification: CRC-3(CO): successful CRC verification for the
      decompression of a CO header, based on the number of CRC bits
      carried in the CO header.
      CRC-7(CO) failure:
      !CRC-7(CO): failure to CRC verify the decompression of a CO header
      carrying a 7-bit CRC.

      PT not allowed: the decompressor has received a packet type (PT)
      for which the decopressor's decompressor's current context does not provide
      enough valid state information for that packet to be decompressed.
      Static Context Damaged Detected: see definition in Section 5.3.2. 5.2.2.
      Context Damage Detected: see definition in Section 5.3.2.

5.3.1.1. 5.2.2.

5.2.1.1.  No Context (NC) State

   Initially, while working in the No Context (NC) state, the
   decompressor has not yet successfully validated an IR packet. header.

   Attempting decompression:

      In the NC state, only packets carrying sufficient information on
      the static fields (i.e.  IR packets) can be decompressed.

   Upward transition:

      Upon receiving an IR packet, the decompressor validates the
      integrity of its header using the CRC-8 validation.  If the IR
      packet is successfully validated, the

      The decompressor updates can move to the
      context and use this packet as Full Context (FC) state when the reference packet.  Once
      CRC validation of an 8-bit CRC in an IR
      packet has initialized the context, the decompressor can transit
      to the IC state. header is successful.

   Feedback logic:

      In the No Context state, the decompressor should send a STATIC-
      NACK if a packet of a type other than IR is received, or if an IR
      packet
      header has failed the CRC-8 validation, subject to the feedback
      rate limitation as described in Section 5.3.3.

5.3.1.2.  Initial 5.2.3.

5.2.1.2.  Repair Context (IC) (RC) State

   In the IC Repair Context (RC) state, the decompressor has successfully validated an IR
   packet.
   decompressed packets for this context, but does not have confidence
   that the entire context is valid.

   Attempting decompression:

      In the Initial Context RC state, only packets carrying sufficient
      information on the dynamic fields headers covered by an 8-bit CRC (i.e.  IR)
      or CO packets headers carrying a 7-bit CRC can be decompressed.

   Upward transition:

      The decompressor can move to the Full Context (FC) state when the
      CRC verification succeeds for a CO header carrying a 7-bit CRC. CRC or
      validation of an 8-bit CRC in an IR header.

   Downward transition:

      The decompressor moves back to the NC state if it assumes static
      context damage.

   Feedback logic:

      In the IC RC state, the decompressor should send a STATIC-NACK when
      CRC-8 validation of an IR fails, or when a CO header carrying a
      7-bit CRC fails and if static context damage is assumed, subject to
      the feedback rate limitation as described in Section 5.3.3. 5.2.3.  If
      any other packet type is received, the decompressor should treat
      it as a CRC verification failure when deciding if a NACK is to be
      sent.

5.3.1.3.

5.2.1.3.  Full Context (FC) State

   In the FC Full Context (FC) state, the decompressor has successfully verified a CO
   header with a 7-bit CRC. assumes that its
   entire context is valid.

   Attempting decompression:

      In the Full Context FC state, decompression can be attempted regardless of the
      type of packet received.

   Downward transition:

      The decompressor moves back to the IC RC state if it assumes context
      damage, and back to
      damage.  If the NC state if it decompressor assumes static context
      damage. damage, it
      moves directly to the NC state.

   Feedback logic:

      In the Full Context FC state, the decompressor should send a NACK when CRC-8
      validation or CRC verification of any packet header type fails and if
      context damage is assumed, or STATIC-NACK if static context damage
      is assumed, subject to the feedback rate limitation as described
      in Section 5.3.3.

5.3.2. 5.2.3.

5.2.2.  Decompressor Context Management

   All header formats carry a CRC and are context updating.  A packet
   for which the CRC succeeds updates the reference values of all header
   fields, either explicitly (from the information about a field carried
   within the compressed header) or implicitly (fields that are inferred
   from other fields).

   The decompressor may assume that some or the entire context is
   invalid, following one or more failures when it fails to validate or to verify a
   header one or more headers
   using the CRC.  Because the decompressor cannot know the exact
   reason(s) for a CRC failure or what field caused it, the validity of
   the context hence does not refer to what exact specific part(s) of the
   context entry is deemed valid or not.

   Validity of the context rather relates to the detection of a problem
   with the context.  The decompressor first assume that the type of
   information that most likely caused the failure(s) is the state that
   normally changes for each packet, i.e. context damage of the dynamic
   part of the context.  Upon repeated decompression failures and
   unsuccessful repairs, the decompressor then assume assumes that the entire
   context, including the static part, needs to be repaired, i.e. static
   context damage.

   Context Damage Detection

      The assumption of context damage means that  Failure to validate the decompressor 3-bit CRC that protects
   control fields should be treated as a decompression failure when the
   decompressor asserts the validity of its context.

   Context Damage Detection

      The assumption of context damage means that the decompressor will
      not attemp attempt decompression of a CO headers header that carries only a 3-bit
      CRC, and will only attempt decompression of IR headers, or CO
      headers protected by a CRC-7.

   Static Context Damage Detection

      The assumption of static context damage means that the
      decompressor refrains from attempting decompression of any type of
      header other than the IR header, as it cannot know what part of
      its context can be relied upon after first assuming context damage
      and failed to repair its context, and as a result of too many
      failures. header.

   How these assumptions are made, i.e. how context damage is detected,
   is open to implementations.  It can be based on the residual error
   rate, where a low error rate makes the decompressor assume damage
   more often than on a high rate link.

   The decompressor implements these assumptions by selecting the type
   of compressed header for which it may will attempt decompression.  In
   other words, validity of the context refers to the ability of a
   decompressor to attempt or not decompression of specific packet
   types.

   When RoHCv2 ROHCv2 profiles are used over a channel that cannot guarantee
   in-order delivery, the decompressor may refrain to update from updating its
   context with the content of a sequentially late packet that is
   successfully decompressed.  This is to avoid updating the context
   with information that is older than what the decompressor already has
   in its context.
   How the decompressor detects a sequentially late packet is outside
   the scope of this specification, but it can for example use the MSN
   to this purpose.

5.3.3.

5.2.3.  Feedback logic

   RoHCv2

   ROHCv2 profiles may be used in environments with or without feedback
   capabilities from decompressor to compressor.  RoHCv2  ROHCv2 however assumes
   that if a ROHC feedback channel is available and if this channel is
   used at least once by the decompressor for a specific context, this
   channel will be used during the entire compression operation for that
   context (i.e. bidirectional operation).

   The RoHC ROHC framework defines 3 types of feedback messages: ACKs, NACKs
   and STATIC-NACKs.  The semantics of each message if defined in
   section 5.2.3.1. of [I-D.ietf-rohc-rfc3095bis-framework] [RFC4995].  What feedback to send is coupled to
   the context management of the decompressor, i.e. to the
   implementation of the context damage detection algorithms as
   described in Section 5.3.2. 5.2.2.

   The decompressor should send a NACK when it assumes context damage,
   and it should send a STATIC-NACK when it assumes static context
   damage.  The decompressor is not strictly expected to send ACK
   feedback upon successful decompression, other than for the purpose of
   improving compression efficiency.

   When RoHCv2 ROHCv2 profiles are used over a channel that cannot guarantee
   in-order delivery, the decompressor may refrain to send ACK feedback
   for a sequentially late packet that is successfully decompressed.
   How the decompressor detects a sequentially late packet is outside
   the scope of this specification, but it can for example use the MSN
   to this purpose.

   The decompressor should limit the rate at which it sends feedback,
   for both ACKs and STATIC-NACK/NACKs, and should avoid sending
   unnecessary duplicates of the same type of feedback message that may
   be associated to the same event.

6.  RoHCv2  ROHCv2 Profiles (Normative)

6.1.  Channel Parameters, Segmentation and Reordering

   The compressor MUST NOT use ROHC segmentation (see [RFC4995] section
   5.2.5), i.e.  MRRU MUST be set to 0), if the configuration of the
   ROHC channel contains at least one ROHCv2 profile in the list of
   supported profiles (i.e. the PROFILES parameter) and if the channel
   cannot guarantee in-order delivery of packets between compression
   endpoints.

6.2.  Profile Operation, per-context

   RoHCv2

   ROHCv2 profiles operates operate differently, per context, depending on how
   the decompressor makes use of the feedback channel, if any.  Once the
   decompressor uses the feedback channel for a context, it establishes
   the feedback channel for that CID.

   The compressor always start assuming that the decompressor will not
   send feedback when it initializes a new context (see also , section the
   definition of a new context insection 5.1.1. of [I-D.ietf-rohc-rfc3095bis-framework]), [RFC4995]), i.e.
   there is no established feedback channel for the new context.  There
   will always be a possibility of decompression failure with the
   optimistic approach, because the decompressor may not have received
   sufficient information for correct decompression.  Therefore, until
   the decompressor has established a feedback channel, the compressor
   SHOULD periodically send IR packets.  The periodicity can be based on
   timeouts, on the number of compressed packets sent for the flow, or
   any other strategy the implementer chooses.

   The reception of either positive feedback (ACKs) or negative feedback
   (NACKs)
   (NACKs or STATIC-NACKs) establishes the feedback channel from the
   decompressor for the context (CID) for which the feedback was
   received.  Once there is an established feedback channel for a
   specific context, the compressor can make use of this feedback to
   estimate the current state of the decompressor.  This helps
   increasing the compression efficiency by providing the information
   needed for the compressor to achieve the necessary confidence level.
   When the feedback channel is established, it becomes superfluous for
   the compressor to send periodic refreshes, and instead it can rely
   entirely on the optimistic approach and feedback from the
   decompressor.

   The decompressor MAY send positive feedback (ACKs) to initially
   establish the feedback channel for a particular flow.  Either
   positive feedback (ACKs) or negative feedback (NACKs) establishes
   this channel.  The decompressor is REQUIRED to continue sending
   feedback once it has established a feedback channel for a CID, for
   the lifetime of the context, i.e. until the CID is associated with a
   different profile from the reception of an IR packet, to send error
   recovery requests and (optionally) acknowledgments of significant
   context updates.

   Due to

   Compression without an established feedback channel will be less
   efficient, because of the periodic refreshes and from the lack of
   feedback for initiation of error recovery, compression without an established feedback
   channel recovery; there will also be less efficient and have a
   slightly higher probability of loss propagation compared to the case
   where the decompressor making use of uses feedback.

6.2.

6.3.  Control Fields

   RoHCv2

   ROHCv2 defines a number of control fields that are used by the
   decompressor in its interpretation of the packet formats received
   from the compressor.

   A  The control field is a field that is transmitted from the compressor to fields listed in the decompressor, but is not part of the uncompressed header.  Values
   for control fields can be set up following
   subsections are all defined in the context of both the
   compressor and the decompressor.  Once established at the
   decompressor, the values of these fields MUST be kept until updated
   by another packet.

6.2.1. Section 6.8.2.4 using ROHC-FN
   [RFC4995].

6.3.1.  Master Sequence Number (MSN)

   The Master Sequence Number (MSN) field is either taken from a field
   that already exists in each of the headers of the protocol that the
   profile compresses (e.g.  RTP SN), or alternatively it is created at
   the compressor.  There is one MSN space per context (CID).

   The MSN field has the following two functions:

   o  Differentiating between packets reference headers when sending receiving feedback
      data.
   o  Inferring the value of incrementing fields (e.g.  IPv4
      Identifier).

   The MSN field is present in every packet ROHCv2 header sent by the
   compressor.  The MSN is sent in full in IR packets, while it is can be
   sent LSB encoded within CO header formats.  The decompressor always sends
   includes LSBs of the MSN as
   part of in the Acknowledgment Number field in
   feedback information. (see Section 6.9).  The compressor can later use the
   MSN this field
   to infer which what packet the decompressor is acknowledging.

   For profiles for which the MSN is created by the compressor, the
   following rules applies:

   o  The compressor should only initialize a new MSN for the initial IR
      sent for a CID that corresponds to a context that is not already
      associated with this profile;
   o  When the MSN is initialized, it is initialized to a random value;
   o  The value of the MSN is incremented by one for each packet that
      the compressor sends.

6.2.2. sends for a specific CID.

6.3.2.  Reordering Ratio

   The control field reorder_ratio specifies how much reordering is
   handled by the LSB encoding of the MSN.  This is useful when header
   compression is performed over links with varying reordering
   characteristics.  The reorder_ratio control field is a means for the
   compressor to adjust the robustness characteristics of the LSB
   encoding method with respect to reordering and consecutive losses, as
   described in Section 5.1.2.

6.3.3.  IP-ID behavior

   The IP-ID field of the IPv4 header can have different change
   patterns: sequential in network byte order, sequential byte-swapped,
   random or constant (a constant value of zero, although not conformant
   with [RFC0791], as has been observed in practice).  There is one IP-ID
   behavior control field per IP header.  The control field for the
   IP-ID behavior of the innermost IP header determines which set of packet
   header formats will be used.  Note that these  The IP-ID behavior control fields are field is
   also used to determine the contents of the irregular chain item item, for
   each IP header.

   If more than one level of IP headers is present, RoHCv2

   ROHCv2 profiles can assign a sequential behavior (network byte order
   or byte-swapped) only to the IP-ID of innermost IP header. header, when
   compressing more than one level of IP headers.  This is because only this
   the IP-ID can possibly of the innermost IP header is likely to have a sufficiently
   close correlation with the MSN to compress it as a sequentially
   changing field.  Therefore, a compressor MUST assign either the
   constant zero IP-ID or the random IP-ID behavior to tunneling
   headers.

6.3.  Reconstruction and Verification

6.3.4.  UDP-Lite Coverage Behavior

   The CRC carried within compressed headers MUST be used to verify
   decompression.  When control field coverage_behavior specifies how the decompression is verified and successful, checksum
   coverage field of the decompressor updates the context UDP-Lite header is compressed with RoHCv2.  It
   can indicate one of he following encoding methods: irregular, static
   or inferred compression.

6.3.5.  Timestamp Stride

   The ts_stride control field is used in scaled RTP timestamp encoding
   (see Section 6.6.8).  It defines the information received expected increase in the current header; otherwise if RTP
   timestamp between consecutive RTP sequence numbers.

6.3.6.  Time Stride

   The time_stride control field is used in timer-based compression
   encoding (see Section 6.6.9).  When timer-based compression is used,
   time_stride should be set to the expected difference in arrival time
   between consecutive RTP packets.

6.3.7.  CRC-3 for Control Fields

   ROHCv2 profiles define a CRC-3 calculated over a number of control
   fields.  This 3-bit CRC protecting the control fields is present in
   the reconstructed header fails format for the co_common and co_repair header types.

   Failure to validate the control fields using this CRC verification, these updates MUST NOT should be performed.

   A packet for which
   considered as a decompression failure by the decompressor, in the
   algorithm that assesses the validity of the context.  However, if the
   decompression attempt cannot can be verified using either the CRC MUST NOT be delivered CRC-3 or the
   CRC-7 calculated over the uncompressed header, the decompressor may
   still forward the decompressed header to upper layers.

   Note: Decompressor implementations may attempt corrective  This is
   because the protected control fields are not always used for
   decompression of the specific co_common or repair
   measures prior to performing the above actions, co_repair header that
   updates their respective value.

   The CRC polynomial and the result coverage of any
   decompression attempt MUST be verified using the CRC. this CRC-3 is defined in
   Section 6.6.11.

6.4.  Reordering  Reconstruction and Segmentation

   When ROHCv2 profiles are used on a channel that may reorder packets, Verification

   Validation of the compressor should take into account some extra considerations
   compared to when used on a channel that guarantees in-order
   delivery.ROHC Segmentation (see [I-D.ietf-rohc-rfc3095bis-framework]
   section 5.2.5) must not IR header (8-bit CRC)

      The decompressor MUST always validate the integrity of the IR
      header using the 8-bit CRC carried within the IR header.  When the
      header is validated, the decompressor updates the context with the
      information in the IR header.  Otherwise, if the IR cannot be used, i.e.  MRRU
      validated, the context MUST NOT be set updated and the IR header MUST
      NOT be delivered to 0).

6.4.1.  Optimistic Approach upper layers.

   Verification of CO headers (3-bit CRC or 7-bit CRC)

      The optimistic approach CRC carried within compressed headers MUST be used to verify
      decompression of CO headers.  When the decompression is affected by verified
      and successful, the reordering characteristics
   of decompressor updates the channel when operating over a reordering channel.  Compressor context with the
      information received in the CO header; otherwise if the
      reconstructed header fails the CRC verification, these updates
      MUST NOT be performed.
      A packet for which the decompression attempt cannot be verified
      using the CRC MUST NOT be delivered to upper layers.
      Decompressor implementations should therefore adjust their optimistic approach
   strategy may attempt corrective or repair
      measures on CO headers prior to match both packet loss performing the above actions, and reordering characteristics.

   For example,
      the number of repetitions for each update result of a non-LSB
   encoded field can any decompression attempt MUST be increased.  The compressor should ensure that
   each such update is repeated until it is reasonably confident that at
   least one packet containing this change has reached the decompressor
   before verified using the first packet sent after this sequence.
      CRC.

6.5.  Compressed Header Chains

   Some packet types use one or more chains containing sub-header
   information.  The function of a chain is to group fields based on
   similar characteristics, such as static, dynamic or irregular fields.

   Chaining is done by appending an item for each header to the chain in
   their order of appearance in the uncompressed packet, starting from
   the fields in the outermost header.

   Static chain:

      The static chain consists of one item for each header of the chain
      of protocol headers to be compressed, starting from the outermost
      IP header.  In the formal description of the packet formats, this
      static chain item for each header type is labelled
      <protocol_name>_static.  The static chain is only used in the IR
      packets.
      header format.

   Dynamic chain:

      The dynamic chain consists of one item for each header of the
      chain of protocol headers to be compressed, starting from the
      outermost IP header.  In the formal description of the packet
      formats, the dynamic chain item for each header type is labelled
      <protocol_name>_dynamic.  The dynamic chain is only used in the IR packet
      format
      header format.

   Irregular chain:

      The structure of the irregular chain is analogous to the structure
      of the static chain.  For each compressed packet, the irregular
      chain is appended at the specified location in the general format
      of the compressed packets as defined in Section 6.8.  The
      irregular chain is used for in all CO packets.

      The format of the irregular chain for the innermost IP header
      differs from the format of the one used for the outer IP headers, since because
      this header is part of the compressed base header.  What irregular
      chain items to use is determined by  In the
      definition of the packet formats using the formal notation, the
      argument "is_innermost",
      which is "is_innermost" passed as an argument to the corresponding encoding
      method (ipv4 or ipv6). ipv6) determines what irregular chain items to
      use.  The format of the irregular chain item for the outer IP
      headers is also determined using one flag for TTL/Hop Limit and
      one for TOS/TC.  These flags are defined in the format of some of
      the compressed base headers.
   RoHCv2

   ROHCv2 profiles compresses extension headers as other headers, and
   thus extension headers have a static chain, a dynamic chain and an
   irregular chain.

   Chains are defined

   ROHCv2 profiles define chains for all headers compressed by RoHCv2 profiles, that can be compressed,
   i.e.  RTP [RFC3550], UDP [RFC0768], UDP Lite [RFC3828], IPv4
   [RFC0791], IPv6 [RFC2460], AH [RFC4302], GRE [RFC2784][RFC2890], MINE
   [RFC2004], NULL-encrupted NULL-encrypted ESP [RFC4303], IPv6 Destination Options
   header[RFC2460], IPv6 Hop-by-hop Options header[RFC2460] and IPv6
   Routing header [RFC2460].

6.6.  Packet Formats and Encoding Methods

   The packet formats used for are defined using the ROHC formal notation.  Some
   of the encoding methods used in the packet formats are defined in [I-D.ietf-rohc-formal-notation],
   [RFC4997], while other methods are defined in this section.

6.6.1.  baseheader_extension_headers

   In

   The baseheader_extension_headers encoding method skips over all
   fields of the extension headers of the innermost IP header, without
   encoding any of the them.  Fields in these extension headers are
   instead encoded in the irregular chain.

   This encoding is used in CO packets headers (see Section 6.8.3), the 6.8.2).  The
   innermost IP header can be is combined with other header(s) (i.e.  UDP, UDP
   Lite, RTP) to create the compressed base header.  In such this case, the IP header there
   may have be a number of extension headers between itself the IP headers and the
   other headers.

   The base header defines some a representation of these the extension headers, to
   comply with the syntax of the formal notation; this encoding method
   provides this representation.

6.6.2.  baseheader_outer_headers

   The
   baseheader_extension_headers baseheader_outer_headers encoding method skips over all the
   fields of the extension headers of header(s) that do not belong to the innermost
   IP header, without encoding any of the them.  Fields  Changing fields in these extension outer
   headers are instead
   encoded in handled by the irregular chain.

6.6.2.  baseheader_outer_headers

   This encoding method, similarly to the baseheader_extension_headers
   encoding method above, is needed necessary to keep the definition of the
   packet formats syntactically correct.  It describe describes tunneling IP
   headers and their respective extension headers (i.e. all headers
   located before the innermost IP header) for CO headers (see
   Section 6.8.3). 6.8.2).

6.6.3.  inferred_udp_length

   The
   baseheader_outer_headers encoding method skips over all the fields of
   the extension header(s) that do not belong to decompressor infers the innermost IP
   header, without encoding any value of them.  Changed fields in outer
   headers are instead handled by the irregular chain.

6.6.3.  inferred_udp_length

   The UDP length field is inferred by the decompressor to be as being
   the size of the UDP payload.  This also means that the  The compressor MUST make
   sure must therefore ensure
   that the UDP length field is consistent with the length field(s) of
   preceeding subheaders, i.e., there must not be any padding after the
   UDP payload that is covered by the IP Length.

   This encoding method is also used for the UDP-Lite Checksum Coverage
   field, when it behaves in the same manner as the UDP length field
   (i.e. when the checksum always covers the entire UDP-Lite payload).

6.6.4.  inferred_ip_v4_header_checksum

   This encoding method compresses the header checksum field of the IPv4
   header.  This checksum is defined in RFC 791 [RFC0791] as follows:

      Header Checksum: 16 bits

         A checksum on the header only.  Since some header fields change
         (e.g., time to live), this is recomputed and verified at each
         point that the internet header is processed.

      The checksum algorithm is:

         The checksum field is the 16 bit one's complement of the one's
         complement sum of all 16 bit words in the header.  For purposes
         of computing the checksum, the value of the checksum field is
         zero.

   As described above, the header checksum protects individual hops from
   processing a corrupted header.  When  There is no reason to transmit this
   checksum when almost all IP header information is compressed away,
   and when decompression is verified by a CRC computed over the
   original header for every compressed packet, there
   is no point in having this additional checksum; instead it packet; instead, the checksum
   can be recomputed at by the decompressor side. decompressor.

   The "inferred_ip_v4_header_checksum" encoding method thus compresses
   the IPv4 header checksum field of the IPv4 header down to a size of zero bit,
   bits, i.e. no bits are transmitted in compressed headers for this
   field.  Using this encoding method, the decompressor infers the value
   of this field using the computation above.

   The compressor MAY use the header checksum to validate the
   correctness of the header before compressing it, to avoid compressing processing
   a corrupted header.

6.6.5.  inferred_mine_header_checksum

   This encoding method compresses the minimal encapsulation header
   checksum.  This checksum is defined in RFC 2004 [RFC2004] as follows:

      Header Checksum

         The 16-bit one's complement of the one's complement sum of all
         16-bit words in the minimal forwarding header.  For purposes of
         computing the checksum, the value of the checksum field is 0.
         The IP header and IP payload (after the minimal forwarding
         header) are not included in this checksum computation.

   The "inferred_mine_header_checksum" encoding method compresses the
   minimal encapsulation header checksum down to a size of zero bit, bits,
   i.e. no bits are transmitted in compressed headers for this field.
   Using this encoding method, the decompressor infers the value of this
   field using the above computation.

   The motivations for inferring this checksum are similar to the ones
   explained above in Section 6.6.4.

   The compressor MAY use the minimal encapsulation header checksum to
   validate the correctness of the header before compressing it, to
   avoid compressing processing a corrupted header.

6.6.6.  inferred_ip_v4_length

   This encoding method compresses the total length field of the IPv4
   header.  The total length field of the IPv4 header is defined in RFC
   791 [RFC0791] as follows:

      Total Length: 16 bits

         Total Length is the length of the datagram, measured in octets,
         including internet header and data.  This field allows the
         length of a datagram to be up to 65,535 octets.

   The "inferred_ip_v4_length" encoding method compresses the IPv4
   header checksum down to a size of zero bit, bits, i.e. no bits are
   transmitted in compressed headers for this field.  Using this
   encoding method, the decompressor infers the value of this field by
   counting in octets the length of the entire packet after
   decompression.

6.6.7.  inferred_ip_v6_length

   This encoding method compresses the payload length field in the IPv6
   header.  This length field is defined in RFC 2460 [RFC2460] as
   follows:

      Payload Length: 16-bit unsigned integer

         Length of the IPv6 payload, i.e., the rest of the packet
         following this IPv6 header, in octets.  (Note that any
         extension headers present are considered part of the payload,
         i.e., included in the length count.)

   The "inferred_ip_v6_length" encoding method compresses the payload
   length field of the IPv6 header down to a size of zero bit, bits, i.e. no
   bits are transmitted in compressed headers for this field.  Using
   this encoding method, the decompressor infers the value of this field
   by counting in octets the length of the entire packet after
   decompression.

6.6.8.  Scaled RTP Timestamp Encoding

   The RTP timestamp (TS) usually increases by a multiple of the RTP
   Sequence Number's (SN) increase and is therefore a suitable candidate
   for scaled encoding.  This scaling factor is labeled ts_stride in the
   definition of the profile in ROHC-FN Section 6.8.  The compressor
   sets the scaling factor based on the change in TS with respect to the
   change in the RTP SN.

   The

   As defined in Section 6.8.2.4, the initial value of the scaling
   factor ts_stride is always set to 1
   [NOTE: define what is initial?  New context with this profile?].
   When ts_stride is set to 1, scaling is not applied on the field for
   any format.

   Initially, the scaling factor is set to 1, meaning that no actual
   scaling is performed even in the scaled packet formats. 160.  For the compressor to use start
   using scaled encoding using a value different scaling than this default
   value, it must first explicitly transmit the new value of ts_stride
   to the decompressor, using one of the packet types that can carry
   this information.  If the compressor decides to use the default
   value, the stride does not need to be transmit in this step.

   Once the new value of the scaling factor is established, before using the
   new scaling factor, the compressor must have enough confidence that
   the decompressor has successfully calculated the residue (ts_offset)
   of the scaling function for the timestamp.  This is done by sending
   unscaled timestamp values to allow the decompressor to establish the
   residue based on the current ts_stride.  The compressor MAY send the
   unscaled timestamp in the same packets as the ones establishing the
   new ts_stride value.

   Once the compressor has gained enough confidence that both the value
   of the scaling factor and the value of the residue have been
   established in the decompressor, the compressor can start compressing
   packets using the new scaling factor.

   If the compressor notices that the residue (ts_offset) value changes,
   the compressor cannot use scaled timestamp packet formats until it
   has re-established the residue as described above.

   If the decompressor receives a packet containing scaled timestamp
   bits while the ts_stride equals zero, it MUST NOT deliver the packet
   to upper layers.

   When the value of the timestamp field wraps around, the value of the
   residue of the scaling function is likely to change.  When this
   occurs, the compressor re-establishes the new residue value as
   described above.

   The compressor MAY use the scaled timestamp encoding; what value it
   will use as the scaling factor is up to the compressor
   implementation, but to achive any gains from the scaling, the
   ts_stride should be set to the value of the expected incease in
   timestamp between consecutive sequence numbers.

   When scaled timestamp encoding is used for packet formats that do not
   transmit any LSB-encoded timestamp bits at all, the
   inferred_scaled_field encoding of Section 6.6.10 is used for encoding
   the timestamp.

6.6.9.  Timer-Based RTP Timestamp Encoding

   Text to be added.  Same encoding method as in RFC 3095, section
   4.5.4.

6.6.10.  inferred_scaled_field  timer_based_lsb

   The "inferred_scaled_field" timer-based compression encoding method is used to encode method, "timer_based_lsb",
   compresses a field
   that is defined as changing in relation to whose change pattern approximates a linear
   function of the MSN but for each
   increase is scaled by an established scaling factor. time of day.

   This encoding
   method is to be used in the case when a packet format contains MSN
   bits, but does not contain any bits for uses the scaled field.  In this
   case, local clock to obtain an approximation of the new
   value for the field being scaled that it encodes.  The approximated value is calculated
   according to then used as a
   reference value together with the following formula:

      unscaled_value = delta_msn * stride + previous_unscaled_value
   Where "delta_msn" is num_lsbs_param least-significant
   bits received as the difference encoded value, where num_lsbs_param represents a
   number of bits that is MSN between sufficient to uniquely represent the previous encoded
   value
   of MSN in the context and the value presence of jitter between compression endpoints.

   The clock resolution of the MSN decompressed from compressor or decompressor can be less
   than time_stride; in this
   packet, "previous_unscaled_value" case, the difference, i.e., actual
   resolution - time_stride, is treated as additional jitter in the value
   calculation of the field being
   scaled in the context, number of LSBs that needs to be transmitted.

     ts_scaled =:= timer_based_lsb(<time_stride_param>,
                                   <num_lsbs_param>, <offset_param>)

   The parameters "num_lsbs_param" and "stride" is "offset_param" are the scaling value for this
   field.

   For example, when this encoding method is applied parameters
   to use for the RTP
   timestamp in the RTP profile, lsb encoding, i.e. the calculation above becomes:
      timestamp = delta_msn * ts_stride + previous_timestamp

6.6.11.  control_crc3_encoding

   The "control_crc3_encoding" method provides a CRC calculated over a number of control fields. least significant
   bits and the interpretation interval offset, respectively.  The definition of this encoding method is
   parameter "time_stride_param" represents the same as for context value of the "crc"
   control field time_stride.

   This encoding method specified in section 4.11.6 always uses a scaled version of [I-D.ietf-rohc-formal-notation], with the difference that field it
   compresses.

   The value of the data
   that field is covered decoded by calculating an approximation of
   the CRC uncompressed value, using:

        tsc_ref_advanced = tsc_ref + (a_n - a_ref) / time_stride.

      where:
      - tsc_ref is given by a concatenated list reference value of control
   fields.

   In other words, the definition scaled representation
        of the control_crc3_encoding method field.
      - a_n is
   equivalent the arrival time associated to the following definition:

     control_crc_encoding(data_value, data_length)
     {
       UNCOMPRESSED {
       }

       COMPRESSED {
         control_crc3 =:=
           crc(3, 0x06, 0x07, ctrl_data_value, ctrl_data_length) [ 3 ];
       }
     }

   where value to decode.
      - a_ref is the parameter "ctrl_data_value" binds arrival time associated to the concatenated
   values reference header.
      - tsc_ref_advanced is an approximation of the following control fields, in uncompressed value
        of the order listed below:
   o  reorder_ratio, 2 field.

   The lsb() encoding is then applied using the num_lsbs_param bits padded by 6 MSB of zeroes
   o  ts_stride, 16 bits (applicable only for profiles 0x0101 and
      0x0107)
   o  msn,16 bits (not applicable for profiles 0x0101 and 0x0107)
   The "ctrl_data_length" binds to the sum of the length
   received in the CO header and tsc_ref_advanced as "ref_value" (as per
   Section 4.11.5 of [RFC4997]).

   Appendix B.3 provides an example on how the compressor can calculate
   jitter.

   The control
   field(s) that are applicable.

   A 3-bit CRC field time_stride controls whether or not the
   timer_based_lsb method is used to validate in the control fields that are updated
   by CO header.  The decompressor
   SHOULD send the co_common and co_repair packet types; CLOCK_RESOLUTION option if it cannot verify the
   outcome of receives a decompression attempt.  The definition of this CRC comes
   from non-zero
   time_stride value and it has not previously informed the fact compressor
   that it supports timer-based compression using the decompression of CLOCK_RESOLUTION
   option with a header that carries and
   updates control fields does not necessarily make use of these control
   fields, and non-zero value.  Whether the update CLOCK_RESOLUTION is set to the control fields
   a non-zero value or to a zero value is thus not protected by up to the CRC-7 validation.

   For example, without a verification implementation.

   The support and usage of timer-based compression is optional for both
   the updates compressor and the decompressor; the compressor is never required
   to set the time_stride control
   fields, there would be a possibility that a decompression attempt
   succeeds for field to a co_common or for non-zero value when it has
   received a co_repair packet non-zero value for which the
   decompressor would send CLOCK_RESOLUTION option.

6.6.10.  inferred_scaled_field

   The "inferred_scaled_field" encoding method is used to encode a positive feedback, even field
   that is defined as changing in relation to the case where
   one of the control fields had been corrupted on the link between the
   compression endpoints.

6.6.12.  inferred_sequential_ip_id MSN but for each
   increase is scaled by an established scaling factor.  This encoding
   method is to be used in the case when a sequential IP-ID behavior is used
   (sequential or sequential byte-swapped) and no coded IP-ID bits are
   present in the compressed header.  When these packet types are used,
   the IP-ID offset from the MSN will be constant, and therefore, the
   IP-ID will increase by the same amount as the format contains MSN increases by
   (similar to
   bits, but does not contain any bits for the inferred_scaled_field encoding method).

   Therefore, scaled field.  In this
   case, the new value for the IP-ID field being scaled is calculated
   according to the following formula:
      IP-ID

      unscaled_value = delta_msn * stride + previous_IP_ID_value reference_unscaled_value

   Where "delta_msn" is the difference is in MSN between the previous reference
   value of the MSN in the context and the value of the MSN decompressed
   from this packet, "previous_IP_ID_value" "reference_unscaled_value" is the value of the IP-ID
   field being scaled in the
   context.

   If the IP-ID behavior context, and "stride" is random or zero, the scaling value
   for this field.

   For example, when this encoding method does
   not update any fields.

6.6.13.  list_csrc(cc_value)

   This encoding method describes how is applied to the list of CSRC identifiers can
   be compressed using list compression.  This list compression operates
   by establishing content for RTP
   timestamp in the different CSRC identifiers (items)
   and list describing RTP profile, the order that they appear. calculation above becomes:

      timestamp = delta_msn * ts_stride + reference_timestamp

6.6.11.  control_crc3_encoding

   The argument to "control_crc3_encoding" method provides a CRC calculated over a
   number of control fields.  The definition of this encoding method (cc_value) is
   the CC field from
   the RTP header which same as for the compressor passes to this "crc" encoding method.
   The decompressor method specified in section 4.11.6
   of [RFC4997], with the difference that the data that is required to bind covered by
   the value CRC is given by a concatenated list of this argument to control fields.

   In other words, the number definition of items in the list, which will allow the decompressor control_crc3_encoding method is
   equivalent to
   corectly reconstruct the CC field.

6.6.13.1.  List Compression

   The CSRC identifiers following definition:

     control_crc_encoding(data_value, data_length)
     {
       UNCOMPRESSED {
       }

       COMPRESSED {
         control_crc3 =:=
           crc(3, 0x06, 0x07, ctrl_data_value, ctrl_data_length) [ 3 ];
       }
     }

   where the parameter "ctrl_data_value" binds to the concatenated
   values of the following control fields, in the uncompressed packet can be represented as
   an ordered list, whose order and presence are usually constant
   between packets.  The generic structure listed below:

   o  reorder_ratio, 2 bits padded by 6 MSB of such a list zeroes
   o  ts_stride, 32 bits (applicable only for profiles 0x0101 and
      0x0107)
   o  time_stride, 32 bits (applicable only for profiles 0x0101 and
      0x0107)
   o  msn, 16 bits (not applicable for profiles 0x0101 and 0x0107, since
      the RTP Sequence Number is already verified as follows:

            +--------+--------+--...--+--------+
      list: | item 1 | item 2 |       | item n |
            +--------+--------+--...--+--------+

   When performing list compression on a CSRC list, each item is part of the
      uncompressed value header)
   o  coverage_behavior, 2 bits padded by 6 MSB of zeroes, applicable
      only to profiles 0x0107 and 0x0108
   o  ip_id_behavior, one CSRC identifier.

   The basic principles octet for each IP header in the compressible
      header chain starting from the outermost header.  Each octet
      consists of list-based compression are 2 bits padded by 6 MSBs of zeroes

   The "ctrl_data_length" binds to the following:

      1) When a context is being initialized, a complete representation sum of the compressed list length of options is transmitted.  All items the control
   field(s) that
      have any content are present in applicable.

   A 3-bit CRC is used to validate the compressed list of items sent control fields that are updated
   by the compressor.

   Then, once the context has been initialized:

      2) When co_common and co_repair packet types; it cannot verify the structure
   outcome of the list is unchanged no information
      about the list is sent in compressed headers.
      3) When the structure a decompression attempt.  The definition of this CRC comes
   from the list changes, a compressed list is
      sent in fact that the compressed header, including decompression of a representation header that carries and
   updates control fields does not necessarily make use of its
      structure these control
   fields, and order.  Previously unknown items are sent
      uncompressed in the list, while previously known items are only
      represented by an index pointing update to the context.

6.6.13.2.  Table-based Item Compression

   The Table-based item compression compresses individual items sent in
   compressed lists.  The compressor assigns control fields is thus not protected by
   the CRC-7 validation.

   For example, without a unique identifier,
   "Index", to each item "Item" verification of a list.

   Compressor Logic

      The compressor conceptually maintains an Item Table containing all
      items, indexed using "Index".  The (Index, Item) pair is sent
      together in compressed lists until the compressor gains enough
      confidence updates to the control
   fields, there would be a possibility that a decompression attempt
   succeeds for a co_common or for a co_repair packet for which the
   decompressor has observed the mapping between
      items and their respective index.  Confidence is obtained from would send a positive feedback, even in the
      reception case where
   one of an acknowledgment from the decompressor, or by
      sending (Index, Item) pairs using control fields had been corrupted on the optimistic approach.  Once
      confidence is obtained, link between the index alone
   compression endpoints.

6.6.12.  inferred_sequential_ip_id

   This encoding method is sent used when a sequential IP-ID behavior is used
   (sequential or sequential byte-swapped) and no coded IP-ID bits are
   present in the compressed
      lists to indicate header.  When these packet types are used,
   the presence of IP-ID offset from the item corresponding to this
      index.

      The compressor may reassign an existing index to a new item, MSN will be constant, and therefore, the
   IP-ID will increase by
      re-establishing the mapping using same amount as the procedure described above.

   Decompressor Logic

      The decompressor conceptually maintains an Item Table that
      contains all (Index, Item) pairs received.  The Item Table is
      updated whenever an (Index, Item) pair is received and
      decompression is successfully verified using MSN increases by
   (similar to the CRC.  The
      decompressor retrieves inferred_scaled_field encoding method).

   Therefore, the item from new value for the table whenever an Index
      without an accompanying Item IP-ID is received.

      If an index without an accompanying item calculated according to the
   following formula:
      IP-ID = delta_msn + reference_IP_ID_value
   Where "delta_msn" is received and the
      decompressor does not have any context for this index, difference is MSN between the packet
      MUST NOT be delivered to upper layers.

6.6.13.3.  Encoding reference
   value of Compressed Lists

   Each item present MSN in a compressed list is represented by:

   o  an index into the table of items, context and
   o  a presence bit indicating if a compressed representation the value of the
      item MSN decompressed
   from this packet, "previous_IP_ID_value" is present in the list.
   o  an item (if value of the presence bit is set) IP-ID in
   the context.

   If the presence bit IP-ID behavior is random or zero, this encoding method does
   not set, update any fields.

6.6.13.  list_csrc(cc_value)

   This encoding method describes how the item must already list of CSRC identifiers can
   be known by the
   decompressor.

   A compressed using list of items uses the following encoding:

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      | Reserved  |PS |       m       |
      +---+---+---+---+---+---+---+---+
      |        XI_1, ..., XI_m        | m octets, or m * 4 bits
      /                --- --- --- ---/
      |               :    Padding    : if PS = 0 compression.  This list compression operates
   by establishing content for the different CSRC identifiers (items)
   and m is odd
      +---+---+---+---+---+---+---+---+
      |                               |
      /      item_1, ..., item_n      / variable
      |                               |
      +---+---+---+---+---+---+---+---+

      Reserved: Must be set list describing the order that they appear.

   The argument to zero.

      PS: Indicates size of XI fields:
         PS = 0 indicates 4-bit XI fields;
         PS = 1 indicates 8-bit XI fields.

      m: Number this encoding method (cc_value) is the value of XI item(s) in the compressed list.  Also
   CC field from the RTP header which the compressor passes to this
   encoding method.  The decompressor is required to bind the value of
   this argument to the cc_value argument.

      XI_1, ..., XI_m: m XI items.  Each XI represents one item number of items in the
      list of item of list, which will allow
   the uncompressed header, in decompressor to corectly reconstruct the same order as they
      appear CC field.

6.6.13.1.  List Compression

   The CSRC identifiers in the uncompressed header. packet can be represented as
   an ordered list, whose order and presence are usually constant
   between packets.  The format generic structure of an XI item such a list is as follows:

                 +---+---+---+---+
         PS = 0: | X |   Index

            +--------+--------+--...--+--------+
      list: |
                 +---+---+---+---+

                   0 item 1   2   3   4   5   6   7
                 +---+---+---+---+---+---+---+---+
         PS = 1: | X | Reserved item 2 |     Index       |
                 +---+---+---+---+---+---+---+---+

         X: Indicates whether the item present in the list:

            X = 1 indicates that the n |
            +--------+--------+--...--+--------+

   When performing list compression on a CSRC list, each item corresponding to the Index is
            sent in the item_1, ..., item_n list;
            X = 0 indicates that
   uncompressed value of one CSRC identifier.

   The basic principles of list-based compression are the item corresponding to following:

      1) When a context is being initialized, a complete representation
      of the Index list of CSRC identifiers is
            not sent.

         Reserved: Set to zero when sending, ignored when received.

         Index: An index into transmitted.

   Then, once the item table.  See Section 6.6.13.4 context has been initialized:

      2) When 4-bit XI items are used and, the XI items are placed in
         octets in structure of the following manner:

           0   1   2   3   4   5   6   7
         +---+---+---+---+---+---+---+---+
         |     XI_k      |    XI_k + 1   |
         +---+---+---+---+---+---+---+---+
      Padding: A 4-bit padding field list is present when PS = 0 and unchanged, no information
      about the
      number of XIs is odd.  The Padding field list is set to zero when
      sending and ignored when receiving.

      Item 1, ..., item n: Each item corresponds to an XI with X = 1 in
      XI 1, ..., XI m.  Each entry sent in compressed headers.
      3) When the item structure of the list changes, a compressed list is
      sent in the uncompressed compressed header, including a representation of one CSRC identifier.

6.6.13.4. its
      structure and order.  Previously unknown items are sent
      uncompressed in the list, while previously known items are only
      represented by an index pointing to the context.

6.6.13.2.  Table-based Item Table Mappings Compression

   The Table-based item table for list compression is limited compresses individual items sent in
   compressed lists.  The compressor assigns a unique identifier,
   "Index", to 16 different items,
   since the RTP header can only carry at most 15 simultaneous CSRC
   identifiers.  The effect each item "Item" of having more than 16 items will only cause a slight overhead to the list.

   Compressor Logic

      The compressor when items are swappen in/out of
   the item table.

6.6.13.5.  Compressed Lists conceptually maintains an Item Table containing all
      items, indexed using "Index".  The (Index, Item) pair is sent
      together in Dynamic Chain

   A compressed list lists until the compressor gains enough
      confidence that is part of the dynamic chain (e.g. in IR
   packets) must have all its list items present, i.e. all X-bits in decompressor has observed the
   XI list MUST be set.  All mapping between
      items previously established in the item
   table that are not present in the list decompressed and their respective index.  Confidence is obtained from this packet
   MUST also be retained in the decompressor context.

6.7.  Encoding Methods With External Parameters

   A number
      reception of encoding methods in Section 6.8.3.2 have one or more
   arguments for which an acknowledgment from the derivation of decompressor, or by
      sending (Index, Item) pairs using the parameter's value optimistic approach.  Once
      confidence is
   outside the scope of the ROHC-FN specification of obtained, the header formats.
   This section index alone is sent in compressed
      lists the encoding methods together with a definition of
   each of their parameters.

   o  ip_dest_opt(repair_flag):

         repair_flag: This parameter must be set to indicate the value that was
         used for presence of the item corresponding "repair_flag" parameter of to this
      index.

      The compressor may reset its item table upon receiving negative
      acknowledgement.
      The compressor may reassign an existing index to a new item, by
      re-establishing the
         "[profilename]_baseheader" encoding method when extracting mapping using the
         irregular chain for a compressed header; otherwise it procedure described above.

   Decompressor Logic

      The decompressor conceptually maintains an Item Table that
      contains all (Index, Item) pairs received.  The Item Table is set to
         zero
      updated whenever an (Index, Item) pair is received and ignored for other types of chains.

   o  ip_hop_opt(repair_flag):

         See definition of arguments for "ip_dest_opt" above.

   o  gre(repair_flag):

         See definition of arguments for "ip_dest_opt" above.

   o  ah(repair_flag):

         See definition of arguments for "ip_dest_opt" above.

   o  esp_null(next_header_value, repair_flag):

         next_header_value: Set to the value of
      decompression is successfully verified using the Next Header field
         located in CRC.  The
      decompressor retrieves the ESP trailer, usually 12 octets item from the end of
         the packet.  Compression of null-encrypted ESP headers should
         only be performed when the compressor has prior knowledge of table whenever an Index
      without an accompanying Item is received.

      If an index without an accompanying item is received and the exact location of
      decompressor does not have any context for this index, the next header field.

         repair_flag: This parameter must packet
      MUST NOT be set delivered to the value that was
         used for the corresponding "repair_flag" parameter upper layers.

6.6.13.3.  Encoding of the
         "[profilename]_baseheader" encoding method when extracting the
         irregular chain for Compressed Lists

   Each item present in a compressed header; otherwise it list is set to
         zero and ignored for other types of chains. represented by:

   o  ipv6(profile, is_innermost, ip_outer_flag, repair_flag)):

         profile: Set to  an index into the profile number table of items, and
   o  a presence bit indicating if a compressed representation of the profile used to
         compress this packet.

         is_innermost: This boolean flag
      item is set to 1 when processing present in the
         innermost IP header; otherwise it list.
   o  an item (if the presence bit is set to 0.

         repair_flag: This parameter must be set to the value that was
         used for set)

   If the corresponding "repair_flag" parameter of presence bit is not set, the
         "[profilename]_baseheader" encoding method when extracting item must already be known by the
         irregular chain for a
   decompressor.

   A compressed header; otherwise it list of items uses the following encoding:

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      | Reserved  |PS |       m       |
      +---+---+---+---+---+---+---+---+
      |        XI_1, ..., XI_m        | m octets, or m * 4 bits
      /                --- --- --- ---/
      |               :    Padding    : if PS = 0 and m is odd
      +---+---+---+---+---+---+---+---+
      |                               |
      /      item_1, ..., item_n      / variable
      |                               |
      +---+---+---+---+---+---+---+---+
      Reserved: Must be set to
         zero and ignored for other types zero.

      PS: Indicates size of chains.

   o  ipv4(profile, is_innermost, ip_outer_flag, repair_flag)

         See definition XI fields:
         PS = 0 indicates 4-bit XI fields;
         PS = 1 indicates 8-bit XI fields.

      m: Number of arguments for "ipv6" above.

   o  udp(profile)

         profile: Set to XI item(s) in the profile number compressed list.  Also the value of
      the profile used to
         compress this packet.

   o  rtp(profile, ts_stride_value, time_stride_value)
         profile: Set to cc_value argument.

      XI_1, ..., XI_m: m XI items.  Each XI represents one item in the profile number
      list of item of the profile used to
         compress this packet.

         ts_stride_value: This parameter is set to a user-selected value
         that is uncompressed header, in the expected increase same order as they
      appear in the RTP Timestamp between
         consecutive sequence numbers.  See also Section 6.6.8.

         time_stride_value: This parameter is set to a user-selected
         value that uncompressed header.

         The format of an XI item is as follows:

                 +---+---+---+---+
         PS = 0: | X |   Index   |
                 +---+---+---+---+

                   0   1   2   3   4   5   6   7
                 +---+---+---+---+---+---+---+---+
         PS = 1: | X | Reserved  |     Index     |
                 +---+---+---+---+---+---+---+---+

         X: Indicates whether the expected inter-arrival time between
         consecutive packets for this flow.  See also Section 6.6.9.

   o  esp(profile)

         profile: Set to the profile number of the profile used to
         compress this packet.

   o  udp_lite(profile)

         profile: Set to item present in the profile number of list:

            X = 1 indicates that the profile used to
         compress this packet.

   o  rtp_baseheader(profile, ts_stride_value, time_stride_value,
      outer_ip_flag, repair_flag):

         profile: Set item corresponding to the profile number of the profile used to
         compress this packet.

         ts_stride_value: This parameter Index is set to a user-selected value
            sent in the item_1, ..., item_n list;
            X = 0 indicates that is the expected increase in item corresponding to the RTP Timestamp between
         consecutive sequence numbers.  See also Section 6.6.8.

         time_stride_value: This parameter Index is set
            not sent.

         Reserved: Set to a user-selected
         value that is zero when sending, ignored when received.

         Index: An index into the expected inter-arrival time between
         consecutive packets for this flow. item table.  See also Section 6.6.9.

         outer_ip_flag: This parameter is set to 1 of one or more of a a
         number of semi-static fields 6.6.13.4

         When 4-bit XI items are used and, the XI items are placed in outer IP headers have changed
         compared to their reference values
         octets in the context, otherwise it
         is set to 0.  The value used for this parameter following manner:

           0   1   2   3   4   5   6   7
         +---+---+---+---+---+---+---+---+
         |     XI_k      |    XI_k + 1   |
         +---+---+---+---+---+---+---+---+
      Padding: A 4-bit padding field is also used
         for present when PS = 0 and the "outer_ip_flag" argument for a
      number of encoding
         methods defined above, when these are processing the irregular
         chain.  This flag may only be set to 1 either for the
         "co_common" or the "co_repair" packet formats in the different
         profiles.

         repair_flag: This parameter XIs is odd.  The Padding field is set to zero when
      sending and ignored when receiving.

      Item 1, ..., item n: Each item corresponds to an XI with X = 1 if the certain fields in extension headers or outer IP headers have changed compared
         to their reference values
      XI 1, ..., XI m.  Each entry in the context, otherwise it item list is set
         to 0. the uncompressed
      representation of one CSRC identifier.

6.6.13.4.  Item Table Mappings

   The value used item table for this parameter list compression is also used for limited to 16 different items,
   since the
         "repair_flag" argument for a number RTP header can only carry at most 15 simultaneous CSRC
   identifiers.  The effect of encoding methods defined
         above, when these are processing the irregular chain.  This may having more than 16 items will only be set to 1 for the "co_repair" packet formats in the
         different profiles.
   o  udp_baseheader(profile, outer_ip_flag, repair_flag):

         profile: Set cause
   a slight overhead to the profile number compressor when items are swapped in/out of
   the profile used to
         compress this packet.

         outer_ip_flag: This parameter item table.

6.6.13.5.  Compressed Lists in Dynamic Chain

   A compressed list that is set to 1 of one or more of a a
         number part of semi-static fields the dynamic chain (i.e. in outer IP headers IR
   packets) must have changed
         compared to their reference values all its list items present, i.e. all X-bits in the context, otherwise it
         is set to 0.  The value used for this parameter is also used
         for
   XI list MUST be set.  All items previously established in the "outer_ip_flag" argument for a item
   table that are not present in the list decompressed from this packet
   MUST also be retained in the decompressor context.

6.7.  Encoding Methods With External Parameters

   A number of encoding methods defined above, when these are processing in Section 6.8.2.4 have one or more
   arguments for which the irregular
         chain. derivation of the parameter's value is
   outside the scope of the ROHC-FN specification of the header formats.
   This flag may section lists the encoding methods together with a definition of
   each of their parameters.

   o  esp_null(next_header_value):

         next_header_value: Set to the value of the Next Header field
         located in the ESP trailer, usually 12 octets from the end of
         the packet.  Compression of null-encrypted ESP headers should
         only be set performed when the compressor has prior knowledge of
         the exact location of the next header field.

   o  ipv6(profile, is_innermost, outer_ip_flag)):

         profile: Set to 1 either for the
         "co_common" or 16-bit profile number of the "co_repair" packet formats in profile used
         to compress this packet.

         is_innermost: This boolean flag is set to 1 when processing the different
         profiles.

         repair_flag:
         innermost IP header; otherwise it is set to 0.

         outer_ip_flag: This parameter is set to 1 if the certain one or more of a
         number of semi-static fields in extension headers or outer IP headers have changed
         compared to their reference values in the context, otherwise it
         is set to 0.  The value used for this parameter is also used
         for the
         "repair_flag" "outer_ip_flag" argument for a number of encoding
         methods defined above, when these are processing the irregular
         chain.  This flag may only be set to 1 for the "co_repair" "co_common"
         packet formats format in the different profiles.

   o  esp_baseheader(profile, outer_ip_flag, repair_flag):  ipv4(profile, is_innermost, outer_ip_flag)

         See definition of arguments for "udp_baseheader" "ipv6" above.

   o  iponly_baseheader(profile, outer_ip_flag, repair_flag):

         See definition  udp(profile)

         profile: Set to the 16-bit profile number of arguments for "udp_baseheader" above. the profile used
         to compress this packet.

   o  udplite_rtp_baseheader(profile,  rtp(profile, ts_stride_value,
      time_stride_value, outer_ip_flag, repair_flag):

         See definition of arguments for "rtp_baseheader" above.

   o  udplite_baseheader(profile, outer_ip_flag, repair_flag):

         See definition time_stride_value)

         profile: Set to the 16-bit profile number of arguments for "udp_baseheader" above.

6.8.  Packet Formats

   ROHCv2 profiles use two different packet types: the Initialization
   and Refresh (IR) packet type, and the Compressed packet type (CO).

   Each packet type defines a number profile used
         to compress this packet.

         ts_stride_value: The value of packet formats: two packet
   formats are defined for this parameter should be set to
         the IR type, expected increase in the RTP Timestamp between consecutive
         RTP sequence numbers and two sets base header formats
   are defined for the CO type with one additional format that selected value is common implementation-
         specific.  See also Section 6.6.8.

         time_stride_value: The value of this parameter should be set to both sets.

   When
         the number of bits available in compressed header fields exceeds expected inter-arrival time between consecutive packets for
         the number of bits in flow, and the selected value is implementation-specific.
         It MUST NOT be set to a non-zero value, unless the most significant field is padded compressor
         has received a feedback message with zeroes in its most significant bits.

   Updating Properties: all packet types carry the CLOCK_RESOLUTION
         option set to a CRC and are context
   updating.  Packets update non-zero value.  See also Section 6.6.9.

   o  esp(profile)
         profile: Set to the entire context besides 16-bit profile number of the fields for
   which they explicitly convey information for, since profile used
         to compress this packet.

   o  udp_lite(profile)

         profile: Set to the context can
   be expressed as 16-bit profile number of the profile used
         to compress this packet.

   o  rtp_baseheader(profile, ts_stride_value, time_stride_value,
      outer_ip_flag):

         profile: Set to the collection 16-bit profile number of the reference profile used
         to compress this packet.

         ts_stride_value: The value of each field
   together with the function established with respect this parameter should be set to
         the MSN.

6.8.1.  Initialization expected increase in the RTP Timestamp between consecutive
         RTP sequence numbers and Refresh Packet (IR)

   The IR packet format uses the structure selected value is implementation-
         specific.  See also Section 6.6.8.

         time_stride_value: The value of this parameter should be set to
         the ROHC IR packet as
   defined in [I-D.ietf-rohc-rfc3095bis-framework], section 5.2.2.1.

   Packet type: IR

      This packet type communicates expected inter-arrival time between consecutive packets for
         the static part flow, and the dynamic part
      of selected value is implementation-specific.
         It MUST NOT be set to a non-zero value, unless the context.

   The ROHCv2 IR packet compressor
         has received a feedback message with the following format:

        0 CLOCK_RESOLUTION
         option set to a non-zero value.  See also Section 6.6.9.

         outer_ip_flag: This parameter is set to 1   2   3   4   5   6   7
       --- --- --- --- --- --- --- ---
      :        Add-CID octet          : if one or more of a
         number of semi-static fields in outer IP headers have changed
         compared to their reference values in the context, otherwise it
         is set to 0.  The value used for small CIDs and (CID != 0)
      +---+---+---+---+---+---+---+---+
      | 1   1   1   1   1   1   0 this parameter is also used
         for the "outer_ip_flag" argument for a number of encoding
         methods defined above, when these are processing the irregular
         chain.  This flag may only be set to 1 | IR type octet
      +---+---+---+---+---+---+---+---+
      :                               :
      /       0-2 octets either for the
         "co_common" packet format in the different profiles.

   o  udp_baseheader(profile, outer_ip_flag):

         profile: Set to the 16-bit profile number of CID       / 1-2 octets if the profile used
         to compress this packet.

         outer_ip_flag: See definition of this argument for large CIDs
      :                               :
      +---+---+---+---+---+---+---+---+
      |            Profile            | 1 octet
      +---+---+---+---+---+---+---+---+
      |              CRC              | 1 octet
      +---+---+---+---+---+---+---+---+
      |                               |
      /         Static chain          / variable length
      |                               |
       - - - - - - - - - - - - - - - -
      |                               |
      /         Dynamic chain         / variable length
      |                               |
       - - - - - - - - - - - - - - - -
      |                               |
      /            Payload            / variable length
      |                               |
       - - - - - - - - - - - - - - - -

      Static chain:
         "rtp_baseheader" above.

   o  esp_baseheader(profile, outer_ip_flag):

         See Section 6.5.

      Dynamic chain: definition of arguments for "udp_baseheader" above.

   o  iponly_baseheader(profile, outer_ip_flag):

         See Section 6.5.

      Payload: The payload definition of the corresponding original packet, if any.
      The presence arguments for "udp_baseheader" above.

   o  udplite_rtp_baseheader(profile, ts_stride_value,
      time_stride_value, outer_ip_flag):

         See definition of a payload is inferred from arguments for "rtp_baseheader" above.

   o  udplite_baseheader(profile, outer_ip_flag):

         See definition of arguments for "udp_baseheader" above.

6.8.  Packet Formats

   ROHCv2 profiles use two different packet types: the Initialization
   and Refresh (IR) packet type, and the Compressed packet length.

6.8.2. type (CO).

   Each packet type defines a number of packet formats: An IR packet
   format, and two sets base header formats are defined for the CO type
   with a few additional formats that are common to both sets.

6.8.1.  Initialization and Refresh Packet Payload Discard (IR-PD) (IR)

   The IR-PD IR packet format uses the structure of the ROHC IR packet as
   defined in [I-D.ietf-rohc-rfc3095bis-framework], [RFC4995], section 5.2.2.1.

   Packet type: IR-PD IR

      This packet type communicates the static part and the dynamic part
      of the context, but without the payload of the original packet for
      which it carries the header information. context.

   The ROHCv2 IR packet has the following format:

        0   1   2   3   4   5   6   7
       --- --- --- --- --- --- --- ---
      :        Add-CID octet          : if for small CIDs and (CID != 0)
      +---+---+---+---+---+---+---+---+
      | 1   1   1   1   1   1   0   0   1 | IR type octet
      +---+---+---+---+---+---+---+---+
      :                               :
      /       0-2 octets of CID       / 1-2 octets if for large CIDs
      :                               :
      +---+---+---+---+---+---+---+---+
      |            Profile            | 1 octet
      +---+---+---+---+---+---+---+---+
      |              CRC              | 1 octet
      +---+---+---+---+---+---+---+---+
      |                               |
      /         Static chain          / variable length
      |                               |
       - - - - - - - - - - - - - - - -
      |                               |
      /         Dynamic chain         / variable length
      |                               |
       - - - - - - - - - - - - - - - -
      |                               |
      /            Payload            / variable length
      |                               |
       - - - - - - - - - - - - - - - -

      Static chain: See Section 6.5.

      Dynamic chain: See Section 6.5.

6.8.3.  Compressed Packet Formats (CO)

6.8.3.1.  Design rationale for compressed base headers

      Payload: The compressed packet payload of the corresponding original packet, if any.
      The payload consists of all data after the last octet of the last
      header compressed by the current profile.  The presence of a
      payload is inferred from the packet length.

6.8.2.  Compressed Packet Formats (CO)

6.8.2.1.  Design rationale for compressed base headers

   The compressed packet formats are defined as two separate sets for
   each profile: one set for the packets where the innermost IP header
   contains a sequential IP-ID (either network byte order or byte
   swapped), and one set for the packets without sequential IP-ID
   (either random, zero, or no IP-ID).  There are also a number of
   common packet format shared between both sets.  When described below,
   the packet formats belonging to the sequential set contain "seq" in
   their names, while those belonging to the non-sequential set contain
   the "rnd" in their names.

   The design of the packet formats is derived from the field behavior
   analysis found in Appendix A.

   All of the compressed base headers transmit LSB-encoded MSN bits and
   a CRC.

   The following packet formats exist for all profiles defined in this
   document, both for the sequential and random packet format sets:

   o  co_common: The common packet format is designed so that it can be
      used for chagnes changes to all the any dynamic fields field in the context, but can not
      always transmit all these such fields uncompressed can be used. uncompressed.  It is therefore
      useful for when some of the more rarely changing fields in the
      headers change.  Since this packet format may modify the value of
      the control fields that determine how the decompressor interprets
      different compressed header format, it carries a 7-bit CRC to
      reduce the probability of context corruption.  This packet format
      uses a large set of flags to provide information about which
      fields are present in the packet format and can therefore be of
      very varied size.

   o  co_repair:  This packet format is very similar to the co_common format
      described above.  The difference is that this UOR-2-
      extension 3 packet format in [RFC3095]

   o  co_repair: This format is intended to be used when context damage
      has been assumed, and therefore changing fields are transmit
      uncompressed when present in this
      format.  This format also and contains some options to transmit semi-
      static fields from extension headers which cannot be transmit with
      the co_common format. a complete dynamic chain.
      This packet format should be considered a replacement for the IR-DYN IR-
      DYN packet format which is not defined for the profiles defined in
      this document.

   o  pt_0_crc3: This packet format only transmit transmits the MSN, and can
      therefore only be used to update the MSN and fields that are
      derived from the MSN, such as IP-ID and the RTP Timestamp (where
      applicable).  This packet format is equivalent to the UO-0 packet
      format in [RFC3095]

   o  pt_0_crc7: This packet has the same properties as pt_0_crc3, but
      is instead protected by a 7-bit CRC and contains a larger amount
      of LSB-encoded MSN bits.  This format is intended to be used for
      the compressor to transmit from IC state to FC state (see
      Section 5.3.1 or it can for example be used on
      ROHC channels that expect a high amount of reordering. reordering or link
      layers with high residual error rates.

   The following packet formats exist exclusively for format descriptions apply to profiles 0x101 and
   0x107.

   o  pt_1_rnd: This format is a replacement for the UO-1 packet format
      in [RFC3095] and can be used to transmit changes in the MSN, RTP
      Marker bit and it can update the RTP timestamp using scaled
      timestamp encoding.

   o  pt_1_seq_id: This format is a replacement for the UO-1-ID packet
      format in [RFC3095] and can be used to transmit changes in the MSN
      and IP-ID.

   o  pt_1_seq_ts: This format is a replacement for the UO-1-TS packet
      format in [RFC3095] and can be used to transmit changes in the
      MSN, RTP Marker bit and can update the RTP Timestamp using scaled
      timestamp encoding.

   o  pt_2_rnd: This format is a replacement for the UOR-2 packet format
      in [RFC3095] and can be used to transmit changes in the MSN, RTP
      Marker bit and the RTP Timestamp, and is protected by a 7-bit CRC.

   o  pt_2_seq_id: This format is a replacement for the UO-2-ID packet
      format in [RFC3095] and can be used to transmit changes in the MSN
      and IP-ID.  This format is also protected by a 7-bit CRC.

   o  pt_2_seq_ts: This format is a replacement for the UO-2-TS packet
      format in [RFC3095] and can be used to transmit changes in the
      MSN, RTP Marker bit and can update the RTP Timestamp using scaled
      timestamp encoding.  This format is also protected by a 7-bit CRC.

   o  pt_2_seq_both: This format is replaces the UOR-2-ID extension 1
      format in [RFC3095] and can carry changes in both the RTP
      Timestamp and IP-ID in addition to the MSN and Marker bit.

   The following packet formats exist exclusively for descriptions apply to profiles 0x102,
   0x103, 0x104 and 0x108.

   o  pt_1_seq_id: This format is a replacement for the UO-1-ID packet
      format in [RFC3095] and can be used to transmit changes in the MSN
      and IP-ID.

   o  pt_2_rnd: This format is a replacement for the UOR-2 packet format
      in [RFC3095] and can be used to transmit changes in the MSN and is
      protected by a 7-bit CRC.

   o  pt_2_seq_id: This format is a replacement for the UO-2-ID packet
      format in [RFC3095] and can be used to transmit changes in the MSN
      and IP-ID.  This format is also protected by a 7-bit CRC.

6.8.3.2.  General CO

6.8.2.2.  co_repair Header Format

   The CO packets communicate irregularities in the ROHCv2 co_repair packet header.  All
   CO packets carry a CRC and can update has the context.

   The general format for a compressed header is as follows: following format:

        0   1   2   3   4   5   6   7
       --- --- --- --- --- --- --- ---
      :         Add-CID octet         : if for small CIDs and CID 1-15
      +---+---+---+---+---+---+---+---+
      |  first octet of base header 1   1   1   1   1   0   1   1 | (with type indication) discriminator
      +---+---+---+---+---+---+---+---+
      :                               :
      /   0, 1, or 2 octets of CID    / 1-2 octets if large CIDs
      :                               :
      +---+---+---+---+---+---+---+---+
      |r1 |         CRC-7             |
      +---+---+---+---+---+---+---+---+
      |        r2         |   CRC-3   |
      +---+---+---+---+---+---+---+---+
      |                               |
      /   remainder of base header         Dynamic chain         / variable number of octets
   +---+---+---+---+---+---+---+---+
   :                               : length
      |                               |
       - - - - - - - - - - - - - - - -
      |                               |
      /        Irregular Chain            Payload            / variable
   :                               :
    --- --- --- --- --- --- --- ---

   The base header in length
      |                               |
       - - - - - - - - - - - - - - - -

      r1: MUST be set to zero; otherwise, the figure above is decompressor MUST discard
      the compressed representation
   of packet.

      CRC-7: A 7-bit CRC over the innermost IP header and other header(s), if any, entire uncompressed header, computed
      using the crc7(data_value, data_length) encoding method defined in
      Section 6.8.2.4, where data_value corresponds to the entire
      uncompressed packet.

   Upon receiving other types header chain and data_length the length of packet, this
      header chain.

      r2: MUST be set to zero; otherwise, the decompressor will
   decompress it.  The decompressor MUST verify discard
      the correctness packet.

      CRC-3: See Section 6.6.11.

      Dynamic chain: See Section 6.5.

      Payload: The payload of the
   decompressed packet corresponding original packet, if any.
      The payload consists of all data after the last octet of the last
      header compressed by CRC check.  If this verification succeeds, the
   decompressor passes current profile.  The presence of a
      payload is inferred from the decompressed packet to the system's network
   layer. length.

6.8.2.3.  General CO Header Format

   The decompressor will then use this CO packets communicate irregularities in the packet as header.  All
   CO packets carry a CRC and can update the reference
   packet.

   The entire set of base headers are context.  All CO formats
   except for co_repair which is defined using the ROHC Formal
   notation [I-D.ietf-rohc-formal-notation] in Section 6.8.2.2 use the remainder of
   general format defined in this section.

// TODO:
// - PT_0/PT_1 packets? Use "tbc-optimized" or "msn-optimized"

////////////////////////////////////////////
// Constants
////////////////////////////////////////////

// IP-ID behavior constants
IP_ID_BEHAVIOR_SEQUENTIAL         = 0;

   The general format for a compressed header is as follows:

        0   1   2   3   4   5   6   7
       --- --- --- --- --- --- --- ---
      :         Add-CID octet         : if for small CIDs and CID 1-15
      +---+---+---+---+---+---+---+---+
      |  first octet of base header   | (with type indication)
      +---+---+---+---+---+---+---+---+
      :                               :
      /   0, 1, or 2 octets of CID    / 1-2 octets if large CIDs
      :                               :
      +---+---+---+---+---+---+---+---+
      /   remainder of base header    / variable number of octets
      +---+---+---+---+---+---+---+---+
      :                               :
      /        Irregular Chain        / variable
      :                               :
       --- --- --- --- --- --- --- ---

   The base header in the figure above is the compressed representation
   of the innermost IP header and other header(s), if any, in the
   uncompressed packet.

   The entire set of base headers are defined in Section 6.8.2.4 using
   the ROHC Formal notation [RFC4997] .

6.8.2.4.  Header Formats in ROHC-FN

 ////////////////////////////////////////////
 // Constants
 ////////////////////////////////////////////
 // IP-ID behavior constants
 IP_ID_BEHAVIOR_SEQUENTIAL         = 0;
 IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED = 1;
 IP_ID_BEHAVIOR_RANDOM             = 2;
 IP_ID_BEHAVIOR_ZERO               = 3;

 // UDP-lite checksum coverage behavior constants
 UDP_LITE_COVERAGE_INFERRED  = 0;
 UDP_LITE_COVERAGE_STATIC    = 1;
 UDP_LITE_COVERAGE_IRREGULAR = 2;
 UDP_LITE_COVERAGE_RESERVED  = 3;

 // Variable reordering offset
 REORDERING_NONE          = 0;
 REORDERING_QUARTER       = 1;
 REORDERING_HALF          = 2;
 REORDERING_THREEQUARTERS = 3;

 // Profile names and versions
 PROFILE_RTP_0101     = 0x0101;
 PROFILE_UDP_0102     = 0x0102;
 PROFILE_ESP_0103     = 0x0103;
 PROFILE_IP_0104      = 0x0104;
 PROFILE_RTP_0107     = 0x0107; // With UDP-LITE
 PROFILE_UDPLITE_0108 = 0x0108; // Without RTP

 // Default values for RTP timestamp encoding
 TS_STRIDE_DEFAULT    = 160;
 TIME_STRIDE_DEFAULT  = 0;

 ////////////////////////////////////////////
 // Global control fields
 ////////////////////////////////////////////

 CONTROL {
   msn                 [ 16 ];
   reorder_ratio       [  2 ];
   ip_id_offset        [ 16 ]; // Used if innermost IP is IPv4
 }

 ///////////////////////////////////////////////
 // Encoding methods not specified in FN syntax:
 ///////////////////////////////////////////////

 baseheader_extension_headers       "defined in Section X.Y.Z"; 6.6.1";
 baseheader_outer_headers           "defined in Section X.Y.Z";
inferred_udp_length 6.6.2";
 control_crc3_encoding              "defined in Section X.Y.Z"; 6.6.11";
 inferred_ip_v4_header_checksum     "defined in Section X.Y.Z";
inferred_mine_header_checksum      "defined in Section X.Y.Z"; 6.6.4";
 inferred_ip_v4_length              "defined in Section X.Y.Z"; 6.6.6";
 inferred_ip_v6_length              "defined in Section X.Y.Z";
list_csrc(cc_value) 6.6.7";
 inferred_mine_header_checksum      "defined in Section X.Y.Z"; 6.6.5";
 inferred_scaled_field              "defined in Section X.Y.Z"; 6.6.10";
 inferred_sequential_ip_id          "defined in Section X.Y.Z";
control_crc3_encoding 6.6.12";
 inferred_udp_length                "defined in Section 6.6.3";
 list_csrc(cc_value)                "defined in Section X.Y.Z"; 6.6.13";
 timer_based_lsb(time_stride, k, p) "defined in Section X.Y.Z"; 6.6.9";

 ////////////////////////////////////////////
 // General encoding methods
 ////////////////////////////////////////////

 reorder_choice
 {
   UNCOMPRESSED {
     ratio [ 2 ];
   }

   DEFAULT {
     ratio =:= irregular(2);
   }

   COMPRESSED none {
     ENFORCE(ratio.UVALUE == REORDERING_NONE);
     ratio [ 2 ];
   }

   COMPRESSED quarter {
     ENFORCE(ratio.UVALUE == REORDERING_QUARTER);
     ratio [ 2 ];
   }

   COMPRESSED half {
     ENFORCE(ratio.UVALUE == REORDERING_HALF);
     ratio [ 2 ];
   }

   COMPRESSED three_quarters {
     ENFORCE(ratio.UVALUE == REORDERING_THREEQUARTERS);
     ratio [ 2 ];
   }
 }

 static_or_irreg(flag, width)
 {
   UNCOMPRESSED {
     field [ width ];
   }

   COMPRESSED irreg_enc {
     ENFORCE(flag == 1);
     field =:= irregular(width) [ width ];
   }

   COMPRESSED static_enc {
     ENFORCE(flag == 0);
     field =:= static [ 0 ];
   }
 }

 optional_32(flag)
 {
   UNCOMPRESSED {
     item [ 0, 32 ];
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     item =:= irregular(32) [ 32 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     item =:= compressed_value(0, 0) [ 0 ];
   }
 }

 // Send the entire value, or keep previous value
 sdvl_or_static(flag)
 {
   UNCOMPRESSED {
     field [ 32 ];
   }

   COMPRESSED present_7bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^7);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '0' [ 1 ];
     field                 [ 7 ];
   }

   COMPRESSED present_14bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^14);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '10'   [  2 ];
     field                    [ 14 ];
   }

   COMPRESSED present_21bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^21);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '110'  [  3 ];
     field                    [ 21 ];
   }

   COMPRESSED present_28bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^28);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '1110'  [  4 ];
     field                     [ 28 ];
   }

   COMPRESSED present_32bit {
     ENFORCE(flag == 1);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '11111111'  [  8 ];
     field                         [ 32 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     field =:= static;
   }
 }

lsb_7_or_31

 // Send the entire value, or revert to default value
 sdvl_or_default(flag, default_value)
 {
   UNCOMPRESSED {
    item
     field [ 32 ];
   }

   COMPRESSED lsb_7 present_7bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^7);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '0' [ 1 ];
    item          =:= lsb(7, ((2^7) / 4) - 1)
     field                 [ 7 ];
   }
   COMPRESSED lsb_31 present_14bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^14);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '1' '10'   [ 1  2 ];
    item          =:= lsb(31, ((2^31) / 4) - 1)
     field                    [ 31 14 ];
   }
}

crc3(data_value, data_length)

   COMPRESSED present_21bit {
  UNCOMPRESSED
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^21);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '110'  [  3 ];
     field                    [ 21 ];
   }

   COMPRESSED present_28bit {
     ENFORCE(flag == 1);
     ENFORCE(field.UVALUE < 2^28);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '1110'  [  4 ];
     field                     [ 28 ];
   }

   COMPRESSED present_32bit {
     ENFORCE(flag == 1);
     ENFORCE(field.CVALUE == field.UVALUE);
     discriminator =:= '11111111'  [  8 ];
     field                         [ 32 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     field =:= uncompressed_value(32, default_value);
   }
 }

 lsb_7_or_31
 {
   UNCOMPRESSED {
     item [ 32 ];
   }

   COMPRESSED lsb_7 {
     discriminator =:= '0'                       [  1 ];
     item          =:= lsb(7, ((2^7) / 4) - 1)   [  7 ];
   }
   COMPRESSED lsb_31 {
     discriminator =:= '1'                       [  1 ];
     item          =:= lsb(31, ((2^31) / 4) - 1) [ 31 ];
   }
 }

 crc3(data_value, data_length)
 {
   UNCOMPRESSED {
   }

   COMPRESSED {
     crc_value =:= crc(3, 0x06, 0x07, data_value, data_length) [ 3 ];
   }
 }

 crc7(data_value, data_length)
 {
   UNCOMPRESSED {
   }

   COMPRESSED {
     crc_value =:= crc(7, 0x79, 0x7f, data_value, data_length) [ 7 ];
   }
 }

 // Encoding method for updating a scaled field and its associated
 // control fields. Should be used both when the value is scaled
 // or unscaled in a compressed format.
 field_scaling(stride_value, scaled_value, unscaled_value)
 {
   UNCOMPRESSED {
     residue_field [ 32 ];
   }

   COMPRESSED no_scaling {
     ENFORCE(stride_value == 0);
     ENFORCE(residue_field.UVALUE == unscaled_value);
     ENFORCE(scaled_value == 0);
   }

   COMPRESSED scaling_used {
     ENFORCE(stride_value != 0);
     ENFORCE(residue_field.UVALUE == (unscaled_value % stride_value));
     ENFORCE(unscaled_value ==
             scaled_value * stride_value + residue_field.UVALUE);
   }
 }
 ////////////////////////////////////////////
 // IPv6 Destination options header
 ////////////////////////////////////////////

ip_dest_opt(repair_flag)

 ip_dest_opt
 {
   UNCOMPRESSED {
     next_header [ 8 ];
     length      [ 8 ];
     value       [ length.UVALUE * 64 + 48 ];
   }

   DEFAULT {
     length      =:= static;
     next_header =:= static;
     value       =:= static;
   }

   COMPRESSED dest_opt_static {
     next_header =:= irregular(8) [ 8 ];
     length      =:= irregular(8) [ 8 ];
   }

   COMPRESSED dest_opt_dynamic {
     value =:=
       irregular(length.UVALUE * 64 + 48) [ length.UVALUE * 64 + 48 ];
   }

   COMPRESSED dest_opt_irregular {
    ENFORCE(repair_flag == 0);
  }

  COMPRESSED dest_opt_repair_irregular {
    ENFORCE(repair_flag == 1);
    value =:=
      irregular(length.UVALUE * 64 + 48) [ length.UVALUE * 64 + 48 ];
   }

 }

 ////////////////////////////////////////////
 // IPv6 Hop-by-Hop options header
 ////////////////////////////////////////////

ip_hop_opt(repair_flag)

 ip_hop_opt
 {
   UNCOMPRESSED {
     next_header [ 8 ];
     length      [ 8 ];
     value       [ length.UVALUE * 64 + 48 ];
   }

   DEFAULT {
     length      =:= static;
     next_header =:= static;
     value       =:= static;
   }

   COMPRESSED hop_opt_static {
     next_header =:= irregular(8) [ 8 ];
     length      =:= irregular(8) [ 8 ];
   }

   COMPRESSED hop_opt_dynamic {
     value =:=
       irregular(length.UVALUE*64+48) [ length.UVALUE * 64 + 48 ];
   }

   COMPRESSED hop_opt_irregular {
    ENFORCE(repair_flag == 0);
  }

  COMPRESSED hop_opt_repair_irregular {
    ENFORCE(repair_flag == 1);
    value =:=
      irregular(length.UVALUE * 64 + 48) [ length.UVALUE * 64 + 48 ];
   }

 }

 ////////////////////////////////////////////
 // IPv6 Routing header
 ////////////////////////////////////////////

 ip_rout_opt
 {
   UNCOMPRESSED {
     next_header [ 8 ];
     length      [ 8 ];
     value       [ length.UVALUE * 64 + 48 ];
   }

   DEFAULT {
     length      =:= static;
     next_header =:= static;
     value       =:= static;
   }

   COMPRESSED rout_opt_static {
     next_header =:= irregular(8)                   [ 8 ];
     length      =:= irregular(8)                   [ 8 ];
     value       =:=
       irregular(length.UVALUE*64+48) [ length.UVALUE * 64 + 48 ];
   }

   COMPRESSED rout_opt_dynamic {
   }

   COMPRESSED rout_opt_irregular {
   }
 }

 ////////////////////////////////////////////
 // GRE Header
 ////////////////////////////////////////////

 optional_lsb_7_or_31(flag)
 {
   UNCOMPRESSED {
     item [ 0, 32 ];
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     item =:= lsb_7_or_31 [ 8, 32 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     item =:= compressed_value(0, 0) [ 0 ];
   }
 }

 optional_checksum(flag_value)
 {
   UNCOMPRESSED {
     value     [ 0, 16 ];
     reserved1 [ 0, 16 ];
   }

   COMPRESSED cs_present {
     ENFORCE(flag_value == 1);
     value     =:= irregular(16)             [ 16 ];
     reserved1 =:= uncompressed_value(16, 0) [  0 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag_value == 0);
     value     =:= compressed_value(0, 0) [ 0 ];
     reserved1 =:= compressed_value(0, 0) [ 0 ];
   }
 }

 gre_proto
 {
   UNCOMPRESSED {
     protocol [ 16 ];
   }
   COMPRESSED ether_v4 {
     discriminator =:= compressed_value(1, 0)         [ 1 ];
     protocol      =:= uncompressed_value(16, 0x0800) [ 0 ];
   }

   COMPRESSED ether_v6 {
     discriminator =:= compressed_value(1, 1)         [ 1 ];
     protocol      =:= uncompressed_value(16, 0x86DD) [ 0 ];
   }
 }

gre(repair_flag)

 gre
 {
   UNCOMPRESSED {
     c_flag                                 [  1 ];
     r_flag    =:= uncompressed_value(1, 0) [  1 ];
     k_flag                                 [  1 ];
     s_flag                                 [  1 ];
     reserved0 =:= uncompressed_value(9, 0) [  9 ];
     version   =:= uncompressed_value(3, 0) [  3 ];
     protocol                               [ 16 ];
     checksum_and_res                       [ 0, 32 ];
     key                                    [ 0, 32 ];
     sequence_number                        [ 0, 32 ];
   }

   DEFAULT {
     c_flag           =:= static;
     k_flag           =:= static;
     s_flag           =:= static;
     protocol         =:= static;
     key              =:= static;
     sequence_number  =:= static;
   }

   COMPRESSED gre_static {
     protocol =:= gre_proto                  [ 1 ];
     c_flag   =:= irregular(1)               [ 1 ];
     k_flag   =:= irregular(1)               [ 1 ];
     s_flag   =:= irregular(1)               [ 1 ];
     padding  =:= compressed_value(4, 0)     [ 4 ];
     key      =:= optional_32(k_flag.UVALUE) [ 0, 32 ];
   }

   COMPRESSED gre_dynamic {
     checksum_and_res =:=
       optional_checksum(c_flag.UVALUE)              [ 0, 16 ];
     sequence_number  =:= optional_32(s_flag.UVALUE) [ 0, 32 ];
   }

   COMPRESSED gre_irregular {
    ENFORCE(repair_flag == 0);
     checksum_and_res =:= optional_checksum(c_flag.UVALUE) [ 0, 16 ];
     sequence_number  =:=
       optional_lsb_7_or_31(s_flag.UVALUE)           [ 0, 8, 32 ];
   }

  COMPRESSED gre_repair_irregular {
    ENFORCE(repair_flag == 1);
    checksum_and_res =:= optional_checksum(c_flag.UVALUE) [ 0, 16 ];
    sequence_number  =:= optional_32(s_flag.UVALUE) [ 0, 32 ];
  }

 }

 /////////////////////////////////////////////
 // MINE header
 /////////////////////////////////////////////

 mine
 {
   UNCOMPRESSED {
     next_header [  8 ];
     s_bit       [  1 ];
     res_bits    [  7 ];
     checksum    [ 16 ];
     orig_dest   [ 32 ];
     orig_src    [ 0, 32 ];
   }

   DEFAULT {
     next_header =:= static;
     s_bit       =:= static;
     res_bits    =:= static;
     checksum    =:= inferred_mine_header_checksum;
     orig_dest   =:= static;
     orig_src    =:= static;
   }

   COMPRESSED mine_static {
     next_header =:= irregular(8)              [  8 ];
     s_bit       =:= irregular(1)              [  1 ];
     // Reserved bits are included to achieve byte-alignment
     res_bits    =:= irregular(7)              [  7 ];
     orig_dest   =:= irregular(32)             [ 32 ];
     orig_src    =:= optional_32(s_bit.UVALUE) [ 0, 32 ];
   }

   COMPRESSED mine_dynamic {
   }

   COMPRESSED mine_irregular {
   }
 }

 /////////////////////////////////////////////
 // Authentication Header (AH)
 /////////////////////////////////////////////

ah(repair_flag)

 ah
 {
   UNCOMPRESSED {
     next_header                            [  8 ];
     length                                 [  8 ];
     res_bits =:= uncompressed_value(16, 0) [ 16 ];
     spi                                    [ 32 ];
     sequence_number                        [ 32 ];
    auth_data
     icv                   [ length.UVALUE*32-32 ];
   }

   DEFAULT {
     next_header     =:= static;
     length          =:= static;
    res_bits        =:= static;
     spi             =:= static;
     sequence_number =:= static;
   }

   COMPRESSED ah_static {
     next_header =:= irregular(8)      [  8 ];
     length      =:= irregular(8)      [  8 ];
     spi         =:= irregular(32)     [ 32 ];
   }

   COMPRESSED ah_dynamic {
     sequence_number =:= irregular(32) [ 32 ];
    auth_data
     icv       =:=
       irregular(length.UVALUE*32-32)  [ length.UVALUE*32-32 ];
   }

   COMPRESSED ah_irregular {
    ENFORCE(repair_flag == 0);
     sequence_number =:= lsb_7_or_31   [ 8, 32 ];
    auth_data       =:=
      irregular(length.UVALUE*32-32) [ length.UVALUE*32-32 ];
  }

  COMPRESSED ah_repair_irregular {
    ENFORCE(repair_flag == 1);
    res_bits        =:= irregular(16) [ 16 ];
    sequence_number =:= irregular(32) [ 32 ];
    auth_data
     icv       =:=
       irregular(length.UVALUE*32-32)  [ length.UVALUE*32-32 ];
   }

 }

 /////////////////////////////////////////////
 // ESP header (NULL encrypted)
 /////////////////////////////////////////////
 // The value of the next header field from the trailer
 // part of the packet is passed as a parameter.
esp_null(next_header_value, repair_flag)
 esp_null(next_header_value)
 {
   UNCOMPRESSED {
     spi             [ 32 ];
     sequence_number [ 32 ];
   }

   CONTROL {
     nh_field [ 8 ];
   }

   DEFAULT {
     spi             =:= static;
     sequence_number =:= static;
     nh_field        =:= static;
   }

   COMPRESSED esp_static {
     nh_field =:= compressed_value(8, next_header_value) [  8 ];
     spi      =:= irregular(32)                          [ 32 ];
   }

   COMPRESSED esp_dynamic {
     sequence_number =:= irregular(32) [ 32 ];
   }

   COMPRESSED esp_irregular {
    ENFORCE(repair_flag == 0);
     sequence_number =:= lsb_7_or_31 [ 8, 32 ];
   }

  COMPRESSED esp_repair_irregular {
    ENFORCE(repair_flag == 1);
    sequence_number =:= irregular(32) [ 32 ];
  }

 }

 /////////////////////////////////////////////
 // IPv6 Header
 /////////////////////////////////////////////

 fl_enc
 {
   UNCOMPRESSED {
     flow_label [ 20 ];
   }

   COMPRESSED fl_zero {
     discriminator =:= '0'                       [ 1 ];
     flow_label    =:= uncompressed_value(20, 0) [ 0 ];
     reserved      =:= '0000'                    [ 4 ];
   }

   COMPRESSED fl_non_zero {
     discriminator =:= '1'           [  1 ];
     flow_label    =:= irregular(20) [ 20 ];
   }
 }

 ipv6(profile, is_innermost, ip_outer_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED {
     version         =:= uncompressed_value(4, 6) [   4 ];
     tos_tc                                       [   8 ];
     flow_label                                   [  20 ];
     payload_length                               [  16 ];
     next_header                                  [   8 ];
     ttl_hopl                                     [   8 ];
     src_addr                                     [ 128 ];
     dst_addr                                     [ 128 ];
   }

   DEFAULT {
     tos_tc         =:= static;
     flow_label     =:= static;
     payload_length =:= inferred_ip_v6_length;
     next_header    =:= static;
     ttl_hopl       =:= static;
     src_addr       =:= static;
     dst_addr       =:= static;
   }

   COMPRESSED ipv6_static {
     version_flag        =:= '1'            [   1 ];
     reserved            =:= '00'           [   2 ];
     flow_label          =:= fl_enc         [ 5, 21 ];
     next_header         =:= irregular(8)   [   8 ];
     src_addr            =:= irregular(128) [ 128 ];
     dst_addr            =:= irregular(128) [ 128 ];
   }

   COMPRESSED ipv6_endpoint_static {
     ENFORCE((is_innermost == 1) &&
             (profile == PROFILE_IP_0104));
     version_flag        =:= '1'                    [   1 ];
     innermost_indicator =:= compressed_value(1, 1) [   1 ];
     reserved            =:= '0'                    [   1 ];
     flow_label          =:= fl_enc                 [ 5, 21 ];
     next_header         =:= irregular(8)           [   8 ];
     src_addr            =:= irregular(128)         [ 128 ];
     dst_addr            =:= irregular(128)         [ 128 ];
   }

   COMPRESSED ipv6_endpoint_dynamic {
     ENFORCE((is_innermost == 1) &&
             (profile == PROFILE_IP_0104));
     tos_tc        =:= irregular(8)           [  8 ];
     ttl_hopl      =:= irregular(8)           [  8 ];
     reserved      =:= compressed_value(6, 0) [  6 ];
     reorder_ratio =:= reorder_choice         [  2 ];
     msn           =:= irregular(16)          [ 16 ];
   }

   COMPRESSED ipv6_regular_dynamic {
     ENFORCE((is_innermost == 0) ||
             (profile != PROFILE_IP_0104));
     tos_tc       =:= irregular(8) [ 8 ];
     ttl_hopl     =:= irregular(8) [ 8 ];
   }

   COMPRESSED ipv6_outer_irregular {
    ENFORCE(repair_flag == 0);
     ENFORCE(is_innermost == 0);
     tos_tc       =:=
        static_or_irreg(ip_outer_flag,
         static_or_irreg(outer_ip_flag, 8) [ 0, 8 ];
     ttl_hopl     =:=
        static_or_irreg(ip_outer_flag,
         static_or_irreg(outer_ip_flag, 8) [ 0, 8 ];
   }

   COMPRESSED ipv6_innermost_irregular {
    ENFORCE(repair_flag == 0);
     ENFORCE(is_innermost == 1);
   }

 }

 /////////////////////////////////////////////
 // IPv4 Header
 /////////////////////////////////////////////

 ip_id_enc_dyn(behavior)
 {
   UNCOMPRESSED {
     ip_id [ 16 ];
   }

   COMPRESSED ipv6_outer_repair_irregular ip_id_seq {
    ENFORCE(repair_flag == 1);
    ENFORCE(is_innermost
     ENFORCE((behavior == 0);
    tos_tc =:= static_or_irreg(ip_outer_flag, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ip_outer_flag, 8) [ 0, 8 ];
  }

  COMPRESSED ipv6_innermost_repair_irregular {
    ENFORCE(repair_flag IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (behavior == 1);
    ENFORCE(is_innermost IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     ENFORCE(ip_id_offset.UVALUE == 1);
  }
}

/////////////////////////////////////////////
// IPv4 Header
/////////////////////////////////////////////

ip_id_enc_dyn(behavior)
{
  UNCOMPRESSED { ip_id.UVALUE - msn.UVALUE);
     ip_id =:= irregular(16) [ 16 ];
   }

   COMPRESSED ip_id_seq ip_id_random {
    ENFORCE((behavior == IP_ID_BEHAVIOR_SEQUENTIAL) ||
            (behavior == IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED) ||
            (behavior
     ENFORCE(behavior == IP_ID_BEHAVIOR_RANDOM)); IP_ID_BEHAVIOR_RANDOM);
     ip_id =:= irregular(16) [ 16 ];
   }

   COMPRESSED ip_id_zero {
     ENFORCE(behavior == IP_ID_BEHAVIOR_ZERO);
     ip_id =:= uncompressed_value(16, 0) [ 0 ];
   }
 }

 ip_id_enc_irreg(behavior)
 {
   UNCOMPRESSED {
     ip_id [ 16 ];
   }

   COMPRESSED ip_id_seq {
     ENFORCE(behavior == IP_ID_BEHAVIOR_SEQUENTIAL);
   }

   COMPRESSED ip_id_seq_swapped {
     ENFORCE(behavior == IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED);
   }

   COMPRESSED ip_id_rand {
     ENFORCE(behavior == IP_ID_BEHAVIOR_RANDOM);
     ip_id =:= irregular(16) [ 16 ];
   }

   COMPRESSED ip_id_zero {
     ENFORCE(behavior == IP_ID_BEHAVIOR_ZERO);
     ip_id =:= uncompressed_value(16, 0) [ 0 ];
   }
 }

 ip_id_behavior_choice(is_inner)
 {
   UNCOMPRESSED {
     behavior [ 2 ];
   }

   DEFAULT {
     behavior =:= irregular(2);
   }

   COMPRESSED sequential {
     ENFORCE(is_inner == 1);
     ENFORCE(behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL);
     behavior [ 2 ];
   }

   COMPRESSED sequential_swapped {
     ENFORCE(is_inner == 1);
     ENFORCE(behavior.UVALUE ==
             IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED);
     behavior [ 2 ];
   }

   COMPRESSED random {
     ENFORCE(behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     behavior [ 2 ];
   }

   COMPRESSED zero {
     ENFORCE(behavior.UVALUE == IP_ID_BEHAVIOR_ZERO);
     behavior [ 2 ];
   }
 }

variable_ipv4_fields(flag)
{
  UNCOMPRESSED {
    df             [ 1 ];
    ip_id_behavior [ 2 ];
  }

  COMPRESSED not_present {
    ENFORCE(flag == 0);
    df             =:= static;
    ip_id_behavior =:= static;
  }

  COMPRESSED present {
    ENFORCE(flag == 1);
    reserved       =:= '00000'                  [ 5 ];
    df             =:= irregular(1)             [ 1 ];
    ip_id_behavior =:= ip_id_behavior_choice(0) [ 2 ];
  }
}

 ipv4(profile, is_innermost, ip_outer_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED {
     version     =:= uncompressed_value(4, 4)       [  4 ];
     hdr_length  =:= uncompressed_value(4, 5)       [  4 ];
     tos_tc                                         [  8 ];
     length      =:= inferred_ip_v4_length          [ 16 ];
     ip_id                                          [ 16 ];
     rf          =:= uncompressed_value(1, 0)       [  1 ];
     df                                             [  1 ];
     mf          =:= uncompressed_value(1, 0)       [  1 ];
     frag_offset =:= uncompressed_value(13, 0)      [ 13 ];
     ttl_hopl                                       [  8 ];
     protocol                                       [  8 ];
     checksum    =:= inferred_ip_v4_header_checksum [ 16 ];
     src_addr                                       [ 32 ];
     dst_addr                                       [ 32 ];
   }

   CONTROL {
     ip_id_behavior [ 2 ];
   }
   DEFAULT {
     tos_tc         =:= static;
     df             =:= static;
     ttl_hopl       =:= static;
     protocol       =:= static;
     src_addr       =:= static;
     dst_addr       =:= static;
     ip_id_behavior =:= static;
   }

   COMPRESSED ipv4_static {
     version_flag        =:= '0'           [  1 ];
     reserved            =:= '0000000'     [  7 ];
     protocol            =:= irregular(8)  [  8 ];
     src_addr            =:= irregular(32) [ 32 ];
     dst_addr            =:= irregular(32) [ 32 ];
   }

   COMPRESSED ipv4_endpoint_static {
     ENFORCE((is_innermost == 1) &&
             (profile == PROFILE_IP_0104));
     version_flag        =:= '0'                    [  1 ];
     innermost_indicator =:= compressed_value(1, 1) [  1 ];
     reserved            =:= '000000'               [  6 ];
     protocol            =:= irregular(8)           [  8 ];
     src_addr            =:= irregular(32)          [ 32 ];
     dst_addr            =:= irregular(32)          [ 32 ];
   }

   COMPRESSED ipv4_endpoint_dynamic {
     ENFORCE((is_innermost == 1) &&
             (profile == PROFILE_IP_0104));
     reserved       =:= '000'                               [  3 ];
     reorder_ratio  =:= reorder_choice                      [  2 ];
     df             =:= irregular(1)                        [  1 ];
     ip_id_behavior =:= ip_id_behavior_choice(is_innermost) [  2 ];
     tos_tc         =:= irregular(8)                        [  8 ];
     ttl_hopl       =:= irregular(8)                        [  8 ];
     ip_id =:= ip_id_enc_dyn(ip_id_behavior.UVALUE)      [ 0, 16 ];
     msn            =:= irregular(16)                       [ 16 ];
   }

   COMPRESSED ipv4_regular_dynamic {
     ENFORCE((is_innermost == 0) ||
             (profile != PROFILE_IP_0104));
     reserved       =:= '00000'                             [ 5 ];
     df             =:= irregular(1)                        [ 1 ];
     ip_id_behavior =:= ip_id_behavior_choice(is_innermost) [ 2 ];
     tos_tc         =:= irregular(8)                        [ 8 ];
     ttl_hopl       =:= irregular(8)                        [ 8 ];
     ip_id =:= ip_id_enc_dyn(ip_id_behavior.UVALUE)     [ 0, 16 ];
   }

   COMPRESSED ipv4_outer_irregular {
    ENFORCE(repair_flag == 0);
     ENFORCE(is_innermost == 0);
     ip_id    =:= ip_id_enc_irreg(ip_id_behavior.UVALUE) [ 0, 16 ];
     tos_tc   =:= static_or_irreg(ip_outer_flag, static_or_irreg(outer_ip_flag, 8)      [  0, 8 ];
     ttl_hopl =:= static_or_irreg(ip_outer_flag, static_or_irreg(outer_ip_flag, 8)      [  0, 8 ];
   }

   COMPRESSED ipv4_innermost_irregular {
    // Same format for repair and non-repair
     ip_id =:= ip_id_enc_irreg(ip_id_behavior.UVALUE)    [ 0, 16 ];
     ENFORCE(is_innermost == 1);
   }

  COMPRESSED ipv4_outer_repair_irregular {
    ENFORCE(repair_flag == 1);
    ENFORCE(is_innermost == 0);
    df : ip_id_behavior =:=
      variable_ipv4_fields(outer_flag) [ 0, 8 ];
    ip_id =:= ip_id_enc_irreg(ip_id_behavior.UVALUE) [ 0, 16 ];
    tos_tc   =:= static_or_irreg(ip_outer_flag, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ip_outer_flag, 8) [ 0, 8 ];
  }

 }

 /////////////////////////////////////////////
 // UDP Header
 /////////////////////////////////////////////

 udp(profile)
 {
   UNCOMPRESSED {
     ENFORCE((profile == PROFILE_RTP_0101) ||
             (profile == PROFILE_UDP_0102));
     src_port                           [ 16 ];
     dst_port                           [ 16 ];
     udp_length =:= inferred_udp_length [ 16 ];
     checksum                           [ 16 ];
   }

   CONTROL {
     checksum_used [ 1 ];
   }

   DEFAULT {
     src_port   =:= static;
     dst_port   =:= static;
    checksum   =:= irregular(16);
   }

   COMPRESSED udp_static {
     src_port   =:= irregular(16) [ 16 ];
     dst_port   =:= irregular(16) [ 16 ];
   }
   COMPRESSED udp_endpoint_dynamic {
     ENFORCE(profile == PROFILE_UDP_0102);
     ENFORCE(checksum_used.UVALUE == (checksum.UVALUE != 0));
     checksum      =:= irregular(16)          [ 16 ];
     msn           =:= irregular(16)          [ 16 ];
     reserved      =:= compressed_value(6, 0) [  6 ];
     reorder_ratio =:= reorder_choice         [  2 ];
   }

   COMPRESSED udp_regular_dynamic {
     ENFORCE(profile == PROFILE_RTP_0101);
     ENFORCE(checksum_used == (checksum.UVALUE != 0));
     checksum =:= irregular(16) [ 16 ];
   }

   COMPRESSED udp_zero_checksum_irregular {
    ENFORCE(checksum.UVALUE
     ENFORCE(checksum_used.UVALUE == 0);
     checksum =:= uncompressed_value(16, 0)   [ 0 ];
   }

   COMPRESSED udp_with_checksum_irregular {
    ENFORCE(checksum.UVALUE != 0);
     ENFORCE(checksum_used.UVALUE == 1);
     checksum =:= irregular(16) [ 16 ];
   }

 }

 /////////////////////////////////////////////
 // RTP Header
 /////////////////////////////////////////////

 csrc_list_dynchain(presence, cc_value)
 {
   UNCOMPRESSED {
     csrc_list;
   }

   COMPRESSED no_list {
     ENFORCE(cc_value == 0);
     ENFORCE(presence == 0);
     csrc_list =:= uncompressed_value(0, 0) [ 0 ];
   }

   COMPRESSED list_present {
     ENFORCE(presence == 1);
     csrc_list =:= list_csrc(cc_value) [ VARIABLE ];
   }
 }
 rtp(profile, ts_stride_value, time_stride_value)
 {
   UNCOMPRESSED {
     ENFORCE((profile == PROFILE_RTP_0101) ||
             (profile == PROFILE_RTP_0107));
     rtp_version =:= uncompressed_value(2, 0) [  2 ];
     pad_bit                                  [  1 ];
     extension                                [  1 ];
     cc                                       [  4 ];
     marker                                   [  1 ];
     payload_type                             [  7 ];
     sequence_number                          [ 16 ];
     timestamp                                [ 32 ];
     ssrc                                     [ 32 ];
     csrc_list                                [ cc.UVALUE * 32 ];
   }

   CONTROL {
     ENFORCE(time_stride_value == time_stride.UVALUE);
     ENFORCE(ts_stride_value == ts_stride.UVALUE);
     ts_stride                           [ 32 ];
     time_stride                         [ 32 ];
     ts_scaled                           [ 32 ];
     ts_offset =:=
         field_scaling(ts_stride.UVALUE, ts_scaled.UVALUE,
                       timestamp.UVALUE) [ 32 ];
   }

   INITIAL {
     ts_stride     =:= uncompressed_value(32, 0); TS_STRIDE_DEFAULT);
     time_stride   =:= uncompressed_value(32, 0); TIME_STRIDE_DEFAULT);
   }

   DEFAULT {
     ENFORCE(msn.UVALUE == sequence_number.UVALUE);
     pad_bit         =:= static;
     extension       =:= static;
     cc              =:= static;
     marker          =:= static;
     payload_type    =:= static;
     sequence_number =:= static;
     timestamp       =:= static;
     ssrc            =:= static;
     csrc_list       =:= static;
   }

   COMPRESSED rtp_static {
     ssrc            =:= irregular(32)  [ 32 ];
   }

   COMPRESSED rtp_dynamic {
     reserved        =:= compressed_value(1, 0)       [  1 ];
     reorder_ratio   =:= reorder_choice               [  2 ];
     list_present    =:= irregular(1)                 [  1 ];
     tss_indicator   =:= irregular(1)                 [  1 ];
     tis_indicator   =:= irregular(1)                 [  1 ];
     pad_bit         =:= irregular(1)                 [  1 ];
     extension       =:= irregular(1)                 [  1 ];
     marker          =:= irregular(1)                 [  1 ];
     payload_type    =:= irregular(7)                 [  7 ];
     sequence_number =:= irregular(16)                [ 16 ];
     timestamp       =:= irregular(32)                [ 32 ];
     ts_stride       =:= sdvl_or_static(tss_indicator) sdvl_or_default(tss_indicator,
       TS_STRIDE_DEFAULT)                             [ VARIABLE ];
     time_stride     =:= sdvl_or_static(tis_indicator) sdvl_or_default(tis_indicator,
       TIME_STRIDE_DEFAULT)                           [ VARIABLE ];
     csrc_list   =:=
         csrc_list_dynchain(list_present, cc.UVALUE)  [ VARIABLE ];
   }

   COMPRESSED rtp_irregular {
   }
 }

 /////////////////////////////////////////////
 // UDP-Lite Header
 /////////////////////////////////////////////

 checksum_coverage_dynchain(behavior)
 {
   UNCOMPRESSED {
     checksum_coverage [ 16 ];
   }

   COMPRESSED inferred_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_INFERRED);
     checksum_coverage =:= inferred_udp_length [  0 ];
   }

   COMPRESSED static_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_STATIC);
     checksum_coverage =:= irregular(16)       [ 16 ];
   }

   COMPRESSED irregular_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_IRREGULAR);
     checksum_coverage =:= irregular(16)       [ 16 ];
   }
 }

 checksum_coverage_irregular(behavior)
 {
   UNCOMPRESSED {
     checksum_coverage [ 16 ];
   }

   COMPRESSED inferred_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_INFERRED);
     checksum_coverage =:= inferred_udp_length [  0 ];
   }

   COMPRESSED static_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_STATIC);
     checksum_coverage =:= static              [  0 ];
   }

   COMPRESSED irregular_coverage {
     ENFORCE(behavior == UDP_LITE_COVERAGE_IRREGULAR);
     checksum_coverage =:= irregular(16)       [ 16 ];
   }
 }

 udp_lite(profile)
 {
   UNCOMPRESSED {
     ENFORCE((profile == PROFILE_RTP_0107) ||
             (profile == PROFILE_UDPLITE_0108));
     src_port          [ 16 ];
     dst_port          [ 16 ];
     checksum_coverage [ 16 ];
     checksum          [ 16 ];
   }

   CONTROL {
     coverage_behavior [ 2 ];
   }

   DEFAULT {
     src_port          =:= static;
     dst_port          =:= static;
    checksum_coverage =:= irregular(16);
    checksum          =:= irregular(16);
   }

   COMPRESSED udp_lite_static {
     src_port   =:= irregular(16) [ 16 ];
     dst_port   =:= irregular(16) [ 16 ];
   }

   COMPRESSED udp_lite_endpoint_dynamic {
     ENFORCE(profile == PROFILE_UDPLITE_0108);
     reserved =:= compressed_value(4, 0)                      [  4 ];
     coverage_behavior =:= irregular(2)                       [  2 ];
     reorder_ratio     =:= reorder_choice                     [  2 ];
     checksum_coverage =:=
       checksum_coverage_dynchain(coverage_behavior.UVALUE)   [ 16 ];
     checksum          =:= irregular(16)                      [ 16 ];
     msn               =:= irregular(16)                      [ 16 ];
   }

   COMPRESSED udp_lite_regular_dynamic {
     coverage_behavior =:= irregular(2)                       [  2 ];
     reserved =:= compressed_value(6, 0)                      [  6 ];
     checksum_coverage =:=
         checksum_coverage_dynchain(coverage_behavior.UVALUE) [ 16 ];
     checksum =:= irregular(16)                               [ 16 ];
   }

   COMPRESSED udp_lite_irregular {
     checksum_coverage =:=
      checksum_coverage_dynchain(coverage_behavior.UVALUE)
       checksum_coverage_irregular(coverage_behavior.UVALUE) [ 0, 16 ];
     checksum          =:= irregular(16)                     [ 16 ];
   }
 }

 /////////////////////////////////////////////
 // ESP Header (Non-NULL encrypted
 // i.e. only used for the ESP profile)
 /////////////////////////////////////////////

 esp(profile)
 {
   UNCOMPRESSED {
     ENFORCE(profile == PROFILE_ESP_0103);
     ENFORCE(msn.UVALUE == sequence_number.UVALUE % 65536);
     spi             [ 32 ];
     sequence_number [ 32 ];
   }

   DEFAULT {
    ENFORCE(msn.UVALUE == sequence_number.UVALUE % 65536);
     spi             =:= static;
     sequence_number =:= static;
   }
   COMPRESSED esp_static {
     // Needs to be discriminated from ESP NULL headers,
     // and therefore we have a dummy protocol field here.
     discriminator =:= uncompressed_value(8, 255)  [  8 ];
     spi =:= irregular(32)                         [ 32 ];
   }

   COMPRESSED esp_dynamic {
     sequence_number =:= irregular(32)             [ 32 ];
     reserved        =:= compressed_value(6, 0)    [  6 ];
     reorder_ratio   =:= reorder_choice            [  2 ];
   }

   COMPRESSED esp_irregular {
   }
 }

 ///////////////////////////////////////////////////
 // Encoding methods used in the profiles' CO packets
 ///////////////////////////////////////////////////

 // Variable reordering offset used for MSN
 msn_lsb(k)
 {
   UNCOMPRESSED {
     master [ 16 VARIABLE ];
   }

   COMPRESSED none {
     ENFORCE(reorder_ratio.UVALUE == REORDERING_NONE);
     master =:= lsb(k, 1);
   }

   COMPRESSED quarter {
     ENFORCE(reorder_ratio.UVALUE == REORDERING_QUARTER);
     master =:= lsb(k, ((2^k) / 4) - 1);
   }

   COMPRESSED half {
     ENFORCE(reorder_ratio.UVALUE == REORDERING_HALF);
     master =:= lsb(k, ((2^k) / 2) - 1);
   }

   COMPRESSED threequarters {
     ENFORCE(reorder_ratio.UVALUE == REORDERING_THREEQUARTERS);
     master =:= lsb(k, (((2^k) * 3) / 4) - 1);
   }
 }
 ip_id_lsb(behavior, k)
 {
   UNCOMPRESSED {
     ip_id [ 16 ];
   }

   CONTROL {
    ip_id_offset [ 16 ];
     ip_id_nbo    [ 16 ];
   }

   COMPRESSED nbo {
     ENFORCE(behavior == IP_ID_BEHAVIOR_SEQUENTIAL);
     ENFORCE(ip_id_offset.UVALUE == ip_id.UVALUE - msn.UVALUE);
     ip_id_offset =:= lsb(k, ((2^k) / 4) - 1) [ k ];
   }

   COMPRESSED non_nbo {
     ENFORCE(behavior == IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED);
     ENFORCE(ip_id_nbo.UVALUE ==
             (ip_id.UVALUE / 256) + (ip_id.UVALUE % 256) * 256);
     ENFORCE(ip_id_nbo.ULENGTH == 16);
     ENFORCE(ip_id_offset.UVALUE == ip_id_nbo.UVALUE - msn.UVALUE);
     ip_id_offset =:= lsb(k, ((2^k) / 4) - 1) [ k ];
   }
 }

optional_ip_id_lsb(behavior,

 ip_id_sequential_variable(behavior, indicator)
 {
   UNCOMPRESSED {
     ip_id [ 16 ];
   }

   COMPRESSED short {
     ENFORCE((behavior == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (behavior == IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     ENFORCE(indicator == 0);
     ip_id =:= ip_id_lsb(behavior, 8) [ 8 ];
   }

   COMPRESSED long {
     ENFORCE((behavior == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (behavior == IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     ENFORCE(indicator == 1);
     ENFORCE(ip_id_offset.UVALUE == ip_id.UVALUE - msn.UVALUE);
     ip_id =:= irregular(16)  [ 16 ];
   }

   COMPRESSED not_present {
     ENFORCE((behavior == IP_ID_BEHAVIOR_RANDOM) ||
             (behavior == IP_ID_BEHAVIOR_ZERO));
   }
 }

 dont_fragment(version)
 {
   UNCOMPRESSED {
     df [ 1 ];
   }

   COMPRESSED v4 {
     ENFORCE(version == 4);
     df =:= irregular(1) [ 1 ];
   }

   COMPRESSED v6 {
     ENFORCE(version == 6);
    df
     unused =:= compressed_value(1, 0) [ 1 ];
   }
 }

optional_pt(flag)

 pt_irr_or_static(flag)
 {
   UNCOMPRESSED {
     payload_type [ 7 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     payload_type =:= static [ 0 ];
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     reserved     =:= compressed_value(1, 0) [ 1 ];
     payload_type =:= irregular(7)           [ 7 ];
   }
 }

 csrc_list_presence(presence, cc_value)
 {
   UNCOMPRESSED {
     csrc_list;
   }

   COMPRESSED no_list {
     ENFORCE(presence == 0);
     csrc_list =:= static [ 0 ];
   }

   COMPRESSED list_present {
     ENFORCE(presence == 1);
     csrc_list =:= list_csrc(cc_value) [ VARIABLE ];
   }
 }

 scaled_ts_lsb(time_stride_value, k)
 {
   UNCOMPRESSED {
     timestamp [ 32 ];
   }

   COMPRESSED timerbased {
     ENFORCE(time_stride_value != 0);
     timestamp =:= timer_based_lsb(time_stride_value, k,
                                   ((2^k) / 4) - 1);
   }

   COMPRESSED regular {
     ENFORCE(time_stride_value == 0);
     timestamp =:= lsb(k, ((2^k) / 4) - 1);
   }
 }

irregular_or_nothing(flag)
{
  UNCOMPRESSED {
    field [ 32 ];
  }

  COMPRESSED not_present {
    ENFORCE(flag == 0);
  }

  COMPRESSED present {
    ENFORCE(flag == 1);
    field =:= irregular(32);
  }
}

 // Self-describing variable length encoding
sdvl_lsb(field_width) with reordering offset
 sdvl_sn_lsb(field_width) {
   UNCOMPRESSED {
     field [ field_width ];
   }

   COMPRESSED lsb7 {
     discriminator =:= '0'   [ 1 ];
     field =:= lsb(7, ((2^7) / 4) - 1) msn_lsb(7)    [ 7 ];
   }

   COMPRESSED lsb14 {
     discriminator =:= '10'  [  2 ];
     field =:= lsb(14, ((2^14) / 4) - 1) msn_lsb(14)   [ 14 ];
   }

   COMPRESSED lsb21 {
     discriminator =:= '110'  [  3 ];
     field =:= lsb(21, ((2^21) / 4) - 1) msn_lsb(21)    [ 21 ];
   }
   COMPRESSED lsb28 {
     discriminator =:= '1110' [  4 ];
     field =:= msn_lsb(28)    [ 28 ];
   }

   COMPRESSED lsb32 {
     discriminator =:= '11111111'        [  8 ];
     field =:= irregular(field_width)    [ field_width ];
   }
 }

 // Self-describing variable length encoding
 sdvl_lsb(field_width)
 {
   UNCOMPRESSED {
     field [ field_width ];
   }

   COMPRESSED lsb7 {
     discriminator =:= '0'               [ 1 ];
     field =:= lsb(7, ((2^7) / 4) - 1)   [ 7 ];
   }

   COMPRESSED lsb14 {
     discriminator =:= '10'              [  2 ];
     field =:= lsb(14, ((2^14) / 4) - 1) [ 14 ];
   }

   COMPRESSED lsb21 {
     discriminator =:= '110'             [  3 ];
     field =:= lsb(21, ((2^21) / 4) - 1) [ 21 ];
   }

   COMPRESSED lsb28 {
     discriminator =:= '1110'            [  4 ];
     field =:= lsb(28, ((2^28) / 4) - 1) [ 28 ];
   }

   COMPRESSED lsb32 {
     discriminator =:= '11111111'        [  8 ];
     field =:= irregular(field_width)    [ field_width ];
   }
 }

 variable_scaled_timestamp(tss_flag, tsc_flag, ts_stride)
 {
   UNCOMPRESSED {
     timestamp [ 32 ];
   }

   COMPRESSED present {
     ENFORCE((tss_flag == 0) && (tsc_flag == 1));
     ENFORCE(ts_stride != 0);
     timestamp =:= sdvl_lsb(32) [ VARIABLE ];
   }

   COMPRESSED not_present {
     ENFORCE(((tss_flag == 1) && (tsc_flag == 0)) ||
             ((tss_flag == 0) && (tsc_flag == 0)));
   }
 }

 variable_unscaled_timestamp(tss_flag, tsc_flag)
 {
   UNCOMPRESSED {
     timestamp [ 32 ];
   }

   COMPRESSED present {
     ENFORCE(((tss_flag == 1) && (tsc_flag == 0)) ||
             ((tss_flag == 0) && (tsc_flag == 0)));
     timestamp =:= sdvl_lsb(32);
   }

   COMPRESSED not_present {
     ENFORCE((tss_flag == 0) && (tsc_flag == 1));
   }
 }

 profile_1_7_flags1_enc(flag)
 {
   UNCOMPRESSED {
     ip_outer_indicator  [ 1 ];
    repair_indicator
     ttl_hopl_indicator  [ 1 ];
    ttl_hopl_indicator
     tos_tc_indicator    [ 1 ];
    tos_tc_indicator
     df                  [ 1 ];
     ip_id_behavior      [ 2 ];
     reorder_ratio       [ 2 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     ENFORCE(ip_outer_indicator.CVALUE == 0);
    ENFORCE(repair_indicator.CVALUE == 0);
     ENFORCE(ttl_hopl_indicator.CVALUE == 0);
     ENFORCE(tos_tc_indicator.CVALUE == 0);
     df                   =:= static;
     ip_id_behavior       =:= static;
     reorder_ratio        =:= static;
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     ip_outer_indicator  =:= irregular(1)                [ 1 ];
    repair_indicator
     ttl_hopl_indicator  =:= irregular(1)                [ 1 ];
    ttl_hopl_indicator
     tos_tc_indicator    =:= irregular(1)                [ 1 ];
    tos_tc_indicator
     df                  =:= irregular(1) dont_fragment(ip_version)   [ 1 ];
     ip_id_behavior      =:= ip_id_behavior_choice(1)    [ 2 ];
     reorder_ratio       =:= reorder_choice              [ 2 ];
   }
 }

 profile_1_flags2_enc(flag, ip_version)
 {
   UNCOMPRESSED {
     list_indicator        [ 1 ];
     pt_indicator          [ 1 ];
     pad_bit               [ 1 ];
     extension             [ 1 ];
    df                    [ 1 ];
     time_stride_indicator [ 1 ];
   }

   COMPRESSED not_present{
     ENFORCE(flag == 0);
     ENFORCE(list_indicator.UVALUE == 0);
     ENFORCE(pt_indicator.UVALUE == 0);
     ENFORCE(time_stride_indicator.UVALUE == 0);
     pad_bit      =:= static;
     extension    =:= static;
    df           =:= static;
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     list_indicator =:= irregular(1)                  [ 1 ];
     pt_indicator   =:= irregular(1)                  [ 1 ];
     time_stride_indicator =:= irregular(1)           [ 1 ];
     pad_bit        =:= irregular(1)                  [ 1 ];
     extension      =:= irregular(1)                  [ 1 ];
    df             =:= dont_fragment(ip_version)     [ 1 ];
     reserved       =:= compressed_value(2, compressed_value(3, 0)        [ 2 3 ];
   }
 }

 profile_2_3_4_flags_enc(flag, ip_version)
 {
   UNCOMPRESSED {
     ip_outer_indicator [ 1 ];
    repair_indicator   [ 1 ];
     df                 [ 1 ];
     ip_id_behavior     [ 2 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     ENFORCE(ip_outer_indicator.CVALUE == 0);
    ENFORCE(repair_indicator.CVALUE == 0);
     df                 =:= static;
     ip_id_behavior     =:= static;
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     ip_outer_indicator =:= irregular(1)              [ 1 ];
    repair_indicator   =:= irregular(1)              [ 1 ];
     df                 =:= dont_fragment(ip_version) [ 1 ];
     ip_id_behavior     =:= ip_id_behavior_choice(1)  [ 2 ];
     reserved           =:= compressed_value(3, compressed_value(4, 0)    [ 3 4 ];
   }
 }

profile_8_flags_enc(flag)

 profile_8_flags_enc(flag, ip_version)
 {
   UNCOMPRESSED {
     ip_outer_indicator  [ 1 ];
    repair_indicator    [ 1 ];
     df                  [ 1 ];
     ip_id_behavior      [ 2 ];
     coverage_behavior   [ 2 ];
   }

   COMPRESSED not_present {
     ENFORCE(flag == 0);
     ENFORCE(ip_outer_indicator.CVALUE == 0);
    ENFORCE(repair_indicator.CVALUE == 0);
     df                  =:= static;
     ip_id_behavior      =:= static;
     coverage_behavior   =:= static;
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     reserved            =:= compressed_value(1, compressed_value(2, 0)      [ 1 2 ];
     ip_outer_indicator  =:= irregular(1)                [ 1 ];
    repair_indicator    =:= irregular(1)                [ 1 ];
     df                  =:= dont_fragment(ip_version)   [ 1 ];
     ip_id_behavior      =:= ip_id_behavior_choice(1)    [ 2 ];
     coverage_behavior   =:= irregular(2)                [ 2 ];
   }
 }
 profile_7_flags2_enc(flag, ip_version)
 {
   UNCOMPRESSED {
     list_indicator          [ 1 ];
     pt_indicator            [ 1 ];
     time_stride_indicator   [ 1 ];
     pad_bit                 [ 1 ];
     extension               [ 1 ];
    df                      [ 1 ];
     coverage_behavior       [ 2 ];
   }

   COMPRESSED not_present{
     ENFORCE(flag == 0);
     ENFORCE(list_indicator.CVALUE == 0);
     ENFORCE(pt_indicator.CVALUE == 0);
     ENFORCE(time_stride_indicator.CVALUE == 0);
     pad_bit             =:= static;
     extension           =:= static;
    df                  =:= static;
     coverage_behavior   =:= static;
   }

   COMPRESSED present {
     ENFORCE(flag == 1);
     reserved       =:= compressed_value(1, 0)      [ 1 ];
     list_indicator =:= irregular(1)                [ 1 ];
     pt_indicator   =:= irregular(1)                [ 1 ];
     time_stride_indicator =:= irregular(1)         [ 1 ];
     pad_bit        =:= irregular(1)                [ 1 ];
     extension      =:= irregular(1)                [ 1 ];
    df             =:= dont_fragment(ip_version)   [ 1 ];
     coverage_behavior =:= irregular(2)             [ 2 ];
   }
 }

 ////////////////////////////////////////////
 // RTP profile
 ////////////////////////////////////////////

 rtp_baseheader(profile, ts_stride_value, time_stride_value,
               outer_ip_flag, repair_flag)
                outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     ENFORCE(msn.UVALUE == sequence_number.UVALUE);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [ 16 ];
     dst_port                                           [ 16 ];
     udp_length  =:= inferred_udp_length                [ 16 ];
     udp_checksum                                       [ 16 ];
     rtp_version =:= uncompressed_value(2, 2)           [  2 ];
     pad_bit                                            [  1 ];
     extension                                          [  1 ];
     cc                                                 [  4 ];
     marker                                             [  1 ];
     payload_type                                       [  7 ];
     sequence_number                                    [ 16 ];
     timestamp                                          [ 32 ];
     ssrc                                               [ 32 ];
     csrc_list                                          [ VARIABLE ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     ENFORCE(msn.UVALUE == sequence_number.UVALUE);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 6)        [   4 ];
     tos_tc                                             [   8 ];
     flow_label                                         [  20 ];
     payload_length =:= inferred_ip_v6_length           [  16 ];
     next_header                                        [   8 ];
     ttl_hopl                                           [   8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [  16 ];
     dst_port                                           [  16 ];
     udp_length     =:= inferred_udp_length             [  16 ];
     udp_checksum                                       [  16 ];
     rtp_version    =:= uncompressed_value(2, 2)        [   2 ];
     pad_bit                                            [   1 ];
     extension                                          [   1 ];
     cc                                                 [   4 ];
     marker                                             [   1 ];
     payload_type                                       [   7 ];
     sequence_number                                    [  16 ];
     timestamp                                          [  32 ];
     ssrc                                               [  32 ];
     csrc_list                                          [ VARIABLE ];
     df    =:= uncompressed_value(0,0)                  [   0 ];
     ip_id =:= uncompressed_value(0,0)                  [   0 ];
   }

   CONTROL {
    ENFORCE(time_stride_value
     ENFORCE(time_stride.UVALUE == time_stride.UVALUE); time_stride_value);
     ENFORCE(ts_stride.UVALUE == ts_stride_value);
     ENFORCE(profile == PROFILE_RTP_0101);
     ts_stride                           [ 32 ];
     time_stride                         [ 32 ];
     ts_scaled                           [ 32 ];
     ts_offset =:= field_scaling(ts_stride.UVALUE, ts_scaled.UVALUE,
       timestamp.UVALUE) [ 32 ];
     ip_id_behavior                      [  2 ];
   }

   INITIAL {
     ts_stride     =:= uncompressed_value(32, 0); TS_STRIDE_DEFAULT);
     time_stride   =:= uncompressed_value(32, 0); TIME_STRIDE_DEFAULT);
   }

   DEFAULT {
     ENFORCE(outer_ip_flag == 0);
    ENFORCE(repair_flag == 0);
     tos_tc          =:= static;
     dest_addr       =:= static;
     ttl_hopl        =:= static;
     src_addr        =:= static;
     df              =:= static;
     ip_id_behavior  =:= static;
     flow_label      =:= static;
     next_header     =:= static;
     src_port        =:= static;
     dst_port        =:= static;
    udp_checksum    =:= irregular(16);
     pad_bit         =:= static;
     extension       =:= static;
     cc              =:= static;
     // When marker not present in packets, it is assumed 0
     marker          =:= uncompressed_value(1, 0);
     payload_type    =:= static;
     sequence_number =:= static;
     timestamp       =:= static;
     ssrc            =:= static;
     csrc_list       =:= static;
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
     marker               =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags1_indicator     =:= irregular(1)                  [ 1 ];
     flags2_indicator     =:= irregular(1)                  [ 1 ];
     tsc_indicator        =:= irregular(1)                  [ 1 ];
     tss_indicator        =:= irregular(1)                  [ 1 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];

     outer_ip_indicator : repair_indicator : ttl_hopl_indicator :
       tos_tc_indicator : ip_id_behavior : reorder_ratio =:=
       profile_1_7_flags1_enc(flags1_indicator.CVALUE)      [ 0, 8 ];
     list_indicator : pt_indicator : tis_indicator :pad_bit :
       extension : df =:= profile_1_flags2_enc(flags2_indicator.CVALUE,
       ip_version.UVALUE)                                   [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     payload_type =:= optional_pt(pt_indicator) pt_irr_or_static(pt_indicator)        [ 0, 8 ];
     sequence_number =:= sdvl_lsb(sequence_number.ULENGTH)
       sdvl_sn_lsb(sequence_number.ULENGTH)                [ VARIABLE ];
     ip_id =:= ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                             [ 0, 8, 16 ];
     ts_scaled =:= variable_scaled_timestamp(tss_indicator.CVALUE,
       tsc_indicator, ts_stride.UVALUE)                    [ VARIABLE ];
     timestamp =:= variable_unscaled_timestamp(tss_indicator.CVALUE,
       tsc_indicator)                                      [ VARIABLE ];
     ts_stride =:= sdvl_or_static(tss_indicator.CVALUE)    [ VARIABLE ];
     time_stride =:= sdvl_or_static(tis_indicator.CVALUE)  [ VARIABLE ];
     csrc_list =:= csrc_list_presence(list_indicator.CVALUE,
       cc.UVALUE)                                          [ VARIABLE ];
   }

   // Context repair (IR-DYN replacement). UO-0
   COMPRESSED co_repair pt_0_crc3 {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator =:= '11111011' '0'                             [ 8 1 ];
    marker
     msn           =:= irregular(1) msn_lsb(4)                      [ 1 4 ];
     header_crc    =:= crc7(THIS.UVALUE, crc3(THIS.UVALUE, THIS.ULENGTH) [ 7 3 ];
    flags1_indicator
     timestamp     =:= irregular(1)             [ 1 ];
    flags2_indicator     =:= irregular(1)             [ 1 ];
    timestamp_indicator  =:= irregular(1)             [ 1 ];
    tss_indicator        =:= irregular(1)             [ 1 ];
    ip_id_indicator      =:= irregular(1)             [ 1 ];
    control_crc3         =:= control_crc3_encoding    [ 3 ];

    outer_ip_indicator : repair_indicator : ttl_hopl_indicator :
      tos_tc_indicator : ip_id_behavior : reorder_ratio =:=
      profile_1_7_flags1_enc(flags1_indicator.CVALUE) [ 0, 8 ];
    list_indicator : pt_indicator : pad_bit : extension : df :
      tis_indicator =:= profile_1_flags2_enc(flags2_indicator.CVALUE,
      ip_version.UVALUE)                              [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
    tos_tc =:=
      static_or_irreg(tos_tc_indicator.CVALUE, 8)     [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                               [ 0, 8 ];
    payload_type =:= optional_pt(pt_indicator)        [ 0, 8 ];
    sequence_number      =:= irregular(16)            [ 16 ];
    timestamp            =:=
      irregular_or_nothing(timestamp_indicator)       [ 0, 32 ];
    ts_stride            =:=
      sdvl_or_static(tss_indicator)                   [ VARIABLE ];
    time_stride          =:=
      sdvl_or_static(tis_indicator)                   [ VARIABLE ];
    csrc_list            =:=
      csrc_list_presence(list_indicator.CVALUE, cc.UVALUE) [ VARIABLE ];
  }

  // UO-0
  COMPRESSED pt_0_crc3 {
    discriminator =:= '0'                             [ 1 ];
    msn           =:= msn_lsb(4)                      [ 4 ];
    header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
    timestamp     =:= inferred_scaled_field inferred_scaled_field           [ 0 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }
   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator =:= '100' '1000'                          [ 3 4 ];
     msn           =:= msn_lsb(6) msn_lsb(5)                      [ 6 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     timestamp     =:= inferred_scaled_field           [ 0 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // UO-1 replacement
   COMPRESSED pt_1_rnd {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '101'                                [ 3 ];
     msn           =:= msn_lsb(5) msn_lsb(4)                           [ 5 4 ];
     marker        =:= irregular(1)                         [ 1 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 4) 5) [ 4 5 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)      [ 3 ];
   }

   // UO-1-ID replacement
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1010' '1001'                          [ 4 ];
    header_crc
     ip_id =:= crc3(THIS.UVALUE, THIS.ULENGTH) ip_id_lsb(ip_id_behavior.UVALUE, 4)     [ 3 4 ];
     msn           =:= msn_lsb(5)                      [ 5 ];
    ip_id
     header_crc    =:= ip_id_lsb(ip_id_behavior.UVALUE, 4) crc3(THIS.UVALUE, THIS.ULENGTH) [ 4 3 ];
     timestamp     =:= inferred_scaled_field           [ 0 ];
   }

   // UO-1-TS replacement
   COMPRESSED pt_1_seq_ts {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1011' '101'                                [ 4 3 ];
     marker        =:= irregular(1)                         [ 1 ];
    header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)  [ 3 ];
     msn           =:= msn_lsb(4)                           [ 4 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 4) 5) [ 4 5 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)      [ 3 ];
   }

   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '110'                                [ 3 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 6) [ 6 ];
     marker        =:= irregular(1)                         [ 1 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '11000'                         [ 5 ];
     msn           =:= msn_lsb(7)                      [ 7 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)     [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     timestamp     =:= inferred_scaled_field           [ 0 ];
   }

   // UOR-2-ID-ext1 replacement (both TS and IP-ID)
   COMPRESSED pt_2_seq_both {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '11001'                              [ 5 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)          [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 8) [ 8 ];
   }

   // UOR-2-TS replacement
   COMPRESSED pt_2_seq_ts {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1101'                               [ 4 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 5) [ 5 ];
     marker        =:= irregular(1)                         [ 1 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
   }
 }
 ////////////////////////////////////////////
 // UDP profile
 ////////////////////////////////////////////

 udp_baseheader(profile, outer_ip_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [ 16 ];
     dst_port                                           [ 16 ];
     udp_length     =:= inferred_udp_length             [ 16 ];
     udp_checksum                                       [ 16 ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 6)        [  4 ];
     tos_tc                                             [  8 ];
     flow_label                                         [ 20 ];
     payload_length =:= inferred_ip_v6_length           [ 16 ];
     next_header                                        [  8 ];
     ttl_hopl                                           [  8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [ 16 ];
     dst_port                                           [ 16 ];
     udp_length     =:= inferred_udp_length             [ 16 ];
     udp_checksum                                       [ 16 ];
     df    =:= uncompressed_value(0,0)                  [  0 ];
     ip_id =:= uncompressed_value(0,0)                  [  0 ];
   }
   CONTROL {
     ENFORCE(profile == PROFILE_UDP_0102);
     ip_id_behavior [ 2 ];
   }

   DEFAULT {
     ENFORCE(outer_ip_flag == 0);
    ENFORCE(repair_flag == 0);
     tos_tc         =:= static;
     dest_addr      =:= static;
     ip_version     =:= static;
     ttl_hopl       =:= static;
     src_addr       =:= static;
     df             =:= static;
     ip_id_behavior =:= static;
     flow_label     =:= static;
     next_header    =:= static;
     src_port       =:= static;
     dst_port       =:= static;
    udp_checksum   =:= irregular(16);
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags_indicator      =:= irregular(1)                  [ 1 ];
     ttl_hopl_indicator   =:= irregular(1)                  [ 1 ];
     tos_tc_indicator     =:= irregular(1)                  [ 1 ];
     reorder_ratio        =:= reorder_choice                [ 2 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];
     outer_ip_indicator : repair_indicator : df : ip_id_behavior =:=
       profile_2_3_4_flags_enc(
       flags_indicator.CVALUE, ip_version.UVALUE)           [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     msn                  =:= msn_lsb(8)                    [ 8 ];
     ip_id =:= ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                          [ 0, 8, 16 ];
   }

   // Context repair (IR-DYN replacement). UO-0
   COMPRESSED co_repair pt_0_crc3 {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator =:= '11111011' '0'                             [ 8 1 ];
    ip_id_indicator
     msn           =:= irregular(1)             [ 1 ];
    header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)  [ 7 ];
    flags_indicator      =:= irregular(1)             [ 1 ];
    ttl_hopl_indicator   =:= irregular(1)             [ 1 ];
    tos_tc_indicator     =:= irregular(1)             [ 1 ];
    reorder_ratio        =:= reorder_choice           [ 2 ];
    control_crc3         =:= control_crc3_encoding    [ 3 ];
    outer_ip_indicator : repair_indicator : df :
      ip_id_behavior =:= profile_2_3_4_flags_enc(
      flags_indicator.CVALUE, ip_version.UVALUE)      [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
    tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                               [ 0, 8 ];
    msn                  =:= irregular(16)            [ 16 ];
  }

  // UO-0
  COMPRESSED pt_0_crc3 {
    discriminator =:= '0'                             [ 1 ];
    msn           =:= msn_lsb(4) msn_lsb(4)                      [ 4 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator =:= '100'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // UO-1-ID replacement (PT-1 only used for sequential)
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '101'                           [ 3 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 4)     [ 4 ];
   }

   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '110'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1100'                          [ 4 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)     [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     msn           =:= msn_lsb(8)                      [ 8 ];
   }
 }

 ////////////////////////////////////////////
 // ESP profile
 ////////////////////////////////////////////

 esp_baseheader(profile, outer_ip_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     ENFORCE(msn.UVALUE == sequence_number.UVALUE % 65536);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     spi                                                [ 32 ];
     sequence_number                                    [ 32 ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(msn.UVALUE == (sequence_number.UVALUE % 65536));
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 6)        [   4 ];
     tos_tc                                             [   8 ];
     flow_label                                         [  20 ];
     payload_length =:= inferred_ip_v6_length           [  16 ];
     next_header                                        [   8 ];
     ttl_hopl                                           [   8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     spi                                                [  32 ];
     sequence_number                                    [  32 ];
     df    =:= uncompressed_value(0,0)                  [   0 ];
     ip_id =:= uncompressed_value(0,0)                  [   0 ];
   }

   CONTROL {
     ENFORCE(profile == PROFILE_ESP_0103);
     ip_id_behavior [ 2 ];
   }

   DEFAULT {
     ENFORCE(outer_ip_indicator == 0);
    ENFORCE(repair_flag == 0);
     tos_tc          =:= static;
     dest_addr       =:= static;
     ttl_hopl        =:= static;
     src_addr        =:= static;
     df              =:= static;
     ip_id_behavior  =:= static;
     flow_label      =:= static;
     next_header     =:= static;
     spi             =:= static;
     sequence_number =:= static;
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags_indicator      =:= irregular(1)                  [ 1 ];
     ttl_hopl_indicator   =:= irregular(1)                  [ 1 ];
     tos_tc_indicator     =:= irregular(1)                  [ 1 ];
     reorder_ratio        =:= reorder_choice                [ 2 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];

     outer_ip_indicator : repair_indicator : df : ip_id_behavior =:=
       profile_2_3_4_flags_enc(
       flags_indicator.CVALUE, ip_version.UVALUE)           [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                        [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     sequence_number =:= sdvl_lsb(sequence_number.ULENGTH)
       sdvl_sn_lsb(sequence_number.ULENGTH)             [ VARIABLE ];
  }

  // Context repair (IR-DYN replacement).
  COMPRESSED co_repair {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
    discriminator        =:= '11111011'              [ 8 ];
    discriminator        =:= '11111010'              [ 8 ];
    ip_id_indicator      =:= irregular(1)            [ 1 ];
    header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
    flags_indicator      =:= irregular(1)            [ 1 ];
    ttl_hopl_indicator   =:= irregular(1)            [ 1 ];
    tos_tc_indicator     =:= irregular(1)            [ 1 ];
    reorder_ratio        =:= reorder_choice          [ 2 ];
    control_crc3         =:= control_crc3_encoding   [ 3 ];

    outer_ip_indicator : repair_indicator : df :
      ip_id_behavior =:= profile_2_3_4_flags_enc(
      flags_indicator.CVALUE, ip_version.UVALUE)     [ 0, 8 ];
     ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE, ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                          [ 0, 8, 16 ];
    tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                              [ 0, 8 ];
    sequence_number =:= irregular(32)                [ 32 ];
   }

   // Sequence number sent instead of MSN due to field length
   // UO-0
   COMPRESSED pt_0_crc3 {
     discriminator   =:= '0'                             [ 1 ];
    msn
     sequence_number =:= msn_lsb(4)                      [ 4 ];
     header_crc      =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     ip_id           =:= inferred_sequential_ip_id       [ 0 ];
   }

   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator   =:= '100'                           [ 3 ];
    msn
     sequence_number          =:= msn_lsb(6)             [ 6 ];
     header_crc      =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     ip_id           =:= inferred_sequential_ip_id       [ 0 ];
   }

   // UO-1-ID replacement (PT-1 only used for sequential)
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
    discriminator
     discriminato    =:= '101'                           [ 3 ];
     header_crc      =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
    msn
     sequence_number =:= msn_lsb(6)                      [ 6 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 4)       [ 4 ];
   }

   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator   =:= '110'                           [ 3 ];
    msn
     sequence_number =:= msn_lsb(6)                      [ 6 ];
     header_crc      =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator   =:= '1100'                          [ 4 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)       [ 5 ];
     header_crc      =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
    msn
     sequence_number =:= msn_lsb(8)                      [ 8 ];
   }
 }

 ////////////////////////////////////////////
 // IP-only profile
 ////////////////////////////////////////////

 iponly_baseheader(profile, outer_ip_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     outer_headers     =:= baseheader_outer_headers     [ VARIABLE ];
     ip_version        =:= uncompressed_value(4, 6)     [   4 ];
     tos_tc                                             [   8 ];
     flow_label                                         [  20 ];
     payload_length    =:= inferred_ip_v6_length        [  16 ];
     next_header                                        [   8 ];
     ttl_hopl                                           [   8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     df    =:= uncompressed_value(0,0)                  [   0 ];
     ip_id =:= uncompressed_value(0,0)                  [   0 ];
   }

   CONTROL {
     ENFORCE(profile == PROFILE_IP_0104);
     ip_id_behavior [ 2 ];
   }

   DEFAULT {
     ENFORCE(outer_ip_indicator == 0);
    ENFORCE(repair_flag == 0);
     tos_tc         =:= static;
     dest_addr      =:= static;
     ttl_hopl       =:= static;
     src_addr       =:= static;
     df             =:= static;
     ip_id_behavior =:= static;
     flow_label     =:= static;
     next_header    =:= static;
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags_indicator      =:= irregular(1)                  [ 1 ];
     ttl_hopl_indicator   =:= irregular(1)                  [ 1 ];
     tos_tc_indicator     =:= irregular(1)                  [ 1 ];
     reorder_ratio        =:= reorder_choice                [ 2 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];
     outer_ip_indicator : repair_indicator : df : ip_id_behavior =:=
       profile_2_3_4_flags_enc(
       flags_indicator.CVALUE, ip_version.UVALUE)           [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     msn                  =:= msn_lsb(8)                    [ 8 ];
  }

  // Context repair (IR-DYN replacement).
  COMPRESSED co_repair {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
    discriminator        =:= '11111011'               [ 8 ];
    ip_id_indicator      =:= irregular(1)             [ 1 ];
    header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)  [ 7 ];
    flags_indicator      =:= irregular(1)             [ 1 ];
    ttl_hopl_indicator   =:= irregular(1)             [ 1 ];
    tos_tc_indicator     =:= irregular(1)             [ 1 ];
    reorder_ratio        =:= reorder_choice           [ 2 ];
    control_crc3         =:= control_crc3_encoding    [ 3 ];
    outer_ip_indicator : repair_indicator : df :
      ip_id_behavior   =:= profile_2_3_4_flags_enc(
      flags_indicator.CVALUE, ip_version.UVALUE)      [ 0, 8 ];
     ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE, ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                          [ 0, 8, 16 ];
    tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                               [ 0, 8 ];
    msn                  =:= irregular(16)            [ 16 ];
   }

   // UO-0
   COMPRESSED pt_0_crc3 {
     discriminator =:= '0'                             [ 1 ];
     msn           =:= msn_lsb(4)                      [ 4 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator =:= '100'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // UO-1-ID replacement (PT-1 only used for sequential)
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '101'                           [ 3 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 4)     [ 4 ];
   }
   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '110'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1100'                          [ 4 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)     [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     msn           =:= msn_lsb(8)                      [ 8 ];
   }
 }

 ////////////////////////////////////////////
 // UDP-lite/RTP profile
 ////////////////////////////////////////////

 udplite_rtp_baseheader(profile, ts_stride_value, time_stride_value,
                       outer_ip_flag, repair_flag)
                        outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     ENFORCE(msn.UVALUE == sequence_number.UVALUE);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [ 16 ];
     dst_port                                           [ 16 ];
     checksum_coverage                                  [ 16 ];
     udp_checksum                                       [ 16 ];
     rtp_version    =:= uncompressed_value(2, 2)        [  2 ];
     pad_bit                                            [  1 ];
     extension                                          [  1 ];
     cc                                                 [  4 ];
     marker                                             [  1 ];
     payload_type                                       [  7 ];
     sequence_number                                    [ 16 ];
     timestamp                                          [ 32 ];
     ssrc                                               [ 32 ];
     csrc_list                                          [ VARIABLE ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 6)        [   4 ];
     tos_tc                                             [   8 ];
     flow_label                                         [  20 ];
     payload_length =:= inferred_ip_v6_length           [  16 ];
     next_header                                        [   8 ];
     ttl_hopl                                           [   8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [  16 ];
     dst_port                                           [  16 ];
     checksum_coverage                                  [  16 ];
     udp_checksum                                       [  16 ];
     rtp_version =:= uncompressed_value(2, 2)           [   2 ];
     pad_bit                                            [   1 ];
     extension                                          [   1 ];
     cc                                                 [   4 ];
     marker                                             [   1 ];
     payload_type                                       [   7 ];
     sequence_number                                    [  16 ];
     timestamp                                          [  32 ];
     ssrc                                               [  32 ];
     csrc_list                                          [ VARIABLE ];
     df    =:= uncompressed_value(0,0)                  [   0 ];
     ip_id =:= uncompressed_value(0,0)                  [   0 ];
   }

   CONTROL {
    ENFORCE(time_stride_value
     ENFORCE(time_stride.UVALUE == time_stride.UVALUE); time_stride_value);
     ENFORCE(ts_stride.UVALUE == ts_stride_value);
     ENFORCE(profile == PROFILE_RTP_0107);
     ip_id_behavior                      [  2 ];
     coverage_behavior                   [  2 ];
     ts_stride                           [ 32 ];
     time_stride                         [ 32 ];
     ts_scaled                           [ 32 ];
     ts_offset =:= field_scaling(ts_stride.UVALUE, ts_scaled.UVALUE,
       timestamp.UVALUE) [ 32 ];
   }

   DEFAULT {
     ENFORCE(outer_ip_indicator == 0);
    ENFORCE(repair_flag == 0);
     tos_tc            =:= static;
     dest_addr         =:= static;
     ttl_hopl          =:= static;
     src_addr          =:= static;
     df                =:= static;
     ip_id_behavior    =:= static;
     flow_label        =:= static;
     next_header       =:= static;
     src_port          =:= static;
     dst_port          =:= static;
    checksum_coverage =:= irregular(16);
    udp_checksum      =:= irregular(16);
     pad_bit           =:= static;
     extension         =:= static;
     cc                =:= static;
     // When marker not present in packets, it is assumed 0
     marker            =:= uncompressed_value(1, 0);
     payload_type      =:= static;
     sequence_number   =:= static;
     timestamp         =:= static;
     ssrc              =:= static;
     csrc_list         =:= static;
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
     marker               =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags1_indicator     =:= irregular(1)                  [ 1 ];
     flags2_indicator     =:= irregular(1)                  [ 1 ];
     tsc_indicator        =:= irregular(1)                  [ 1 ];
     tss_indicator        =:= irregular(1)                  [ 1 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];

     outer_ip_indicator : repair_indicator : ttl_hopl_indicator :
       tos_tc_indicator : ip_id_behavior : reorder_ratio =:=
       profile_1_7_flags1_enc(flags1_indicator.CVALUE)      [ 0, 8 ];
     list_indicator : tis_indicator : pt_indicator : pad_bit :
       extension : df : coverage_behavior =:=
       profile_7_flags2_enc(flags2_indicator.CVALUE,
       ip_version.UVALUE)                                   [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                          [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     payload_type =:= optional_pt(pt_indicator.CVALUE) pt_irr_or_static(pt_indicator.CVALUE) [ 0, 8 ];
     sequence_number =:= sdvl_lsb(sequence_number.ULENGTH)
       sdvl_sn_lsb(sequence_number.ULENGTH)               [ VARIABLE ];
     ip_id =:= ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                            [ 0, 8, 16, 24 16 ];
     ts_scaled =:= variable_scaled_timestamp(tss_indicator.CVALUE,
       tsc_indicator.CVALUE, ts_stride.UVALUE)            [ VARIABLE ];
     timestamp =:= variable_unscaled_timestamp(tss_indicator.CVALUE,
       tsc_indicator.CVALUE)                              [ VARIABLE ];
     ts_stride =:= sdvl_or_static(tss_indicator.CVALUE)   [ VARIABLE ];
     time_stride =:= sdvl_or_static(tis_indicator.CVALUE) [ VARIABLE ];
     csrc_list            =:=
         csrc_list_presence(list_indicator.CVALUE,
           cc.UVALUE)                                     [ VARIABLE ];
   }

   // Context repair (IR-DYN replacement). UO-0
   COMPRESSED co_repair pt_0_crc3 {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator =:= '11111011' '0'                             [ 8 1 ];
    marker
     msn           =:= irregular(1) msn_lsb(4)                      [ 1 4 ];
     header_crc    =:= crc7(THIS.UVALUE, crc3(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
    flags1_indicator     =:= irregular(1)            [ 1 3 ];
    flags2_indicator
     timestamp     =:= irregular(1) inferred_scaled_field           [ 1 0 ];
    timestamp_indicator
     ip_id         =:= irregular(1) inferred_sequential_ip_id       [ 1 0 ];
    tss_indicator
   }

   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator =:= irregular(1) '1000'                          [ 1 4 ];
    ip_id_indicator
     msn           =:= irregular(1) msn_lsb(5)                      [ 1 5 ];
    control_crc3
     header_crc    =:= control_crc3_encoding crc7(THIS.UVALUE, THIS.ULENGTH) [ 3 7 ];

    outer_ip_indicator : repair_indicator : ttl_hopl_indicator :
      tos_tc_indicator : ip_id_behavior : reorder_ratio
     timestamp     =:=
      profile_1_7_flags1_enc(flags1_indicator.CVALUE) inferred_scaled_field           [ 0, 8 0 ];

    list_indicator : tis_indicator : pt_indicator : pad_bit :
      extension : df : coverage_behavior
     ip_id         =:=
      profile_7_flags2_enc(flags2_indicator.CVALUE,
      ip_version.UVALUE) inferred_sequential_ip_id       [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                         [ 0, 8, 16 ];
    tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                               [ 0, 8 ];
    payload_type =:= optional_pt(pt_indicator.CVALUE) [ 0, 8 ];
    sequence_number     =:= irregular(16)             [ 16 ];
    timestamp =:=
      irregular_or_nothing(timestamp_indicator.CVALUE) [ 0, 32 ];
    ts_stride =:= sdvl_or_static(tss_indicator.CVALUE) [ VARIABLE ];
    time_stride =:= sdvl_or_static(tis_indicator.CVALUE) [ VARIABLE ];
    csrc_list =:= csrc_list_presence(list_indicator.CVALUE,
      cc.UVALUE)                                      [ VARIABLE ];
  }

  // UO-0
  COMPRESSED pt_0_crc3 {
    discriminator =:= '0'                             [ 1 ];
    msn           =:= msn_lsb(4)                      [ 4 ];
    header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
    timestamp     =:= inferred_scaled_field           [ 0 ];
    ip_id         =:= inferred_sequential_ip_id       [ 0 ];
  }

  // New format, Type 0 with strong CRC and more SN bits
  COMPRESSED pt_0_crc7 {
    discriminator =:= '100'                           [ 3 ];
    msn           =:= msn_lsb(6)                      [ 6 ];
    header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
    timestamp     =:= inferred_scaled_field           [ 0 ];
    ip_id         =:= inferred_sequential_ip_id       [ 0 0 ];
   }

   // UO-1 replacement
   COMPRESSED pt_1_rnd {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '101'                                [ 3 ];
     msn           =:= msn_lsb(5) msn_lsb(4)                           [ 5 4 ];
     marker        =:= irregular(1)                         [ 1 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 4) 5) [ 4 5 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)      [ 3 ];
   }

   // UO-1-ID replacement
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1010' '1001'                          [ 4 ];
    header_crc
     ip_id =:= crc3(THIS.UVALUE, THIS.ULENGTH) ip_id_lsb(ip_id_behavior.UVALUE, 4)     [ 3 4 ];
     msn           =:= msn_lsb(5)                      [ 5 ];
    ip_id
     header_crc    =:= ip_id_lsb(ip_id_behavior.UVALUE, 4) crc3(THIS.UVALUE, THIS.ULENGTH) [ 4 3 ];
     timestamp     =:= inferred_scaled_field           [ 0 ];
   }

   // UO-1-TS replacement
   COMPRESSED pt_1_seq_ts {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1011' '101'                                [ 4 3 ];
     marker        =:= irregular(1)                         [ 1 ];
    header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)  [ 3 ];
     msn           =:= msn_lsb(4)                           [ 4 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 4) 5) [ 4 5 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH)      [ 3 ];
   }

   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '110'                                [ 3 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 6) [ 6 ];
     marker        =:= irregular(1)                         [ 1 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '11000'                         [ 5 ];
     msn           =:= msn_lsb(7)                      [ 7 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)     [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     timestamp     =:= inferred_scaled_field           [ 0 ];
   }

   // UOR-2-ID-ext1 replacement (both TS and IP-ID)
   COMPRESSED pt_2_seq_both {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '11001'                              [ 5 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)          [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 8) [ 8 ];
   }

   // UOR-2-TS replacement
   COMPRESSED pt_2_seq_ts {
     ENFORCE(ts_stride.UVALUE != 0);
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1101'                               [ 4 ];
     msn           =:= msn_lsb(7)                           [ 7 ];
     ts_scaled     =:= scaled_ts_lsb(time_stride.UVALUE, 5) [ 5 ];
     marker        =:= irregular(1)                         [ 1 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH)      [ 7 ];
   }
 }

 ////////////////////////////////////////////
 // UDP-lite profile
 ////////////////////////////////////////////

 udplite_baseheader(profile, outer_ip_flag, repair_flag) outer_ip_flag)
 {
   UNCOMPRESSED v4 {
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 4)        [  4 ];
     header_length  =:= uncompressed_value(4, 5)        [  4 ];
     tos_tc                                             [  8 ];
     length         =:= inferred_ip_v4_length           [ 16 ];
     ip_id                                              [ 16 ];
     rf             =:= uncompressed_value(1, 0)        [  1 ];
     df                                                 [  1 ];
     mf             =:= uncompressed_value(1, 0)        [  1 ];
     frag_offset    =:= uncompressed_value(13, 0)       [ 13 ];
     ttl_hopl                                           [  8 ];
     next_header                                        [  8 ];
     ip_checksum =:= inferred_ip_v4_header_checksum     [ 16 ];
     src_addr                                           [ 32 ];
     dest_addr                                          [ 32 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [ 16 ];
     dst_port                                           [ 16 ];
     checksum_coverage                                  [ 16 ];
     udp_checksum                                       [ 16 ];
   }

   UNCOMPRESSED v6 {
     ENFORCE(ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM);
     outer_headers  =:= baseheader_outer_headers        [ VARIABLE ];
     ip_version     =:= uncompressed_value(4, 6)        [   4 ];
     tos_tc                                             [   8 ];
     flow_label                                         [  20 ];
     payload_length =:= inferred_ip_v6_length           [  16 ];
     next_header                                        [   8 ];
     ttl_hopl                                           [   8 ];
     src_addr                                           [ 128 ];
     dest_addr                                          [ 128 ];
     extension_headers =:= baseheader_extension_headers [ VARIABLE ];
     src_port                                           [  16 ];
     dst_port                                           [  16 ];
     checksum_coverage                                  [  16 ];
     udp_checksum                                       [  16 ];
     df    =:= uncompressed_value(0,0)                  [   0 ];
     ip_id =:= uncompressed_value(0,0)                  [   0 ];
   }

   CONTROL {
     ENFORCE(profile == PROFILE_UDPLITE_0108);
     ip_id_behavior    [ 2 ];
     coverage_behavior [ 2 ];
   }

   DEFAULT {
     ENFORCE(outer_ip_indicator == 0);
    ENFORCE(repair_flag == 0);
     tos_tc            =:= static;
     dest_addr         =:= static;
     ttl_hopl          =:= static;
     src_addr          =:= static;
     df                =:= static;
     ip_id_behavior    =:= static;
     flow_label        =:= static;
     next_header       =:= static;
     src_port          =:= static;
     dst_port          =:= static;
    checksum_coverage =:= irregular(16);
    udp_checksum      =:= irregular(16);
   }

   // Replacement for UOR-2-ext3
   COMPRESSED co_common {
    ENFORCE(repair_flag == 0);
     ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator        =:= '11111010'                    [ 8 ];
    reorder_ratio        =:= reorder_choice          [ 2 ];
     ip_id_indicator      =:= irregular(1)                  [ 1 ];
     header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH)       [ 7 ];
     flags_indicator      =:= irregular(1)                  [ 1 ];
     ttl_hopl_indicator   =:= irregular(1)                  [ 1 ];
     tos_tc_indicator     =:= irregular(1)                  [ 1 ];
     reorder_ratio        =:= reorder_choice                [ 2 ];
     control_crc3         =:= control_crc3_encoding         [ 3 ];
     outer_ip_indicator : repair_indicator : df : ip_id_behavior :
       coverage_behavior  =:=
      profile_8_flags_enc(flags_indicator.CVALUE)
       profile_8_flags_enc(flags_indicator.CVALUE,
       ip_version.UVALUE)                                   [ 0, 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                    [ 0, 8, 16 ];
     tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
     ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
       ttl_hopl.ULENGTH)                                    [ 0, 8 ];
     msn                  =:= msn_lsb(8)                    [ 8 ];
     ip_id =:= ip_id_sequential_variable(ip_id_behavior.UVALUE,
       ip_id_indicator.CVALUE)                          [ 0, 8, 16 ];
   }

   // Context repair (IR-DYN replacement). UO-0
   COMPRESSED co_repair pt_0_crc3 {
    ENFORCE(outer_ip_flag == outer_ip_indicator.CVALUE);
    ENFORCE(repair_flag == repair_indicator.CVALUE);
     discriminator =:= '11111011' '0'                             [ 8 1 ];
    reorder_ratio        =:= reorder_choice          [ 2 ];
    ip_id_indicator      =:= irregular(1)            [ 1 ];
    header_crc   =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
    flags_indicator      =:= irregular(1)            [ 1 ];
    ttl_hopl_indicator   =:= irregular(1)            [ 1 ];
    tos_tc_indicator     =:= irregular(1)            [ 1 ];
    control_crc3         =:= control_crc3_encoding   [ 3 ];
    outer_ip_indicator : repair_indicator : df :
        ip_id_behavior : coverage_behavior =:=
        profile_8_flags_enc(flags_indicator.CVALUE)  [ 0, 8 ];
    msn                  =:= msn_lsb(16)             [ 8 ];
    ip_id =:= optional_ip_id_lsb(ip_id_behavior.UVALUE,
      ip_id_indicator.CVALUE)                        [ 0, 8, 16 ];
    tos_tc =:= static_or_irreg(tos_tc_indicator.CVALUE, 8) [ 0, 8 ];
    ttl_hopl =:= static_or_irreg(ttl_hopl_indicator.CVALUE,
      ttl_hopl.ULENGTH)                              [ 0, 8 ];
  }

  // UO-0
  COMPRESSED pt_0_crc3 {
    discriminator =:= '0'                             [ 1 ];
    msn
     msn           =:= msn_lsb(4)                      [ 4 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // New format, Type 0 with strong CRC and more SN bits
   COMPRESSED pt_0_crc7 {
     discriminator =:= '100'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     ip_id         =:= inferred_sequential_ip_id       [ 0 ];
   }

   // UO-1-ID replacement (PT-1 only used for sequential)
   COMPRESSED pt_1_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '101'                           [ 3 ];
     header_crc    =:= crc3(THIS.UVALUE, THIS.ULENGTH) [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 4)     [ 4 ];
   }

   // UOR-2 replacement
   COMPRESSED pt_2_rnd {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_RANDOM) ||
             (ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_ZERO));
     discriminator =:= '110'                           [ 3 ];
     msn           =:= msn_lsb(6)                      [ 6 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
   }

   // UOR-2-ID replacement
   COMPRESSED pt_2_seq_id {
     ENFORCE((ip_id_behavior.UVALUE == IP_ID_BEHAVIOR_SEQUENTIAL) ||
             (ip_id_behavior.UVALUE ==
              IP_ID_BEHAVIOR_SEQUENTIAL_SWAPPED));
     discriminator =:= '1100'                          [ 4 ];
     ip_id =:= ip_id_lsb(ip_id_behavior.UVALUE, 5)     [ 5 ];
     header_crc    =:= crc7(THIS.UVALUE, THIS.ULENGTH) [ 7 ];
     msn           =:= msn_lsb(8)                      [ 8 ];
   }
 }

6.9.  Feedback Formats and Options

6.9.1.  Feedback Formats

   This section describes the feedback format for ROHCv2 profiles, using
   the formats described in section 5.2.3 of
   [I-D.ietf-rohc-rfc3095bis-framework].

   All [RFC4995].

   The Acknowledgment Number field of the feedback formats carry a field labelled MSN, which contain LSBs contains the
   least significant bits of the MSN described in (see Section 6.2.1.  The sequence number to use is
   the MSN corresponding 6.3.1) that
   corresponds to the last reference header that was is being acknowledged.  A
   reference header is a header that has been successfully CRC-8
   validated or CRC verified.  If there is no reference header
   available, the feedback MUST carry an ACKNUMBER-NOT-VALID option.

   FEEDBACK-1

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      |              MSN     Acknowledgment Number     |
      +---+---+---+---+---+---+---+---+

      MSN:

      Acknowledgment Number: The lsb-encoded master sequence number. eight least significant bits of the
      MSN.

   A FEEDBACK-1 is an ACK.  In order to send a NACK or a STATIC-NACK,
   FEEDBACK-2 must be used.

   FEEDBACK-2

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      |Acktype|          MSN Acknowledgment Number |
      +---+---+---+---+---+---+---+---+
      |              MSN     Acknowledgment Number     |
      +---+---+---+---+---+---+---+---+
      |              CRC              |
      +---+---+---+---+---+---+---+---+
      /       Feedback options        /
      +---+---+---+---+---+---+---+---+

      Acktype:

         0 = ACK
         1 = NACK
         2 = STATIC-NACK
         3 is reserved (MUST NOT be used for parsability)

      MSN:

      Acknowledgment Number: The lsb-encoded master sequence number. least significant bits of the MSN.

      CRC: 8-bit CRC computed over the entire feedback payload including
      any CID fields but excluding the packet type, the 'Size' field and
      the 'Code' octet, using the polynomial defined in
      [I-D.ietf-rohc-rfc3095bis-framework]. [RFC4995],
      Section 5.3.1.1.  If the CID is given with an Add-CID octet, the
      Add-CID octet immediately precedes the FEEDBACK-1 or FEEDBACK-2
      format.  For purposes of computing the CRC, the CRC field is zero.

      Feedback options: A variable number of feedback options, see
      Section 6.9.2.  Options may appear in any order.

   A FEEDBACK-2 of type NACK or STATIC-NACK is always implicitely an
   acknowlegement for a successfully decompressed packet, which packet
   corresponds to a packet whose LSBs match the MSN Acknowledgment Number of
   the feedback element, unless the MSN-NOT-
   VALID ACKNUMBER-NOT-VALID option
   Section 6.9.2.2 appears in the feedback element.

   The FEEDBACK-2 format always carry a CRC and is thus more robust than
   the FEEDBACK-1 format.  When receiving FEEDBACK-2, the compressor
   MUST verify the information by computing the CRC and comparing the
   result with the CRC carried in the feedback format.  If the two are
   not identical, the feedback element MUST be discarded.

6.9.2.  Feedback Options

   A feedback option has variable length and the following general
   format:

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      |   Opt Type    |    Opt Len    |
      +---+---+---+---+---+---+---+---+
      /          option data          /  Opt Length (octets)
      +---+---+---+---+---+---+---+---+

   The CRC option contains an 8-bit CRC computed over the entire
   feedback payload including any CID fields but excluding the packet
   type, the 'Size' field and the 'Code' octet, using the polynomial of
   [I-D.ietf-rohc-rfc3095bis-framework], section 5.3.1.1.

6.9.2.1.  The REJECT option

   The REJECT option informs the compressor that the decompressor does
   not have sufficient resources to handle the flow.

      +---+---+---+---+---+---+---+---+
      |  Opt Type = 2 |  Opt Len = 0  |
      +---+---+---+---+---+---+---+---+

   When receiving a REJECT option, the compressor MUST stop compressing
   the packet flow, and SHOULD refrain from attempting to increase the
   number of compressed packet flows for some time.  Any FEEDBACK packet
   carrying a REJECT option MUST also carry a CRC option.  The REJECT option
   MUST NOT appear more than once in the FEEDBACK-2 format, otherwise
   the decompressor compressor MUST discard the entire feedback element.

6.9.2.2.  The MSN-NOT-VALID ACKNUMBER-NOT-VALID option

   The MSN-NOT-VALID ACKNUMBER-NOT-VALID option indicates that the MSN Acknowledgment
   Number field of the feedback is not valid.

      +---+---+---+---+---+---+---+---+
      |  Opt Type = 3 |  Opt Len = 0  |
      +---+---+---+---+---+---+---+---+

   A compressor MUST NOT use the MSN Acknowledgment Number of the feedback
   to find the corresponding sent header when this option is present.  Consequently,
   a NACK or

   When this option is used, the Acknowledgment Number field of the
   FEEDBACK-2 format is set to zero.  Consequently, a STATIC-NACK NACK or a STATIC-
   NACK feedback type sent with the MSN-NOT-VALID ACKNUMBER-NOT-VALID option is
   equivalent to a STATIC-NACK with respect to the type of context
   repair requested by the decompressor.

   The MSN-NOT-VALID ACKNUMBER-NOT-VALID option MUST NOT appear more than once in the
   FEEDBACK-2 format and MUST NOT appear in the same feedback element as
   the MSN option, otherwise the decompressor compressor MUST discard the entire
   feedback element.

6.9.2.3.  The MSN option

   The MSN option provides 8 additional bits of MSN.

      +---+---+---+---+---+---+---+---+
      |  Opt Type = 4 |  Opt Len = 1  |
      +---+---+---+---+---+---+---+---+
      |              MSN              |
      +---+---+---+---+---+---+---+---+

   the bits in the MSN option are concatenated with the MSN bits in the
   FEEDBACK-2 format, with the bits in the FEEDBACK-2 format being the
   most significant bits.  The MSN option MAY appear more than once in
   the FEEDBACK-2 format, in which case the MSN is given by
   concatenating the MSN fields of each occurance of the MSN option.

   The MSN option MUST NOT appear in the same feedback element as the
   MSN-NOT-VALID option, otherwise the decompressor MUST discard the
   entire feedback element.

6.9.2.4.  The CONTEXT_MEMORY Feedback Option

   The CONTEXT_MEMORY option informs the compressor that the
   decompressor does not have sufficient memory resources to handle the
   context of the packet flow, as the flow is currently compressed.

        0   1   2   3   4   5   6   7
      +---+---+---+---+---+---+---+---+
      |  Opt Type = 9 |  Opt Len = 0  |
      +---+---+---+---+---+---+---+---+

   When receiving a CONTEXT_MEMORY option, the compressor SHOULD take
   actions to compress the packet flow in a way that requires less
   decompressor memory resources, or stop compressing the packet flow.
   The CONTEXT_MEMORY option MUST NOT appear more than once in the
   FEEDBACK-2 format, otherwise the decompressor compressor MUST discard the entire
   feedback element.

6.9.2.5.

6.9.2.4.  The CONTROL_FIELDS_UPDATE CLOCK_RESOLUTION Feedback Option

   The CONTROL_FIELDS_UPDATE CLOCK_RESOLUTION option informs the compressor that of the clock
   resolution of the decompressor.  It also informs whether the
   decompressor considers its set supports timer-based compression of control fields to be invalid, the RTP TS timestamp
   (see Section 6.6.9) or
   that those have not been established.

        0   1   2   3   4   5   6   7 not.  The CLOCK_RESOLUTION option is
   applicable per channel, i.e. it applies to any context associated
   with a profile for which the option is relevant between one
   compressor and decompressor pair.

      +---+---+---+---+---+---+---+---+
      | Opt Type = 10 |  Opt Len = 0 1  |
      +---+---+---+---+---+---+---+---+

   When receiving
      | clock resolution (ms)         |
      +---+---+---+---+---+---+---+---+

   The smallest clock resolution which can be indicated is 1
   millisecond.  The value zero has a special meaning: it indicates that
   the decompressor cannot do timer-based compression of the CONTROL_FIELDS_UPDATE RTP
   Timestamp.  The CLOCK_RESOLUTION option MUST NOT appear more than
   once in a feedback
   element, the FEEDBACK-2 format, otherwise the compressor SHOULD select a packet format that can update
   the control fields covered by the control_crc3 encoding method
   Section 6.6.11.

   The CONTROL_FIELDS_UPDATE option MUST NOT appear more than once in
   the FEEDBACK-2 format, otherwise the decompressor MUST discard
   the entire feedback element.

6.9.2.6.

6.9.2.5.  Unknown option types

   If an option type unknown to the compressor other than those defined in this document is
   encountered, it must
   continue parsing the rest of the FEEDBACK packet, which is possible
   since the length of the option is explicit, but compressor MUST otherwise ignore discard the unknown option. entire feedback element.

7.  Security Considerations

   Because encryption eliminates the redundancy that header compression
   schemes try to exploit, there is some inducement to forego encryption
   of headers in order to enable operation over low-bandwidth links.
   However, for those cases where encryption of data (and not headers)
   is sufficient, RTP does specify an alternative encryption method in
   which only the RTP payload is encrypted and the headers are left in
   the clear.  That would still allow header compression to be applied.

   ROHC compression is transparent with regard to the RTP Sequence
   Number and RTP Timestamp fields, so the values of those fields can be
   used as the basis of payload encryption schemes (e.g., for
   computation of an initialization vector).

   A malfunctioning or malicious header compressor could cause the
   header decompressor to reconstitute packets that do not match the
   original packets but still have valid IP, UDP and RTP headers and
   possibly also valid UDP checksums.  Such corruption may be detected
   with end-to-end authentication and integrity mechanisms which will
   not be affected by the compression.  Moreover, this header
   compression scheme uses an internal checksum for verification of
   reconstructed headers.  This reduces the probability of producing
   decompressed headers not matching the original ones without this
   being noticed.

   Denial-of-service attacks are possible if an intruder can introduce
   (for example) bogus IR, IR-PD IR or FEEDBACK packets onto the link and thereby
   cause compression efficiency to be reduced.  However, an intruder
   having the ability to inject arbitrary packets at the link layer in
   this manner raises additional security issues that dwarf those
   related to the use of header compression.

8.  IANA Considerations

   The following ROHC profile identifiers have been reserved by the IANA
   for the profiles defined in this document:
     Identifier        Profile
     ----------        -------
     0x0101            ROHCv2 RTP
     0x0102            ROHCv2 UDP
     0x0103            ROHCv2 ESP
     0x0104            ROHCv2 IP
     0x0107            ROHCv2 RTP/UDP-Lite
     0x0108            ROHCv2 UDP-Lite

   <# Editor's Note: To be removed before publication #>

   ROHC profile identifiers must be reserved by the IANA for the updated
   profiles defined in this document.  A suggested registration in the
   "RObust Header Compression (ROHC) Profile Identifiers" name space
   would then be:

     Profile Identifier   Usage                      Reference
     ------------------   ----------------------     ---------
     0x0000               ROHC uncompressed          RFC 3095
     0xnn00               Reserved
     0x0001               ROHC RTP                   RFC 3095
     0x0101               ROHCv2 RTP                 [RFCXXXX (this)]
     0xnn01               Reserved
     0x0002               ROHC UDP                   RFC 3095
     0x0102               ROHCv2 UDP                 [RFCXXXX (this)]
     0xnn02               Reserved
     0x0003               ROHC ESP                   RFC 3095
     0x0103               ROHCv2 ESP                 [RFCXXXX (this)]
     0xnn03               Reserved
     0x0004               ROHC IP                    RFC 3843
     0x0104               ROHCv2 IP                  [RFCXXXX (this)]
     0xnn04               Reserved
     0x0005               ROHC LLA                   RFC 4362
     0x0105               ROHC LLA with R-mode       RFC 3408
     0xnn05               Reserved
     0x0006               ROHC TCP                   RFC4996
     0xnn06               To be Assigned by IANA               Reserved
     0x0007               ROHC RTP/UDP-Lite          RFC 4019
     0x0107               ROHCv2 RTP/UDP-Lite        [RFCXXXX (this)]
     0xnn07               Reserved
     0x0008               ROHC UDP-Lite              RFC 4019
     0x0108               ROHCv2 UDP-Lite            [RFCXXXX (this)]
     0xnn08               Reserved
     0x0009-0xnn7F        To be Assigned by IANA
     0xnn80-0xnnFE        To be Assigned by IANA
     0xnnFF               Reserved

9.  Acknowledgements

   The authors would like to thank Carl Knutsson, Haipeng Jin and Rohit
   Kapoor for comments and discussions about these profiles.  Also
   thanks to the many people who have contributed to the previous ROHC
   specifications.

10.  References

10.1.  Normative References

   [I-D.ietf-rohc-formal-notation]
              Pelletier, G. and R. Finking, "Formal Notation for Robust
              Header Compression (ROHC-FN)",
              draft-ietf-rohc-formal-notation-13 (work in progress),
              December 2006.

   [I-D.ietf-rohc-rfc3095bis-framework]
              Jonsson, L., "The RObust Header Compression (ROHC)
              Framework", draft-ietf-rohc-rfc3095bis-framework-04 (work
              in progress), November 2006.

   [RFC0768]  Postel, J., "User Datagram Protocol", STD 6, RFC 768,
              August 1980.

   [RFC0791]  Postel, J., "Internet Protocol", STD 5, RFC 791,
              September 1981.

   [RFC2004]  Perkins, C., "Minimal Encapsulation within IP", RFC 2004,
              October 1996.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC2460]  Deering, S. and R. Hinden, "Internet Protocol, Version 6
              (IPv6) Specification", RFC 2460, December 1998.

   [RFC2784]  Farinacci, D., Li, T., Hanks, S., Meyer, D., and P.
              Traina, "Generic Routing Encapsulation (GRE)", RFC 2784,
              March 2000.

   [RFC2890]  Dommety, G., "Key and Sequence Number Extensions to GRE",
              RFC 2890, September 2000.

   [RFC3550]  Schulzrinne, H., Casner, S., Frederick, R., and V.
              Jacobson, "RTP: A Transport Protocol for Real-Time
              Applications", STD 64, RFC 3550, July 2003.

   [RFC3828]  Larzon, L-A., Degermark, M., Pink, S., Jonsson, L-E., and
              G. Fairhurst, "The Lightweight User Datagram Protocol
              (UDP-Lite)", RFC 3828, July 2004.

   [RFC4019]  Pelletier, G., "RObust Header Compression (ROHC): Profiles
              for User Datagram Protocol (UDP) Lite", RFC 4019,
              April 2005.

   [RFC4302]  Kent, S., "IP Authentication Header", RFC 4302,
              December 2005.

   [RFC4303]  Kent, S., "IP Encapsulating Security Payload (ESP)",
              RFC 4303, December 2005.

   [RFC4995]  Jonsson, L-E., Pelletier, G., and K. Sandlund, "The RObust
              Header Compression (ROHC) Framework", RFC 4995, July 2007.

   [RFC4997]  Finking, R. and G. Pelletier, "Formal Notation for RObust
              Header Compression (ROHC-FN)", RFC 4997, July 2007.

10.2.  Informative References

   [RFC3095]  Bormann, C., Burmeister, C., Degermark, M., Fukushima, H.,
              Hannu, H., Jonsson, L-E., Hakenberg, R., Koren, T., Le,
              K., Liu, Z., Martensson, A., Miyazaki, A., Svanbro, K.,
              Wiebke, T., Yoshimura, T., and H. Zheng, "RObust Header
              Compression (ROHC): Framework and four profiles: RTP, UDP,
              ESP, and uncompressed", RFC 3095, July 2001.

   [RFC3843]  Jonsson, L-E. and G. Pelletier, "RObust Header Compression
              (ROHC): A Compression Profile for IP", RFC 3843,
              June 2004.

   [RFC4224]  Pelletier, G., Jonsson, L-E., and K. Sandlund, "RObust
              Header Compression (ROHC): ROHC over Channels That Can
              Reorder Packets", RFC 4224, January 2006.

Appendix A.  Detailed classification of header fields

   Header compression is possible thanks due to the fact that most header
   fields do not vary randomly from packet to packet.  Many of the
   fields exhibit static behavior or change in a more or less
   predictable way.  When designing a header compression scheme, it is
   of fundamental importance to understand the behavior of the fields in
   detail.

   In this appendix, all IP, UDP, UDP-Lite, RTP and ESP header fields
   are classified and analyzed in two steps.  First, we have a general
   classification in Appendix A.1 where the fields are classified on the
   basis of stable knowledge and assumptions.  A more detailed analysis
   of the change characteristics of the changing fields is then done in
   Appendix A.2.

Appendix A.1.  General classification

   Fields are classified as belonging to one of the following classes:

   INFERRED - These fields contain values that can be inferred from
   other values, for example the size of the frame carrying the packet,
   and thus do not have to be handled at all by the compression scheme.

   STATIC-DEF - These fields are expected to be constant throughout the
   lifetime of the packet stream and whose values can be used to define
   a packet stream.  They are in general communicated only at the
   initialization of the context.

   STATIC-KNOWN - These fields are expected to have well-known values
   and therefore do not need to be communicated at all.

   CHANGING - These fields are expected to vary in some way: randomly,
   within a limited value set or range, or in some other manner.

   In this section, the fields of the various protocol headers are
   assigned to one of these classes.  For all fields except those
   classified as CHANGING, the motives for the classification are also
   stated.  In Appendix A.2, CHANGING fields are further examined and
   classified on the basis of their expected change behavior.

Appendix A.1.1.  IPv4 header fields

   +---------------------+-------------+----------------+
   | Field               | Size (bits) | Class          |
   +---------------------+-------------+----------------+
   | Version             | 4           | STATIC-KNOWN   |
   | Header Length       | 4           | STATIC-KNOWN   |
   | Type Of Service     | 8           | CHANGING       |
   | Packet Length       | 16          | INFERRED       |
   | Identification      | 16          | CHANGING       |
   | Reserved flag       | 1           | STATIC-KNOWN   |
   | Don't Fragment flag | 1           | CHANGING       |
   | More Fragments flag | 1           | STATIC-KNOWN   |
   | Fragment Offset     | 13          | STATIC-KNOWN   |
   | Time To Live        | 8           | CHANGING       |
   | Protocol            | 8           | STATIC-DEF     |
   | Header Checksum     | 16          | INFERRED       |
   | Source Address      | 32          | STATIC-DEF     |
   | Destination Address | 32          | STATIC-DEF     |
   +---------------------+-------------+----------------+

   Version
      The version field states which IP version is used.  Packets with
      different values in this field must be handled by different IP
      stacks.  All packets of a packet stream must therefore be of the
      same IP version.  Accordingly, the field is classified as STATIC-
      KNOWN.

   Header Length

      As long no options are present this appendix, all fields in the IP header, the header length
      is constant and well known.  If there headers compressible by these
   profiles are options, the fields
      could be CHANGING or STATIC-DEF, but it classified and analyzed.  The analysis is assumed here based on
   behavior for the types of traffic that there are no options.  The field is therefore classified as STATIC-
      KNOWN.

   Packet Length

      Information about packet length is expected to be provided by the
      link layer.  The most
   frequently compressed (e.g.  RTP field behavior is therefore based on voice
   and/or video traffic behavior).

   Fields are classified as INFERRED.

   Flags

      The Reserved flag must be set belonging to zero and is therefore classified
      as STATIC-KNOWN.  The Don't Fragment (DF) flag will changes rarely
      and is therefore classified as CHANGING.  Finally, one of the More
      Fragments (MF) flag is expected to following classes:

   INFERRED - These fields contain values that can be zero because IP fragments
      will inferred from
   other values, for example the size of the frame carrying the packet,
   and thus do not have to be included in compressed by ROHC.  The More Fragments flag is
      therefore classified as STATIC-KNOWN.

   Fragment Offset

      Under the assumption that no fragmentation occurs, packets.

   STATIC These fields are expected to be constant throughout the fragment
      offset is always zero.  The field is therefore classified as
      STATIC-KNOWN.

   Protocol

      This field will have
   lifetime of the same value flow and any change to them only has to be possible
   to convey in all packets IR packets.

   STATIC-DEF - These fields are expected to be constant throughout the
   lifetime of the flow and whose values can be used to define a packet
      stream flow.
   They are only sent in IR packets.

   STATIC-KNOWN - These fields are expected to have well-known values
   and is therefore classified as STATIC-DEF.

   Header Checksum

      The header checksum protects individual hops from processing a
      corrupted header.  When almost all IP header information is
      compressed away, there is no point in having this additional
      checksum; instead it can do not need to be regenerated communicated at the decompressor side.
      The field is therefore classified as INFERRED.

   Source and Destination addresses all.

   SEMISTATIC These fields are part unchanged most of the definition time.  However,
   occasionally the value changes but will revert to its original value.
   For ROHCv2, the values of a stream such fields do not need to be possible to
   change with the smallest compressed packet formats, but should be
   possible to change via slightly larger compressed packets.

   RARELY CHANGING (RC) These are fields that change their values
   occasionally and must thus then keep their new values.  For ROHCv2, the values
   of such fields do not need to be constant possible to change with the smallest
   compressed packet formats, but should be possible to change via
   slightly larger compressed packets.

   IRREGULAR These are the fields for which no useful change pattern can
   be identified and should be transmitted uncompressed in all packets
   compressed packets.

   PATTERN These field that change between each packet, but change in the stream.  The fields are
      therefore classified as STATIC-DEF. a
   predictable pattern.

Appendix A.1.2.  IPv6 header fields

   +---------------------+-------------+----------------+ A.1.  IPv4 Header Fields

   +------------------------+----------------+
   | Field                  | Size (bits) | Class          |
   +---------------------+-------------+----------------+
   +------------------------+----------------+
   | Version                | 4 STATIC-KNOWN   |
   | Header Length          | STATIC-KNOWN   |
   | Type Of Service        | RC             |
   | Packet Length          | INFERRED       |
   | Identification         |                |
   |             Sequential | PATTERN        |
   |             Seq. swap  | PATTERN        |
   |             Random     | IRREGULAR      |
   |             Zero       | STATIC         |
   | Reserved flag          | STATIC-KNOWN   |
   | Traffic Class       | 8 Don't Fragment flag    | CHANGING RC             |
   | Flow Label More Fragments flag    | 20 STATIC-KNOWN   | STATIC-DEF
   | Fragment Offset        | Payload Length STATIC-KNOWN   | 16
   | INFERRED Time To Live           | RC             | Next Header
   | 8 Protocol               | STATIC-DEF     |
   | Hop Limit           | 8 Header Checksum        | CHANGING INFERRED       |
   | Source Address         | 128         | STATIC-DEF     |
   | Destination Address    | 128         | STATIC-DEF     |
   +---------------------+-------------+----------------+
   +------------------------+----------------+

   Version
      The version field states which IP version is used.  Packets with
      different values used, and is set to
      the value four.

   Header Length
      As long no options are present in this the IP header, the header length
      is constant with the value five.  If there are options, the field must
      could be handled RC or STATIC-DEF, but only option-less headers are
      compressed by different IP
      stacks.  All packets ROHCv2 profiles.  The field is therefore classified
      as STATIC-KNOWN.

   Type Of Service
      The Type Of Service field is expected to be constant during the
      lifetime of a flow or to change relatively seldom.

   Packet Length
      Information about packet stream must therefore length is expected to be of the
      same IP version.  Accordingly, provided by the
      link layer.  The field is therefore classified as STATIC-
      KNOWN.

   Flow Label

      This INFERRED.

   IPv4 Identification
      The Identification field may be (IP ID) is used to identify packets belonging to what
      fragments constitute a specific
      packet stream.  If datagram when reassembling fragmented
      datagrams.  The IPv4 specification does not used, the value should be set to zero.
      Otherwise, all packets belonging specify exactly how
      this field is to be assigned values, only that each packet should
      get an IP ID that is unique for the same stream must have source-destination pair and
      protocol for the
      same value time the datagram (or any of its fragments) could
      be alive in the network.  This means that assignment of IP ID
      values can be done in various ways, but the expected behaviors
      have been separated into four classes.

      Sequential
         In this field.  The field is therefore classified as
      STATIC-DEF.

   Payload Length

      Information about packet length (and, consequently, payload
      length) behavior, the IP-ID is expected to be provided increment by one for
         most packets, but may increment by a value larger than one,
         depending on the link layer.  The field
      is therefore classified as INFERRED.

   Next Header

      This field will have behavior of the same value transmitting IPv4 stack.
      Sequential Swapped
         When using this behavior, the IP-ID behaves as in all packets the
         Sequential behavior, but the two bytes of IP-ID are byte
         swapped.  Therefore, the IP-ID can be swapped before
         compression to make it behave exactly as the Sequential
         behavior.
      Random
         Some IP stacks assign IP ID values using a packet
      stream and pseudo-random number
         generator.  There is therefore classified as STATIC-DEF.

   Source and Destination addresses
      These fields are part of thus no correlation between the definition ID values
         of a stream subsequent datagrams, and must thus
      be constant therefore there is no way to
         predict the IP ID value for all packets in the stream.  The fields are
      therefore classified as STATIC-DEF.

Appendix A.1.3.  UDP next datagram.  For header fields

   +------------------+-------------+-------------+
   | Field            | Size (bits) | Class       |
   +------------------+-------------+-------------+
   | Source Port      | 16          | STATIC-DEF  |
   | Destination Port | 16          | STATIC-DEF  |
   | Length           | 16          | INFERRED    |
   | Checksum         | 16          | CHANGING    |
   +------------------+-------------+-------------+

   Source and Destination ports

      These fields are part of
         compression purposes, this means that the definition IP ID field needs to
         be sent uncompressed with each datagram, resulting in two extra
         octets of header.

      Zero
         This behavior, although not a stream and must thus
      be constant for legal implementation of IPv4 is
         sometimes seen in existing IPv4 stacks.  When this behavior is
         used, all IP packets in have the stream. IP-ID value set to zero.

   Flags
      The fields are Reserved flag must be set to zero and is therefore classified
      as STATIC-DEF.

   Length

      This field is redundant STATIC-KNOWN.  The Don't Fragment (DF) flag will changes rarely
      and is therefore classified as INFERRED.

Appendix A.1.4.  UDP-Lite header fields

   +-------------------+-------------+-------------+
   | Field             | Size (bits) | Class       |
   +-------------------+-------------+-------------+
   | Source Port       | 16          | STATIC-DEF  |
   | Destination Port  | 16          | STATIC-DEF  |
   | Checksum Coverage | 16          | INFERRED    |
   |                   |             | STATIC-DEF  |
   |                   |             | CHANGING    |
   | Checksum          | 16          | CHANGING    |
   +-------------------+-------------+-------------+

   Source RC.  Finally, the More Fragments
      (MF) flag is expected to be zero because IP fragments will not be
      compressed by ROHC and Destination Port

      Same is therefore classified as for UDP Appendix A.1.3.

   Source STATIC-KNOWN.

   Fragment Offset
      Under the assumption that no fragmentation occurs, the fragment
      offset is always zero and Destination ports
      Same is therefore classified as for UDP Appendix A.1.3.

   Checksum Coverage

      This STATIC-KNOWN.

   Time To Live
      Time To Live field specifies which part of the UDP-Lite datagram is
      covered by expected to be constant during the checksum.  It may have a value lifetime
      of zero a flow or be equal to the datagram length if the checksum covers the entire datagram,
      or it may have any value alternate between eight octets and the length of
      the datagram to specify the a limited number of octets protected by the
      checksum, calculated from the first octet of the UDP-Lite header.
      The value of this field may vary for each packet, and this makes values due
      to route changes.

   Protocol
      This field will have the same value unpredictable from in all packets of a header-compression perspective. flow and
      is therefore classified as STATIC-DEF.

   Header Checksum
      The information used for the calculation of the UDP-Lite header checksum protects individual hops from processing a
      corrupted header.  When almost all IP header information is governed by the value of the checksum coverage and minimally
      includes
      compressed away, there is no point in having this additional
      checksum; instead it can be regenerated at the UDP-Lite header. decompressor side.
      The checksum field is therefore classified as INFERRED.

   Source and Destination addresses
      These fields are part of the definition of a changing field
      that flow and must always thus be sent as-is.
      constant for all packets in the flow.

Appendix A.1.5.  RTP header fields

   +-----------------+-------------+----------------+ A.2.  IPv6 Header Fields
   +----------------------+----------------+
   | Field                | Size (bits) | Class          |
   +-----------------+-------------+----------------+
   +----------------------+----------------+
   | Version              | 2           | STATIC-KNOWN   |
   | Padding         | 1           | CHANGING       |
   | Extension       | 1           | CHANGING       |
   | CSRC Counter    | 4           | CHANGING Traffic Class        | RC             | Marker
   | 1 Flow Label           | CHANGING STATIC-DEF     |
   | Payload Type    | 7           | CHANGING       |
   | Sequence Number Length       | 16 INFERRED       | CHANGING
   | Next Header          | Timestamp STATIC-DEF     | 32
   | CHANGING Hop Limit            | RC             | SSRC
   | 32 Source Address       | STATIC-DEF     |
   | CSRC            | 0(-480) Destination Address  | CHANGING STATIC-DEF     |
   +-----------------+-------------+----------------+
   +----------------------+----------------+

   Version

      Only one working RTP
      The version exists, namely field states which IP version 2. is used, and is set to
      the value six.

   Traffic Class
      The Traffic Class field is expected to be constant during the
      lifetime of a flow or to change relatively seldom.

   Flow Label
      This field may be used to identify packets belonging to a specific
      flow.  If not used, the value should be set to zero.  Otherwise,
      all packets belonging to the same flow must have the same value in
      this field.  The field is therefore classified as STATIC-KNOWN.

   Padding
      The use of this field is application-dependent, but when STATIC-DEF.

   Payload Length
      Information about packet length (and, consequently, payload
      padding is used it
      length) is likely expected to be present in most or all packets. provided by the link layer.  The field
      is therefore classified as CHANGING to allow for the rare case
      where this INFERRED.

   Next Header
      This field is updated.

   Extension

      If RTP extensions are used by will have the application, these extensions
      are likely to be present same value in all packets (but the use of extensions
      is very uncommon).  However, for safety's sake this field a flow and
      is therefore classified as CHANGING to allow for the rare case where this STATIC-DEF.

   Hop Limit
      The Hop Limit field is changed expected to be constant during the lifetime
      of a flow or to alternate between a limited number of values due
      to route changes.

   Source and Destination addresses
      These fields are part of the definition of a flow and must thus be
      constant for all packets in the flow.

   SSRC

      This field is  The fields are therefore
      classified as STATIC-DEF.

Appendix A.3.  UDP Header Fields

   +------------------+-------------+
   | Field            | Class       |
   +------------------+-------------+
   | Source Port      | STATIC-DEF  |
   | Destination Port | STATIC-DEF  |
   | Length           | INFERRED    |
   | Checksum         |             |
   |         Disabled | STATIC      |
   |         Enabled  | IRREGULAR   |
   +------------------+-------------+

   Source and Destination ports
      These fields are part of the definition of a stream flow and must thus be
      constant for all packets in the stream. flow.

   Length
      Information about packet length is expected to be provided by the
      link layer.  The field is therefore classified as STATIC-DEF. INFERRED.

   Checksum
      The checksum can be optional.  If disabled, its value is
      constantly zero and can be compressed away.  If enabled, its value
      depends on the payload, which for compression purposes is
      equivalent to it changing randomly with every packet.

Appendix A.1.6.  ESP header fields

   +------------------+-------------+-------------+ A.4.  UDP-Lite Header Fields

   +--------------------+-------------+
   | Field              | Size (bits) | Class       |
   +------------------+-------------+-------------+
   +--------------------+-------------+
   | SPI Source Port        | 32 STATIC-DEF  |
   | Destination Port   | STATIC-DEF  |
   | Sequence Number Checksum Coverage  | 32             | CHANGING
   |
   +------------------+-------------+-------------+

   SPI

      This field is used to identify a specific flow and only changes
      when the sequence number wraps around,        Zero        | STATIC-DEF  |
   |        Constant    | INFERRED    |
   |        Variable    | IRREGULAR   |
   | Checksum           | IRREGULAR   |
   +--------------------+-------------+

   Source and is therefore classified
      as STATIC-DEF.

Appendix A.2.  Analysis of change patterns of header Destination Port
      These fields

   To design suitable mechanisms for efficient compression are part of all header
   fields, their change patterns the definition of a flow and must thus be analyzed.  For this reason, an
   extended classification is done based on the general classification
   in Appendix A.1, considering the fields which were labeled CHANGING
      constant for all packets in that classification.  Different applications will use the fields flow.

   Checksum Coverage
      The Checksum Coverage field may behave in different ways, which ways: it may affect their behavior.  For the fields
   whose behavior is variable, typical behavior for conversational audio
   and video will be discussed.

   The CHANGING fields are separated into five different subclasses:

      NONCHANGING These are fields that were classified as CHANGING on
      have a
      general basis, but value of zero, it may under some conditions be static throughout
      the flow and therefore be completely compressed away.
      SEMISTATIC These fields are unchanged most of the time.  However,
      occasionally equal to the datagram length, or
      it may have any value changes but will revert to its original
      value.
      RARELY-CHANGING (RC) These are fields that change their values
      occasionally between eight octets and then keep their new values.
      IRREGULAR These, finally, are the fields for which no useful
      change pattern can length of the
      datagram.  From a compression perspective, this field is expected
      to either be identified.
      PATTERN These entirely predictable (for the cases where it follows
      the same behavior as the UDP Length field that or where it takes on a
      constant value) or either to change between randomly for each packet, but change in packet
      (making the value unpredictable from a predictable pattern.

   Table A.1 classifies header-compression
      perspective).  For all cases, the CHANGING fields on behavior itself is not expected
      to change for this field during the basis lifetime of their
   expected a packet flow, or
      to change patterns.

   +------------------------+-------------+ relatively seldom.

   Checksum
      The information used for the calculation of the UDP-Lite checksum
      is governed by the value of the checksum coverage and minimally
      includes the UDP-Lite header.  The checksum is a changing field
      that must always be sent as-is.

Appendix A.5.  RTP Header Fields

   +----------------+----------------+
   | Field          | Class          |
   +========================+=============+
   |             Sequential | PATTERN     |
   |             -----------+-------------+
   | IPv4 Id:    Seq. swap  | PATTERN     |
   |             -----------+-------------+
   |             Random     | IRREGULAR   |
   |             -----------+-------------+
   |             Zero       | NONCHANGING |
   +------------------------+-------------+
   | IP TOS / Tr. Class     | RC          |
   +------------------------+-------------+
   +----------------+----------------+
   | IP TTL / Hop Limit Version        | RC STATIC-KNOWN   |
   +------------------------+-------------+
   | IP Don't Fragment Padding        | RC             |
   +------------------------+-------------+
   |               Disabled | NONCHANGING |
   | UDP Checksum: ---------+-------------+
   |               Enabled  | IRREGULAR   |
   +------------------------+-------------+
   | UDP-Lite Checksum      | IRREGULAR   |
   +------------------------+-------------+
   |                Case #1 | CHANGING    |
   | UDP-Lite     ----------+-------------+
   | Checksum:      Case #2 Extension      | RC             |
   | Coverage     ----------+-------------+
   |                Case #3 | IRREGULAR   |
   +------------------------+-------------+
   | RTP CSRC Count Counter   | RC             |
   +------------------------+-------------+
   | RTP Marker         | SEMISTATIC     |
   +------------------------+-------------+
   | RTP Payload Type   | RC             |
   +------------------------+-------------+
   | RTP Extension          | RC          |
   +------------------------+-------------+
   | RTP Padding            | RC          |
   +------------------------+-------------+
   | RTP Sequence Number    | Number| PATTERN        |
   +------------------------+-------------+
   | RTP Timestamp      | PATTERN        |
   +------------------------+-------------+
   | RTP CSRC List: SSRC           | RC STATIC-DEF     |
   +------------------------+-------------+
   | ESP Sequence Number CSRC           | PATTERN RC             |
   +------------------------+-------------+
   Table A.1 : Classification
   +----------------+----------------+

   Version
      This field is expected to have the value two and the field is
      therefore classified as STATIC-KNOWN.

   Padding
      The use of CHANGING header fields this field is application-dependent, but when payload
      padding is used it is likely to be present in most or all packets.
      The following subsections discuss field is classified as RC to allow for the various header fields in
   detail.  Note that table A.1 and case where the discussions below do not
   consider changes caused
      value of this field is changes.

   Extension
      If RTP extensions are used by loss or reordering before the application, these extensions
      are often present in all packets, although the use of extensions
      is infrequent.  To allow efficient compression
   point.

Appendix A.2.1.  IPv4 Identification

   The Identification of a flow using
      extensions in only a few packets, this field (IP ID) is classified as RC.

   CSRC Count
      This field indicates the number of CSRC items present in the IPv4 header CSRC
      list.  This number is there expected to
   identify which fragments constitute be mostly constant on a datagram packet-
      to-packet basis and when reassembling
   fragmented datagrams.  The IPv4 specification does not specify
   exactly how it changes, change by small amounts.  As
      long as no RTP mixer is used, the value of this field is to will be assigned values, only that each
   packet should get an IP ID that is unique for the source-destination
   pair and protocol for
      zero.

   Marker
      For audio, the time marker bit should be set only in the datagram (or any first packet
      of its fragments)
   could a talkspurt, while for video it should be alive set in the network. last
      packet of every picture.  This means that assignment of IP ID
   values can be done in various ways, but the expected behaviors have
   been separated into four classes.

   Sequential

      In this behavior, both cases the IP-ID RTP
      marker is classified as SEMISTATIC.

   Payload Type
      Applications could adapt to congestion by changing payload type
      and/or frame sizes, but that is not expected to increment happen frequently,
      so this field is classified as RC.

   RTP Sequence Number
      The RTP Sequence Number will be incremented by one for
      most packets, but may increment each packet
      sent.

   Timestamp
      In the audio case:
         As long as there are no pauses in the audio stream, the RTP
         Timestamp will be incremented by a value larger than one,
      depending on constant value,
         corresponding to the behavior number of samples in the transmitting IPv4 stack.

   Sequential Swapped speech frame.  It
         will thus mostly follow the RTP Sequence Number.  When using this behavior, there
         has been a silent period and a new talkspurt begins, the IP-ID behaves as
         timestamp will jump in proportion to the Sequential
      bahvior, but length of the silent
         period.  However, the increment will probably be within a
         relatively limited range.
      In the video case:
         Between two bytes of IP-ID are byte swapped.  Therefore, consecutive packets, the IP-ID can timestamp will either be swapped before compression
         unchanged or increase by a multiple of a fixed value
         corresponding to make it behave
      exactly as the Sequential behavior.

   Random

      Some IP stacks assign IP ID values using picture clock frequency.  The timestamp
         can also decrease by a pseudo-random number
      generator.  There is thus no correlation between the ID values multiple of
      subsequent datagrams, and therefore there is no way to predict the
      IP ID fixed value for the next datagram.  For header compression
      purposes, this means that the IP ID field needs to be sent
      uncompressed with each datagram, resulting in two extra octets of
      header.

   Zero certain
         coding schemes.  This behavior, although not increase, expressed as a legal implementation multiple of IPv4 the
         picture clock frequency, is
      sometimes seen in existing IPv4 stacks.  When this behavior most cases very limited.

   SSRC
      This field is
      used, part of the definition of a flow and must thus be
      constant for all IP packets have in the IP-ID value set to zero.

Appendix A.2.2.  IP Traffic Class / Type-Of-Service flow.  The Traffic-Class (IPv6) or Type-Of-Service (IPv4) field is therefore
      classified as STATIC-DEF.

   Contributing Sources (CSRC)
      The participants in a session, who are identified by the CSRC
      fields, are usually expected to be constant during the lifetime of unchanged on a packet stream or to packet-to-packet
      basis, but will infrequently change
   relatively seldom. by a few additions and/or
      removals.

Appendix A.2.3.  IP Hop-limit / Time-To-Live

   The Hop-Limit (IPv6) or Time-To-Live (IPv4) field is expected A.6.  ESP Header Fields

   This classification applies both to be
   constant during the lifetime encrypted ESP header used in
   profile 0x0103 and the NULL-encrypted ESP header used in all the
   profiles of a packet stream or this document.

   +------------------+-------------+
   | Field            | Class       |
   +------------------+-------------+
   | SPI              | STATIC-DEF  |
   | Sequence Number  | PATTERN     |
   +------------------+-------------+

   SPI
      This field is used to alternate
   between identify a limited specific flow and only changes
      when the sequence number of values due to route changes.

Appendix A.2.4.  IPv4 Don't Fragment wraps around, and is therefore classified
      as STATIC-DEF.

   ESP Sequence Number
      The Don't Fragment flag in IPv4 ESP Sequence Number will be incremented by one for each packet
      sent.

Appendix A.7.  IPv6 Extension Header Fields

   +-----------------------+---------------+
   | Field                 | Class         |
   +-----------------------+---------------+
   | Next Header           | STATIC-DEF    |
   | Ext Hdr Len           |               |
   |      Routing          | STATIC-DEF    |
   |      Hop-by-hop       | STATIC        |
   |      Destination      | STATIC        |
   | Options               |               |
   |      Routing          | STATIC-DEF    |
   |      Hop-by-hop       | RC            |
   |      Destination      | RC            |
   +-----------------------+---------------+
   Next Header
      This field will seldom change, have the same value in all packets of a flow and
      is therefore classified as RC.

Appendix A.2.5.  UDP Checksum

   The UDP checksum is optional.  If disabled, its value STATIC-DEF.

   Ext Hdr Len
      For the Routing header, it is constantly
   zero and could be compressed away.  If enabled, its value depends on expected that the payload, which length remains
      constant for compression purposes is equivalent to it
   changing randomly with every packet.

Appendix A.2.6.  UDP-Lite Checksum Coverage

   The Checksum Coverage field may behave in different ways: it may have
   a value the duration of zero, it may be equal to the datagram length, or it may
   have any value between eight octets flow, and a change in the length of the datagram.
   From
      should be classified as a compression perspective, this field new flow by the ROHC compressor.  For
      Hop-by-hop and Destination options headers, the length is expected
      to either remain static, but can be
   entirely predictable (for updated by an IR packet.

   Options
      For the cases where Routing header, it follows is expected that the same
   behavior as option content
      remains constant for the UDP Length field or where it takes on duration of the flow, and a constant
   value) or either change in the
      routing information should be classified as a new flow by the ROHC
      compressor.  For Hop-by-hop and Destination options headers, the
      options are expected to remain static, but can be updated by an IR
      packet.

Appendix A.8.  GRE Header Fields

   +--------------------+---------------+
   | Field              | Class         |
   +--------------------+---------------+
   | C flag             | STATIC        |
   | K flag             | STATIC        |
   | S flag             | STATIC        |
   | R flag             | STATIC-KNOWN  |
   | Reserved0, Version | STATIC-KNOWN  |
   | Protocol           | STATIC-DEF    |
   | Checksum           | IRREGULAR     |
   | Reserved           | STATIC-KNOWN  |
   | Sequence Number    | PATTERN       |
   | Key                | STATIC-DEF    |
   +--------------------+---------------+

   Flags
      The four flag bits are not expected to change randomly for each packet (making the value
   unpredictable from a header-compression perspective).  For all cases, duration of
      the behavior itself flow, and the R flag is not expected to change always be set to zero.

   Reserved0, Version
      Both these fields are expected to be set to zero for this the duration
      of any flow.

   Protocol
      This field during will have the lifetime same value in all packets of a packet flow, or to change relatively seldom.

Appendix A.2.7.  UDP-Lite flow and
      is therefore classified as STATIC-DEF.

   Checksum

   As opposed to the UDP checksum,
      When the UDP-Lite checksum field is not optional
   and present, it cannot be disabled.  Its value depends on the payload and on
   the checksum coverage field, which for compression purposes is
   equivalent expected to it changing randomly with every packet.

Appendix A.2.8.  RTP CSRC Counter

   This is a counter indicating the number of CSRC items present in the
   CSRC list.  This number behave
      unpredictably.

   Reserved
      When present, this field is expected to be almost constant on a
   packet-to-packet basis and change set to zero.

   Sequence Number
      When present, the Sequence Number increases by small amounts.  As long as no
   RTP mixer is used, one for each
      packet.

   Key
      When present, the value of this Key field will be zero.

Appendix A.2.9.  RTP Marker

   For audio is used to define the marker flow and does
      not change.

Appendix A.9.  MINE Header Fields

   +---------------------+----------------+
   | Field               | Class          |
   +---------------------+----------------+
   | Protocol            | STATIC-DEF     |
   | S bit should be set only in               | STATIC-DEF     |
   | Reserved            | STATIC-KNOWN   |
   | Checksum            | INFERRED       |
   | Source Address      | STATIC-DEF     |
   | Destination Address | STATIC-DEF     |
   +---------------------+----------------+

   Protocol
      This field will have the first packet of a
   talkspurt, while for video it should be set same value in the last packet all packets of
   every picture.  This means that in both cases the RTP marker a flow and
      is therefore classified as SEMISTATIC..

Appendix A.2.10.  RTP Padding

   If padding STATIC-DEF.

   S bit
      The S bit is used, it not expected to change during a flow.

   Reserved
      The reserved field is expected to be present in most packets, but
   is classified as RC set to allow efficient compression even when zero.

   Checksum
      The header checksum protects individual routing hops from
      processing a corrupted header.  Since all fields of this
   field changes.

Appendix A.2.11.  RTP Extension

   If extensions header
      are used, it compressed away, there is expected no need to include this checksum in
      compressed packets and it can be regenerated at the decompressor
      side.

   Source and Destination Addresses
      These fields can be used to define the flow are not expected to
      change.

Appendix A.10.  AH Header Fields

   +---------------------+----------------+
   | Field               | Class          |
   +---------------------+----------------+
   | Next Header         | STATIC-DEF     |
   | Payload Length      | STATIC         |
   | Reserved            | STATIC-KNOWN   |
   | SPI                 | STATIC-DEF     |
   | Sequence Number     | PATTERN        |
   | ICV                 | IRREGULAR      |
   +---------------------+----------------+

   Next Header
      This field will have the same value in most packets,
   but all packets of a flow and
      is therefore classified as RC to allow efficient compression even when this
   field changes.

Appendix A.2.12.  RTP STATIC-DEF.

   Payload Type

   Changes Length
      It is expected that the length of the RTP payload type within a packet stream are expected
   to header is constant for the
      duration of the flow.

   Reserved
      The value of this field will be rare.  Applications could adapt set to congestion by changing
   payload type and/or frame sizes, but that zero.

   SPI
      This field is not expected used to happen
   frequently.

Appendix A.2.13.  RTP identify a specific flow and only changes
      when the sequence number wraps around, and is therefore classified
      as STATIC-DEF.

   Sequence Number
      The RTP Sequence Number will be incremented by one for each packet
      sent.

   ICV
      The ICV is expected behave unpredictably and is therefore
      classified as IRREGULAR.

Appendix A.2.14.  RTP Timestamp

   In B.  Compressor Implementation Guidelines

   This section describes some guiding principles for implementing a
   ROHCv2 compressor with focus on how to efficiently select appropriate
   packet formats.  All the audio case:

      As long as there are no pauses text in the audio stream, the RTP
      Timestamp will this appendix should be incremented by considered
   guidelines and they have no normative impact on how a constant delta, corresponding
      to ROHCv2
   implementation must be realized.

Appendix B.1.  Reference Management

   The compressor usually maintains a sliding window of reference
   headers which contains as many references as needed for the number
   optimistic approach.  Each reference contains a description of samples which
   changes occured in the speech frame.  It will thus mostly
      follow flow between two consecutive headers in the RTP Sequence Number.  When there has been a silent
      period
   flow, and a new talkspurt begins, reference is inserted into the window each time a
   packet is compressed by this context.  A reference may for example be
   implemented as a stored copy of the uncompressed header being
   represented.  When the compressor is confident that a specific
   reference is no longer used by the decompressor (for example by using
   the optimistic approach or feedback received), the reference is
   removed from the sliding window.

Appendix B.2.  Window-based LSB Encoding (W-LSB)

   Section 5.1.1 describes how the optimistic approach impacts the
   packet format selection for the compressor.  Exactly how the
   compressor selects packet format is up to the implementation to
   decide, but the following is an example of how this process can be
   performed for LSB-encoded fields, though the timestamp will jump in
      proportion to use of Window-based LSB
   encoding (W-LSB).

   When using W-LSB encoding, the length compressor uses a number of references
   from its context decided by its optimistic approach and extracts the silent period.  However,
   value of the
      increment will probably field to be within a relatively limited range.

   In encoded from each reference and finds the video case:

      Between two consecutive packets,
   maximum and minimum values.  When having obtained these limits, the timestamp will either be
      unchanged or increase by a multiple of
   compressor assumes that the decompressor is currently using a fixed value corresponding
   in the range from the minimum to the picture clock frequency. maximum value (inclusive) as its
   reference.  The timestamp can also decrease
      by compressor should then select a multiple number of LSBs of the fixed
   new value for certain coding schemes.  The
      delta interval, expressed as a multiple of so that these can be decompressed both if the picture clock
      frequency, is in most cases very limited. decompressor
   has the minimum value or the maximum value as its current reference.

Appendix A.2.15. B.3.  W-LSB Encoding and Timer-based Compression

   Section 6.6.9 defines decompressor behavior for timer-based RTP Contributing Sources (CSRC)

   The participants in a session, which are identified by
   timestamp compression.  This section gives guidelines on how the CSRC
   fields, are expected
   compressor should select how many bits of timestamp LSBs need to be almost
   transmitted.  When using timer-based compression, the same number of bits
   to transmit depend on a packet-to-packet
   basis with relatively few additions and removals.  As long as RTP
   mixers are not used, no CSRC fields are present at all.

Appendix A.2.16.  ESP Sequence Number

   The ESP Sequence Number will be incremented by one for each packet
   sent.

Appendix B.  Differences between RoHCv2 and RFC3095 profiles

   To be Written

   Profiles defined in RFC3095 were designed with the assumption that amount of jitter both before the compressor
   and the channel jitter between compressor and decompressor maintains packet
   ordering, i.e., that the decompressor always receive packets in the
   same order as decompressor.  The jitter
   before the compressor sent them.  RoHCv2 profiles does not
   make this assumption, i.e. reordering before and after can be estimated using the
   compression point is handled as part of following
   computation:

       Max_Jitter_BC =
            max {|(T_n - T_j) - ((a_n - a_j) / time_stride)|,
               for all headers j in the compression algorithm
   itself.

   Some of sliding window}

   Where (T_n - T_j) is the other technical differences difference in timestamp between these specifications
   are:
   o  ROHCv2 profiles do not contain multiple modes with different
      updating logic the
   currently compressed header and different packet format sets.  Insted, ROHCv2
      profiles assume bidirectional opeartion from a reference header and (a_n - a_j) is
   the difference in arrival time that the
      first feedback is received.
   o  Simplified handling of extension between those same two headers.
   o  Simplified list compression

   In addition to this, the compressor needs to estimate an upper bound
   for CSRC lists.
   o  The IR-DYN packet the jitter between compressor and decompressor (Max_Jitter_CD).
   This information may for example come from lower layers, but if such
   information is not used, and instead, each profile contains
      a co_repair packet available, the compressor should use an upper
   bound which is protected by a 7-bit CRC.  This also
      means that profile downgrading via IR-DYN was removed.
   o  Different decompressor state transitions in order to improve
      robustness when initiating significantly higher than the context.
   o  The format link roundtrip time.

   After obtaining estimates for the jitters, the number of FEEDBACK-2 now includes bits needed
   to transmit is obtained using the following calculation:

       ceiling(log2(2 * (Max_Jitter_BC + Max_Jitter_CD + 2) + 1)

   This number is then used to select a CRC, and there have been
      changes in packet format which of feedback options that are used. contains at
   least this many scaled timestamp bits.

Authors' Addresses

   Ghyslain Pelletier
   Ericsson
   Box 920
   Lulea  SE-971 28
   Sweden

   Phone: +46 (0) 8 404 29 43
   Email: ghyslain.pelletier@ericsson.com

   Kristofer Sandlund
   Ericsson
   Box 920
   Lulea  SE-971 28
   Sweden

   Phone: +46 (0) 8 404 41 58
   Email: kristofer.sandlund@ericsson.com

Full Copyright Statement

   Copyright (C) The IETF Trust (2007).

   This document is subject to the rights, licenses and restrictions
   contained in BCP 78, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at
   ietf-ipr@ietf.org.

Acknowledgment

   Funding for the RFC Editor function is provided by the IETF
   Administrative Support Activity (IASA).