TSVWG V. Roca Internet-Draft B. Teibi Intended status: Standards TrackINRIAE. Baccelli Expires:March 23,July 21, 2019 INRIA January 17, 2019September 19, 2018Sliding Window Random Linear Code (RLC) Forward Erasure Correction (FEC) Schemes for FECFRAMEdraft-ietf-tsvwg-rlc-fec-scheme-09draft-ietf-tsvwg-rlc-fec-scheme-10 Abstract This document describes two fully-specified Forward Erasure Correction (FEC) Schemes for Sliding Window Random Linear Codes (RLC), one for RLC over the Galois Field (A.K.A. Finite Field) GF(2), a second one for RLC over the Galois Field GF(2^^8), each time with the possibility of controlling the code density. They can protect arbitrary media streams along the lines defined by FECFRAME extended to sliding window FEC codes, as defined in [fecframe-ext]. These sliding window FEC codes rely on an encoding window that slides over the source symbols, generating new repair symbols whenever needed. Compared to block FEC codes, these sliding window FEC codes offer key advantages with real-time flows in terms of reduced FEC- related latency while often providing improved packet erasure recovery capabilities. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. 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." This Internet-Draft will expire onMarch 23,July 21, 2019. Copyright Notice Copyright (c)20182019 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Limits of Block Codes with Real-Time Flows . . . . . . .34 1.2. Lower Latency and Better Protection of Real-Time Flows with the Sliding Window RLC Codes . . . . . . . . . . . . 4 1.3. Small Transmission Overheads with the Sliding Window RLC FEC Scheme . . . . . . . . . . . . . . . . . . . . . . . 5 1.4. Document Organization . . . . . . . . . . . . . . . . . . 6 2. Definitions and Abbreviations . . . . . . . . . . . . . . . . 6 3. Common Procedures . . . . . . . . . . . . . . . . . . . . . .. . .7 3.1.Possible Parameter Derivations . . . .Codec Parameters . . . . . . . . .7 3.1.1. Case of a CBR Real-Time Flow. . . . . . . . . . . 7 3.2. ADU, ADUI and Source Symbols Mappings .8 3.1.2. Other Types of Real-Time Flow. . . . . . . . . 9 3.3. Encoding Window Management . . .10 3.1.3. Case of a Non Real-Time Flow. . . . . . . . . . . .11 3.2. ADU, ADUI and10 3.4. SourceSymbols Mappings . . . . . . . . . . 11 3.3. Encoding Window Management .Symbol Identification . . . . . . . . . . . . . .13 3.4.11 3.5. Pseudo-Random Number Generator (PRNG) . . . . . . . . . .13 3.5.11 3.6. Coding Coefficients Generation Function . . . . . . . . .15 3.6.17 3.7. Finite Fields Operations . . . . . . . . . . . . . . . .17 3.6.1.19 3.7.1. Finite Field Definitions . . . . . . . . . . . . . .17 3.6.2.19 3.7.2. Linear Combination of Source Symbols Computation . .1719 4. Sliding Window RLC FEC Scheme over GF(2^^8) for Arbitrary Packet Flows . . . . . . . . . . . . . . . . . . . . . . . .1820 4.1. Formats and Codes . . . . . . . . . . . . . . . . . . . .1820 4.1.1. FEC Framework Configuration Information . . . . . . .1820 4.1.2. Explicit Source FEC Payload ID . . . . . . . . . . .1922 4.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . .20 4.1.4. Additional22 4.2. Procedures . . . . . . . . . . . . . . . .21. . . . . . . 24 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary Packet Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . .2124 5.1. Formats and Codes . . . . . . . . . . . . . . . . . . . .2124 5.1.1. FEC Framework Configuration Information . . . . . . .2224 5.1.2. Explicit Source FEC Payload ID . . . . . . . . . . .2224 5.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . .22 5.1.4. Additional24 5.2. Procedures . . . . . . . . . . . . . . . .22. . . . . . . 25 6. FEC Code Specification . . . . . . . . . . . . . . . . . . .2225 6.1. Encoding Side . . . . . . . . . . . . . . . . . . . . . .2225 6.2. Decoding Side . . . . . . . . . . . . . . . . . . . . . .2325 7. Implementation Status . . . . . . . . . . . . . . . . . . . .2426 8. Security Considerations . . . . . . . . . . . . . . . . . . .2427 8.1. Attacks Against the Data Flow . . . . . . . . . . . . . .2427 8.1.1. Access to Confidential Content . . . . . . . . . . .2427 8.1.2. Content Corruption . . . . . . . . . . . . . . . . .2527 8.2. Attacks Against the FEC Parameters . . . . . . . . . . .2527 8.3. When Several Source Flows are to be Protected Together .2629 8.4. Baseline Secure FEC Framework Operation . . . . . . . . .2629 8.5. Additional Security Considerations for Numerical Computations . . . . . . . . . . . . . . . . . . . . . .2729 9. Operations and Management Considerations . . . . . . . . . .2730 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8) . . . . . . . . . . . . . . . . . . . . . . . .2730 9.2. Operational Recommendations: Coding Coefficients Density Threshold . . . . . . . . . . . . . . . . . . . . . . . .2830 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . .2831 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .2831 12. References . . . . . . . . . . . . . . . . . . . . . . . . .2831 12.1. Normative References . . . . . . . . . . . . . . . . . .2831 12.2. Informative References . . . . . . . . . . . . . . . . .2932 Appendix A. TinyMT32Pseudo-Random Number GeneratorValidation Criteria (Normative) . . . . . .3134 Appendix B. Assessing the PRNG Adequacy (Informational) . . . . 35 Appendix C. Possible Parameter Derivation (Informational) . . . 37 C.1. Case of a CBR Real-Time Flow . . . . . . . . . . . . . . 38 C.2. Other Types of Real-Time Flow . . . . . . . . . . . . . . 40 C.3. Case of a Non Real-Time Flow . . . . . . . . . . . . . . 41 Appendix D. Decoding Beyond Maximum Latency Optimization (Informational) . . . .35 Authors' Addresses. . . . . . . . . . . . . . 41 Authors' Addresses . . . . . . . . .36 1. Introduction Application-Level. . . . . . . . . . . . . . 42 1. Introduction Application-Level Forward Erasure Correction (AL-FEC) codes, or simply FEC codes, are a key element of communication systems. They are used to recover from packet losses (or erasures) during content delivery sessions to a potentially large number of receivers (multicast/broadcast transmissions). This is the case with the FLUTE/ALC protocol [RFC6726] when used for reliable file transfers over lossy networks, and the FECFRAME protocol when used for reliable continuous media transfers over lossy networks. The present document only focuses on the FECFRAME protocol, used in multicast/broadcast delivery mode, in particular for contents that feature stringent real-time constraints: each source packet has a maximum validity period after which it will not be considered by the destination application. 1.1. Limits of Block Codes with Real-Time Flows With FECFRAME, there is a single FEC encoding point (either a end- host/server (source) or a middlebox) and a single FEC decoding point per receiver (either a end-host (receiver) or middlebox). In this context, currently standardized AL-FEC codes for FECFRAME likeReed-SolomonReed- Solomon [RFC6865], LDPC-Staircase [RFC6816], or Raptor/RaptorQ, are all linear block codes: they require the data flow to be segmented into blocks of a predefined maximum size. To define this block size, it is required to find an appropriate balance between robustness and decoding latency: the larger the block size, the higher the robustness (e.g., infrontcase of long packet erasure bursts), but also the higher the maximum decoding latency (i.e., the maximum time required to recover a lost (erased) packet thanks to FEC protection). Therefore, with a multicast/broadcast session where different receivers experience different packet loss rates, the block size should be chosen by considering the worst communication conditions one wants to support, but without exceeding the desired maximum decoding latency. This choice then impacts the FEC-related latency of all receivers, even those experiencing a good communication quality, since no FEC encoding can happen until all the source data of the block is available at the sender, which directly depends on the block size. 1.2. Lower Latency and Better Protection of Real-Time Flows with the Sliding Window RLC Codes This document introduces two fully-specified FEC Schemes that do not followa totally differentthe block code approach: the Sliding Window Random Linear Codes (RLC) over either Galois Fields (A.K.A. Finite Fields) GF(2) (the "binary case") or GF(2^^8), each time with the possibility of controlling the code density. These FEC Schemes are used to protect arbitrary media streams along the lines defined by FECFRAME extended to sliding window FEC codes [fecframe-ext]. These FEC Schemes, and more generally Sliding Window FEC codes, are recommended forinstanceinstance, with media that feature real-time constraints sent within a multicast/broadcast session [Roca17]. The RLC codes belong to the broad class ofsliding windowsliding-window AL-FEC codes (A.K.A. convolutional codes) [RFC8406]. The encoding process is based on an encoding window that slides over the set of source packets (in fact source symbols as we will see in Section 3.2), this window being either of fixed size or variable size (A.K.A. an elastic window). Repair symbols are generated on-the-fly, by computing a random linear combination of the source symbols present in the current encoding window, and passed to the transport layer. At the receiver, a linear system is managed from the set of received source and repair packets. New variables (representing source symbols) and equations (representing the linear combination carried by each repair symbol received) are added upon receiving new packets. Variables and the equations they are involved in are removed when they are too old with respect to their validity period (real-time constraints) . Lost source symbols are then recovered thanks to this linear system whenever its rank permits to solve it (at least partially). The protection of any multicast/broadcast session needs to be dimensioned by considering the worst communication conditions one wants to support. This is also true with RLC (more generally any sliding window) code.HoweverHowever, the receivers experiencing a good to medium communication quality will observe a reduced FEC-related latency compared to block codes [Roca17] since an isolated lost source packet is quickly recovered with the following repair packet. On the opposite, with a block code, recovering an isolated lost source packet always requires waiting for the first repair packet to arrive after the end of the block. Additionally, under certain situations (e.g., with a limited FEC-related latency budget and with constant bitrate transmissions after FECFRAME encoding), sliding window codes can more efficiently achieve a target transmission quality (e.g., measured by the residual loss after FEC decoding) by sending fewer repair packets (i.e., higher code rate) than block codes. 1.3. Small Transmission Overheads with the Sliding Window RLC FEC Scheme The Sliding Window RLC FEC Scheme is designed to limit the packet header overhead. The main requirement is that each repair packet header must enable a receiver to reconstruct the set of source symbols plus the associated coefficients used during the encoding process. In order to minimize packet overhead, the set of source symbols in the encoding window as well as the set of coefficients over GF(2^^m) (where m is 1 or 8, depending on the FEC Scheme) used in the linear combination are not individually listed in the repair packet header. Instead, each FEC Repair Packet header contains: o the Encoding Symbol Identifier (ESI) of the first source symbol in the encoding window as well as the number of symbols (since this number may vary with a variable size, elastic window). These two pieces of information enable each receiver to reconstruct the set of source symbols considered during encoding, the only constraint being that there cannot be any gap; o the seed and density threshold parameters used by a coding coefficients generation function (Section3.5).3.6). These two pieces of information enable each receiver to generate the same set of coding coefficients over GF(2^^m) as the sender; Therefore, no matter the number of source symbols present in the encoding window, each FEC Repair Packet features a fixed 64-bit long header, called Repair FEC Payload ID (Figure7).8). Similarly, each FEC Source Packet features a fixed 32-bit long trailer, called Explicit Source FEC Payload ID (Figure5),6), that contains the ESI of the first source symbol (Section 3.2). 1.4. Document Organization This fully-specified FEC Scheme follows the structure required by [RFC6363], section 5.6. "FEC Scheme Requirements", namely: 3. Procedures: This section describes procedures specific to this FEC Scheme, namely: RLC parameters derivation, ADUI and source symbols mapping, pseudo-random number generator, and coding coefficients generation function; 4. Formats and Codes: This section defines the Source FEC Payload ID and Repair FEC Payload ID formats, carrying the signalling information associated to each source or repair symbol. It also defines the FEC Framework Configuration Information (FFCI) carrying signalling information for the session; 5. FEC Code Specification: Finally this section provides the code specification. 2. Definitions and Abbreviations The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. This document uses the following definitions and abbreviations: a^^b a to the power of b GF(q) denotes a finite field (also known as the Galois Field) with q elements. We assume that q = 2^^m in this document m defines the length of the elements in the finite field, in bits. In this document, m is equal to 1 or 8 ADU: Application Data Unit ADUI: Application Data Unit Information (includes the F, L and padding fields in addition to the ADU) E: size of an encoding symbol (i.e., source or repair symbol), assumed fixed (in bytes) br_in: transmission bitrate at the input of the FECFRAME sender, assumed fixed (in bits/s) br_out: transmission bitrate at the output of the FECFRAME sender, assumed fixed (in bits/s) max_lat: maximum FEC-related latency within FECFRAME(in(a decimal number expressed in seconds) cr: RLC coding rate, ratio between the total number of source symbols and the total number of source plus repair symbols ew_size: encoding window current size at a sender (in symbols) ew_max_size: encoding window maximum size at a sender (in symbols) dw_max_size: decoding window maximum size at a receiver (in symbols) ls_max_size: linear system maximum size (or width) at a receiver (in symbols) WSR: window size ratio parameter used to derive ew_max_size (encoder) and ls_max_size (decoder). PRNG: pseudo-random number generatortinymt32_rand(maxv):TinyMT32: PRNG defined in Section3.43.5 and used in thisspecification, that returns a new random integer in [0; maxv-1]specification. DT: coding coefficients density threshold, an integer between 0 and 15 (inclusive) the controls the fraction of coefficients that are non zero 3. Common Procedures This section introduces the procedures that are used by these FEC Schemes. 3.1.Possible Parameter Derivations TheCodec Parameters A codec implementing the Sliding Window RLC FEC Scheme relies on several parameters: Maximum FEC-related latency budget, max_lat(in(a decimal number expressed in seconds) withreal- timereal-time flows: a source ADU flow can have real-time constraints, and therefore any FECFRAME related operation should take place within the validity period of each ADU (AppendixBD describes an exception to this rule). When there are multiple flows with different real- time constraints, we consider the most stringent constraints (see [RFC6363], Section 10.2, item 6, for recommendations when several flows are globally protected). The maximum FEC-related latency budget, max_lat, accounts for all sources of latency added by FEC encoding (at a sender) and FEC decoding (at a receiver). Other sources of latency (e.g., added by network communications) are out of scope and must be considered separately (said differently, they have already been deducted from max_lat). max_lat can be regarded as the latency budget permitted for all FEC-related operations. This is an input parameter that enables a FECFRAME sender to derive other internal parametersas explained below;(see Appendix C); Encoding window current (resp. maximum) size, ew_size (resp. ew_max_size) (in symbols): at a FECFRAME sender, during FEC encoding, a repair symbol is computed as a linear combination of the ew_size source symbols present in the encoding window. The ew_max_size is the maximum size of this window, while ew_size is the current size. For instance, at session start, upon receiving new source ADUs, the ew_size progressively increases until it reaches its maximum value, ew_max_size. We have: 0 < ew_size <= ew_max_size Decoding window maximum size, dw_max_size (in symbols): at a FECFRAME receiver, dw_max_size is the maximum number of received or lost source symbols that are still within their latency budget; Linear system maximum size, ls_max_size (in symbols): at a FECFRAME receiver, the linear system maximum size, ls_max_size, is the maximum number of received or lost source symbols in the linear system (i.e., the variables). It SHOULD NOT be smaller than dw_max_size since it would mean that, even after receiving a sufficient number of FEC Repair Packets, a lost ADU may not be recovered just because the associated source symbols have been prematurely removed from the linear system, which is usually counter-productive. On the opposite, the linear system MAY grow beyond the dw_max_size (AppendixB);D); Symbol size, E (in bytes): the E parameter determines the source and repair symbol sizes (necessarily equal). This is an input parameter that enables a FECFRAME sender to derive other internal parameters, as explained below. An implementation at a senderSHOULDMUST fix the E parameter and MUST communicate it as part of the FEC Scheme-Specific Information (Section 4.1.1.2). Code rate, cr: The code rate parameter determines the amount of redundancy added to the flow. More precisely the cr is the ratio between the total number of source symbols and the total number of source plus repair symbols and by definition: 0 < cr <= 1. This is an input parameter that enables a FECFRAME sender to derive other internal parameters, as explained below.HoweverHowever, there is no need to communicate the cr parameter per see (it's not required to process a repair symbol at a receiver). This code rate parameter can be static. However, in specific use-cases (e.g., with unicast transmissions in presence of a feedback mechanism that estimates the communication quality, out of scope of FECFRAME), the code rate may be adjusted dynamically.The FEC Schemes can be used in various manners. They can be usedAppendix C proposes non normative technics toprotectderive those parameters, depending on the use-case specificities. 3.2. ADU, ADUI and Source Symbols Mappings At asourcesender, an ADUflow having real-time constraints, or a non- realtimecoming from the application is not directly mapped to sourceADU flow. Thesymbols. When multiple sourceADUflows (e.g., media streams) are mapped onto the same FECFRAME instance, each flowmay be a Constant Bitrate (CBR) or Variable BitRate (VBR) flow. The flow's minimum/ maximum bitrate might or might not be known. Theis assigned its own Flow ID value (see below). This Flow ID is then prepended to each ADU before FECSchemes canencoding. This way, FEC decoding at a receiver also recovers this Flow ID and the recovered ADU can beused overassigned to theInternet or over a CBR communication path. It followsright source flow (note that theFEC Scheme parameters can be derived in different ways, as described in5-tuple used to identify thefollowing sections. 3.1.1. Caseright source flow of aCBR Real-Time Flow In the following, we consider a real-time flowreceived ADU is absent withmax_lat latency budget. The encoding symbol size, E,a recovered ADU since it isconstant. The code rate, cr,not FEC protected). Additionally, since ADUs are of variable size, padding isalso constant,needed so that each ADU (with itsvalue depending onflow identifier) contribute to an integral number of source symbols. This requires adding theexpected communication loss model (this choice is outoriginal ADU length to each ADU before doing FEC encoding. Because ofscopethese requirements, an intermediate format, the ADUI, or ADU Information, is considered [RFC6363]. For each incoming ADU, an ADUI MUST created as follows. First of all, 3 bytes are prepended (Figure 1): Flow ID (F) (8-bit field): thisdocument). In a first configuration,unsigned byte contains the integer identifier associated to the source ADU flowbitrate at the input of the FECFRAME sender is fixed and equaltobr_in (in bits/s), andwhich thisvalue is known by the FECFRAME sender.ADU belongs. Itfollowsis assumed thatthe transmission bitrate at the output of the FECFRAME sendera single byte is sufficient, which implies that no more than 256 flows will behigher, depending on the added repair flow overhead. In order to comply with the maximum FEC-related latency budget, we have: dw_max_size = (max_lat * br_in) / (8 * E) Inprotected by asecond configuration, thesingle FECFRAMEsender generates a fixed bitrate flow, equal tosession instance. Length (L) (16-bit field): this unsigned integer contains theCBR communication path bitrate equal to br_out (in bits/s), andlength of thisvalueADU, in network byte order (i.e., big endian). This length isknown byfor theFECFRAME sender, as in [Roca17]. The maximum source flow bitrate needs to be such that, with the added repair flow overhead,ADU itself and does not include thetotal transmission bitrate remains inferiorF, L, orequal to br_out. We have: dw_max_size = (max_lat * br_out * cr) / (8 * E) For decoding to be possible within the latency budget, itPad fields. Then, zero padding isrequired thatadded to theencoding window maximumADU if needed: Padding (Pad) (variable sizebe smaller than or at most equalfield): this field contains zero padding to align thedecoding window maximum size, the exact value having no impact onF, L, ADU and padding up to a size that is multiple of E bytes (i.e., the source and repair symbol length). The data unit resulting from theFEC-related latency budget. ForADU and theFEC Schemes specified inF, L, and Pad fields is called ADUI. Since ADUs can have different sizes, thisdocument, in line with [Roca17], the ew_max_size SHOULD be computed with: ew_max_size = dw_max_size * 0.75 The ew_max_sizeis also themain parameter at a FECFRAME sender. It is RECOMMENDEDcase for ADUIs. However, an ADUI always contributes tocheckan integral number of source symbols. symbol length, E E E < ------------------ >< ------------------ >< ------------------ > +-+--+---------------------------------------------+-------------+ |F| L| ADU | Pad | +-+--+---------------------------------------------+-------------+ Figure 1: ADUI Creation example (here 3 source symbols are created for this ADUI). Note that neither theew_max_size value stays within reasonnable bounds in order to avoid hazardous behaviours. The dw_max_size is computed by a FECFRAME sender but not explicitly communicated to a FECFRAME receiver. However a FECFRAME receiver can easily evaluateinitial 3 bytes nor theew_max_size by observingoptional padding are sent over themaximum Number ofnetwork. However, they are considered during FEC encoding, and a receiver who lost a certain FEC SourceSymbols (NSS) value contained inPacket (e.g., theRepair FEC Payload ID of receivedUDP datagram containing this FECRepair Packets (Section 4.1.3). A receiver can then easily compute dw_max_size: dw_max_size = max_NSS_observed / 0.75 A receiver can then chose an appropriate linear system maximum size: ls_max_size >= dw_max_size ItSource Packet when UDP isgood practice to use a larger value for ls_max_sizeused asexplained in Appendix B, which does not impact maximum latency nor interoperability. Howeverthelinear system size should nottransport protocol) will betoo large for practical reasons (e.g., in order to limit computation complexity). It is RECOMMENDEDable tocheck thatrecover thels_max_size value stays within reasonnable bounds in orderADUI if FEC decoding succeeds. Thanks toavoid hazardous behaviours. The particular casethe initial 3 bytes, this receiver will get rid ofsession start needs to be managed appropriately. Here ew_size increases each time a new source ADU is received bytheFECFRAME sender, until it reachespadding (if any) and identify theew_max_size value. A FECFRAME receiver SHOULD continuously observecorresponding ADU flow. 3.3. Encoding Window Management Source symbols and thereceived FEC Repair Packets, sincecorresponding ADUs are removed from theNSS value carried inencoding window: o when theRepair FEC Payload ID will increase too, and adjustsliding encoding window has reached itsls_max_size accordingly if need be. 3.1.2. Other Types of Real-Time Flowmaximum size, ew_max_size. Inother configurations, a real-time source ADU flow, with a max_lat latency budget, features a variable bitrate (VBR). A first approach consists in considering the smallest instantaneous bitrate of the source ADU flow, when this parameter is known, and to reuse the derivation of Section 3.1.1. Consideringthat case thesmallest bitrate meansoldest symbol MUST be removed before adding a new symbol, so that the current encoding windowand decoding window maximum sizes estimation are pessimistic: these windows have the smallestsizerequiredalways remains inferior or equal toenable a decoding on-time at a FECFRAME receiver. Iftheinstantaneous bitrate is higher than this smallest bitrate, this approach leads tomaximum size: ew_size <= ew_max_size; o when anencoding window that is unnecessarily small, which reduces robustness in front of long erasure bursts. Another approach consists in usingADUtiming information (e.g., using the timestamp field of an RTP packet header, or registering the time upon receiving a new ADU). From the global FEC-related latency budget the FECFRAME sender can derive a practicalhas reached its maximumlatency budget for encoding operations, max_lat_for_encoding. For the FEC Schemes specifiedvalidity duration in case of a real-time flow. When thisdocument, this latency budget SHOULD be computed with: max_lat_for_encoding = max_lat * 0.75 It follows that anyhappens, all source symbolsassociatedcorresponding toan ADUthe ADUI thathas timed-out with respect to max_lat_for_encodingexpired SHOULD be removed from the encodingwindow. With this approach there is no pre-determined ew_size value: this value fluctuates over the time accordingwindow; Source symbols are added to theinstantaneous source ADU flow bitrate. For practical reasons, a FECFRAME sender may still require that ew_size does not increase beyondsliding encoding window each time amaximum value (Section 3.1.3). With both approaches, and no matternew ADU arrives, once thechoiceADU-to-source symbols mapping has been performed (Section 3.2). The current size of theFECFRAME sender,encoding window, ew_size, is updated after adding new source symbols. This process may require to remove old source symbols so that: ew_size <= ew_max_size. Note that aFECFRAME receiver can still easily evaluateFEC codec may feature practical limits in the number of source symbols in the encoding window (e.g., for computational complexity reasons). This factor may further limit the ew_max_sizeby observingvalue, in addition to the maximumNumber ofFEC-related latency budget (Section 3.1). 3.4. SourceSymbols (NSS) value contained in the Repair FEC PayloadSymbol Identification Each source symbol is identified by an Encoding Symbol IDof received FEC Repair Packets. A receiver can then compute dw_max_size and derive(ESI), anappropriate ls_max_size as explained in Section 3.1.1. Whenunsigned integer. The ESI of source symbols MUST start with value 0 for theobserved NSS fluctuates significantly, a FECFRAME receiver may wantfirst source symbol and MUST be managed sequentially. Wrapping toadapt its ls_max_size accordingly. In particular whenzero happens after reaching theNSSmaximum value made possible by the ESI field size (this maximum value issignificantly reduced, a FECFRAME receiver may wantFEC Scheme dependant, for instance, 2^32-1 with FEC Schemes XXX and YYY). No such consideration applies toreduce the ls_max_size too inrepair symbols. 3.5. Pseudo-Random Number Generator (PRNG) In order tolimit computation complexity. However it is usually preferable to use a ls_max_size "too large" (which can increase computation complexity and memory requirements) thancompute coding coefficients (see Section 3.6), theopposite (which can reduce recovery performance). Beyond these general guidelines,RLC FEC Schemes defined in this document rely on thedetailsTinyMT32 PRNG (a small-sized variant ofhow to manage these situations at a FECFRAME senderthe Mersenne Twister PRNG), as defined in the reference implementation version 1.1 (2015/04/24) by Mutsuo Saito (Hiroshima University) andreceiver can depend on additional considerations that are out of scope of this document. 3.1.3. CaseMakoto Matsumoto (The University ofa Non Real-Time Flow Finally there are configurations where a source ADU flow has no real- time constraints. FECFRAMETokyo). o Official web site: <http://www.math.sci.hiroshima-u.ac.jp/~m- mat/MT/TINYMT/> o Official github site and reference implementation: <https://github.com/MersenneTwister-Lab/TinyMT> For the RLC FEC Schemes defined in thisdocument can stilldocument, the TinyMT32 32-bit version (rather than the 64-bit version) MUST be used.The choice of appropriateThis PRNG requires a parametervalues canset that needs to bedirected by practical considerations.pre-calculated. Forinstance it can derive from an estimation ofthemaximum memory amount that could be dedicated toRLC FEC Schemes defined in this document, thelinear system at a FECFRAME receiver, orfollowing parameter set MUST be used: o mat1 = 0x8f7011ee = 2406486510 o mat2 = 0xfc78ff1f = 4235788063 o tmat = 0x3793fdff = 932445695 This parameter set is themaximum computation complexity at a FECFRAME receiver, bothfirst entry ofthem depending on the ls_max_size parameter. The same considerations also apply to the FECFRAME sender, wherethemaximum memory amount and computation complexity depend on the ew_max_size parameter. Here also, the NSS value containedprecalculated parameter sets inFEC Repair Packetsfile tinymt32dc.0.1048576.txt, by Kenji Rikitake, and available at <https://github.com/jj1bdx/tinymtdc- longbatch/blob/master/tinymt32dc/tinymt32dc.0.1048576.txt>. This is also the parameter set usedbyin [KR12]. This PRNG MUST first be initialized with aFECFRAME receiver32-bit unsigned integer, used as a seed. The following function is used todetermine the current coding window size and ew_max_size by observing its maximum value overthis purpose: void tinymt32_init (tinymt32_t * s, uint32_t seed); With thetime. Beyond these general guidelines,FEC Schemes defined in this document, thedetails of howseed is in practice restricted tomanage these situations ataFECFRAME sendervalue between 0 andreceiver can depend on additional considerations0xFFFF inclusive (note thatare out of scope ofthisdocument. 3.2. ADU, ADUI and Source Symbols Mappings AtPRNG accepts asender, an ADU coming from the application cannot directly be mapped to source symbols. When multiple source flows (e.g., media streams) are mapped onto the same FECFRAME instance, each flow is assigned its own Flow IDseed value(see below). At a sender,equal to 0), since thisidentifierisprepended to each ADU before FEC encoding. This way,the Repair_Key 16-bit field value of the Repair FECdecoding at a receiver also recovers this FlowPayload IDand a recovered ADU can be assigned(Section 4.1.3). In addition to theright source flow (note that transport port numbers and IP addresses cannot be used to that purposeseed, this function takes asthey are not recovered during FEC decoding). Additionally, since ADUs are of variable size, padding is needed so that each ADU (with its flow identifier) contributeparameter a pointer to anintegral numberinstance ofsource symbols. This requires adding the original ADU lengtha tinymt32_t structure that is used toeach ADU before doing FEC encoding. Becausekeep the internal state ofthese requirements, an intermediate format,theADUI, or ADU Information, is considered [RFC6363]. ForPRNG. Then, eachincoming ADU, an ADUI MUST created as follows. First of all, 3 bytes are prepended (Figure 1): Flow ID (F) (8-bit field): this unsigned byte contains thetime a new pseudo-random integeridentifier associated tobetween 0 and 15 inclusive (4-bit pseudo-random integer) is needed, thesource ADU flow to which this ADU belongs. Itfollowing function isassumed thatused: uint32_t tinymt32_rand16 (tinymt32_t * s); This function takes as parameter asingle byte is sufficient, which implies that no more than 256 flows willpointer to the same tinymt32_t structure (that needs to beprotected byleft unchanged between successive calls to the function). Similarly, each time asingle FECFRAME session instance. Length (L) (16-bit field): this unsignednew pseudo-random integercontains the length of this ADU, in network byte order (i.e., big endian). This lengthbetween 0 and 255 inclusive (8-bit pseudo-random integer) isforneeded, theADU itself and does not includefollowing function is used: uint32_t tinymt32_rand256 (tinymt32_t * s); These two functions keep respectively theF, L,4 orPad fields. Then, zero padding is added to8 less significant bits of theADU if needed: Padding (Pad) (variable size field):32-bit pseudo-random number generated by the tinymt32_generate_uint32() TinyMT32 function. Test results discussed in Appendix B show that thisfield contains zero paddingsimple technique, applied toalignthis PRNG, is in line with theF, L, ADU and padding up to a size thatRLC FEC Schemes needs. The TinyMT32 PRNG reference implementation ismultiple of E bytes (i.e.,reproduced in Figure 2, with the following differences with respect to the original sourceand repair symbol length). The data unit resulting fromcode: o theADU andsource code initially spread over theF, L,tinymt32.h andPad fields is called ADUI. Since ADUs can have different sizes, this is alsotinymt32.c files has been merged; o thecase for ADUIs. However an ADUI always contributes to an integral numberunused parts ofsource symbols. symbol length, E E E < ------------------ >< ------------------ >< ------------------ > +-+--+---------------------------------------------+-------------+ |F| L| ADU | Pad | +-+--+---------------------------------------------+-------------+ Figure 1: ADUI Creation example (here 3 source symbols are created for this ADUI). Note that neither the initial 3 bytes northeoptional padding are sent overoriginal source code have been removed; o thenetwork. However, they are considered during FEC encoding,unused constants TINYMT32_MEXP anda receiver who lost a certain FEC Source Packet (e.g., the UDP datagram containing this FEC Source Packet when UDP is used as the transport protocol) will be able to recoverTINYMT32_MUL have been removed; o theADUI if FEC decoding succeeds. Thanksappropriate parameter set has been added to theinitial 3 bytes, this receiver will get rid of the padding (if any) and identifyinitialization function; o thecorresponding ADU flow. 3.3. Encoding Window Management Source symbols andfunction order has been changed; o certain internal variables have been renamed for compactness purposes; o thecorresponding ADUs are removed fromconstant definitions use theencoding window:const qualifier; owhenthesliding encoding window has reached its maximum size, ew_max_size. In that casetinymt32_rand16() and tinymt32_rand256() functions have been added in order to scale theoldest symbol MUST be removed before addinginitial 32-bit value over anew symbol, so thatsmaller interval; o thecurrent encoding window size always remains inferior or equalIETF Trusteed copyright has been added tothe maximum size: ew_size <= ew_max_size; o when an ADU has reached its maximum validity duration in case of a real-time flow. Whenthishappens, all source symbols corresponding to the ADUI that expired SHOULD be removed from the encoding window; Source symbols are added to the sliding encoding window each time a new ADU arrives, once the ADU to source symbols mapping has been performed (Section 3.2).derived work. <CODE BEGINS> /** * Tiny Mersenne Twister only 127 bit internal state * * Authors : Mutsuo Saito (Hiroshima University) * Makoto Matsumoto (University of Tokyo) * * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, * Hiroshima University and Thecurrent sizeUniversity ofthe encoding window, ew_size, is updated after adding new source symbols. This process may require to remove oldTokyo. * All rights reserved. * * Redistribution and use in sourcesymbols so that: ew_size <= ew_max_size. Noteand binary forms, with or without * modification, are permitted provided thata FEC codec may feature practical limits inthenumberfollowing conditions * are met: * * - Redistributions of sourcesymbols incode must retain theencoding window (e.g., for computational complexity reasons). This factor may further limitabove copyright * notice, this list of conditions and theew_max_size value,following disclaimer. * - Redistributions inaddition tobinary form must reproduce themaximum FEC-related latency budget (Section 3.1). 3.4. Pseudo-Random Number Generator (PRNG) The RLC FEC Schemes defined inabove * copyright notice, thisdocument rely on the TinyMT32 PRNG, a small-sized variantlist of conditions and theMersenne Twister PRNG, as definedfollowing * disclaimer in thereference implementation version 1.1 (2015/04/24) by Mutsuo Saito (Hiroshima University) and Makoto Matsumoto (The University of Tokyo). o Official web site: <http://www.math.sci.hiroshima-u.ac.jp/~m- mat/MT/TINYMT/> o Official github site and reference implementation: <https://github.com/MersenneTwister-Lab/TinyMT> For the RLC FEC Schemes defined in this document, the tinymt32 32-bit version (rather than the 64-bit version) MUST be used. This PRNG requires a parameter set that needs to be pre-calculated. For the RLC FEC Schemes defined in this document,documentation and/or other materials * provided with thefollowing parameter set MUST be used: o mat1 = 0x8f7011ee = 2406486510; o mat2 = 0xfc78ff1f = 4235788063; o tmat = 0x3793fdff = 932445695. This parameter set isdistribution. * - Neither thefirst entryname of theprecalculated parameter sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, and available at: o <https://github.com/jj1bdx/tinymtdc- longbatch/blob/master/tinymt32dc/tinymt32dc.0.1048576.txt>. This is alsoHiroshima University nor theparameter set used in [KR12]. The PRNG reference implementation is distributed under a BSD license and excerpts of it are reproduced in Appendix A. In order to validate an implementationnames ofthis PRNG, using seed 1, the 10,000th value returned by: tinymt32_rand(s, 0xffff) MUST be equal to 0x7c37. This PRNG MUST first* its contributors may beinitialized with a 32-bit unsigned integer, used as a seed. The following function isused tothis purpose: void tinymt32_init (tinymt32_tendorse or promote products *s, uint32_t seed); With the FEC Schemes defined in this document, the seed is in practice restricted to a value between 0 and 0xFFFF inclusive (note that this PRNG accepts a seed equal to 0), sincederived from thisis the Repair_Key 16-bit field value of the Repair FEC Payload ID (Section 4.1.3). In addition to the seed,software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /** * The derived work of thisfunction takesdocument is: * Copyright (c) 2018 IETF Trust and the persons identified asparameter a pointer to an instance of a tinymt32_t structure that is used to keepthe * document authors. All rights reserved. */ #include <stdint.h> /** * tinymt32 internal stateof the PRNG. Then, each time a new pseudo-random integer between 0vector andmaxv-1 inclusive is needed, the following function is used:parameters */ typedef struct { uint32_t status[4]; uint32_t mat1; uint32_t mat2; uint32_ttinymt32_randtmat; } tinymt32_t; static void tinymt32_next_state (tinymt32_t *s,s); static uint32_tmaxv); This function takes as parameter both a pointertinymt32_temper (tinymt32_t * s); static uint32_t tinymt32_generate_uint32 (tinymt32_t * s); /** * Parameter set to use for thesame tinymt32_t structure (that needs to be left unchanged between successive calls to the function) and the maxv value. 3.5. Coding Coefficients Generation Function The coding coefficients, used during the encoding process, are generated at the RLC encoder by the generate_coding_coefficients() function each time a new repair symbol needs to be produced. The fraction of coefficients that are non zero (i.e., the density) is controlled by the DT (Density Threshold) parameter. When DT equals 15, the maximum value, the function guaranties that all coefficients are non zero (i.e., maximum density). When DT is between 0 (minimum value) and strictly inferior to 15, the average probability of having a non zero coefficient equals (DT +1) / 16. These considerations apply both the RLC over GF(2) and RLC over GF(2^^8), the only difference being the value of the m parameter. With the RLC over GF(2) FEC Scheme (Section 5), m MUST be equal to 1. WithIETF RLCover GF(2^^8)FECScheme (Section 4), m MUST be equal to 8. <CODE BEGINS> /*Schemes specification. *Fills inDo not change. * This parameter set is thetablefirst entry ofcoding coefficients (oftheright size)precalculated *provided with the appropriate number of coding coefficients toparameter sets in file tinymt32dc.0.1048576.txt, by Kenji *use for the repair symbol key provided.Rikitake, available at: * https://github.com/jj1bdx/tinymtdc-longbatch/blob/master/ *(in) repair_key key associated to this repair symbol. Thistinymt32dc/tinymt32dc.0.1048576.txt *parameterIt isignored (useless) if m=2 and dt=15 * (in) cc_tab[] pointer to a table ofalso theright size to storeparameter set used: *coding coefficients. All coefficients areRikitake, K., "TinyMT Pseudo Random Number Generator for *stored as bytes, regardless of the m parameter,Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), *upon return of this function.September, 2012. */ const uint32_t TINYMT32_MAT1_PARAM = UINT32_C(0x8f7011ee); const uint32_t TINYMT32_MAT2_PARAM = UINT32_C(0xfc78ff1f); const uint32_t TINYMT32_TMAT_PARAM = UINT32_C(0x3793fdff); /** *(in) cc_nb number of entries in the table.Thisvalue is * equal tofunction initializes thecurrent encoding window size.internal state array with a 32-bit *(in) dtunsigned integerbetween 0 and 15 (inclusive) that * controls the density. With value 15, allseed. *coefficients are guaranteed@param s pointer tobe non zerotinymt internal state. *(i.e. equal to 1 with GF(2) and equal to@param seed a* value in {1,... 255} with GF(2^^8)), otherwise *32-bit unsigned integer used as afraction of them will be 0. * (in) m Finite Field GF(2^^m) parameter. In this * document only values 1 and 8 are considered. * (out) returns an error codeseed. */int generate_coding_coefficients (uint16_t repair_key, uint8_t cc_tab[], uint16_t cc_nb, uint8_t dt, uint8_t m) {void tinymt32_init (tinymt32_t * s, uint32_ti; tinymt32_t s; /* PRNG internal state */ if (dt > 15) { return SOMETHING_WENT_WRONG; /* bad dt parameter */ } switch (m) { case 1: if (dt == 15) { /* all coefficients are 1 */ memset(cc_tab, 1, cc_nb); } elseseed) {/* here coefficients are either 0 or 1 */ tinymt32_init(&s, repair_key);const uint32_t MIN_LOOP = 8; const uint32_t PRE_LOOP = 8; s->status[0] = seed; s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; for(i(int i =0 ;1; i <cc_nb ;MIN_LOOP; i++) {if (tinymt32_rand(&s, 16) <= dt) { cc_tab[i] = (uint8_t) 1; } else { cc_tab[i] = (uint8_t) 0; } } } break; case 8: tinymt32_init(&s, repair_key); if (dt == 15) { /* coefficient 0 is avoided here in order to includes->status[i & 3] ^= i + UINT32_C(1812433253) *all the source symbols */(s->status[(i - 1) & 3] ^ (s->status[(i - 1) & 3] >> 30)); } for(i(int i =0 ;0; i <cc_nb ;PRE_LOOP; i++) {do { cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); } while (cc_tab[i] == 0);tinymt32_next_state(s); } }else { /* here/** * This function outputs acertain fraction of coefficients should bepseudo-random integer in [0 .. 15] range. * * @param s pointer to tinymt internal state. * @return unsigned integer between 0 and 15 inclusive. */for (i = 0 ; i < cc_nb ; i++) { if (tinymt32_rand(&s, 16) <= dt) { do { cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); } while (cc_tab[i] == 0); } elseuint32_t tinymt32_rand16(tinymt32_t *s) {cc_tab[i] = 0; } } } break; default: /* bad parameter m */returnSOMETHING_WENT_WRONG; } return EVERYTHING_IS_OKAY;(tinymt32_generate_uint32(s) & 0xF); }<CODE ENDS> Figure 2: Coding Coefficients Generation Function pseudo-code 3.6. Finite Fields Operations 3.6.1. Finite Field Definitions The two RLC FEC Schemes specified in this document reuse the Finite Fields defined/** * This function outputs a pseudo-random integer in[RFC5510], section 8.1. More specifically, the elements of the field GF(2^^m) are represented by polynomials with binary coefficients (i.e., over GF(2)) and degree lower or equal[0 .. 255] range. * * @param s pointer tom-1. The additiontinymt internal state. * @return unsigned integer betweentwo elements is defined as the addition of binary polynomials in GF(2), which is equivalent to a bitwise XOR operation on the binary representation of these elements. With GF(2^^8), multiplication between two elements is the multiplication modulo a given irreducible polynomial of degree 8. The following irreducible polynomial MUST be used for GF(2^^8): x^^8 + x^^4 + x^^3 + x^^2 + 1 With GF(2), multiplication corresponds to a logical AND operation. 3.6.2. Linear Combination of Source Symbols Computation The two RLC FEC Schemes require the computation of a linear combination of source symbols, using the coding coefficients produced by the generate_coding_coefficients() function and stored in the cc_tab[] array. With the RLC over GF(2^^8) FEC Scheme, a linear combination of the ew_size source symbol present in the encoding window, say src_0 to src_ew_size_1, in order to generate a repair symbol, is computed as follows. For each byte of position i in each source0 andthe repair symbol, where i belongs to {0; E-1}, compute: repair[i] = cc_tab[0]255 inclusive. */ uint32_t tinymt32_rand256(tinymt32_t *s) { return (tinymt32_generate_uint32(s) & 0xFF); } /** *src_0[i] + cc_tab[1]Internal tinymt32 constants and functions. *src_1[i] + ... + cc_tab[ew_size - 1]Users should not call these functions directly. */ const uint32_t TINYMT32_SH0 = 1; const uint32_t TINYMT32_SH1 = 10; const uint32_t TINYMT32_SH8 = 8; const uint32_t TINYMT32_MASK = UINT32_C(0x7fffffff); /** *src_ew_size_1[i] whereThis function changes internal state of tinymt32. *is the multiplication over GF(2^^8) and + is an XOR operation. In practice various optimizations need to be used in order@param s pointer tomake this computation efficient (see in particular [PGM13]). With the RLC over GF(2) FEC Scheme (binary case), a linear combination is computed as follows. The repair symbol is the XOR sum of all the source symbols correspondingtinymt internal state. */ static void tinymt32_next_state (tinymt32_t * s) { uint32_t x; uint32_t y; y = s->status[3]; x = (s->status[0] & TINYMT32_MASK) ^ s->status[1] ^ s->status[2]; x ^= (x << TINYMT32_SH0); y ^= (y >> TINYMT32_SH0) ^ x; s->status[0] = s->status[1]; s->status[1] = s->status[2]; s->status[2] = x ^ (y << TINYMT32_SH1); s->status[3] = y; s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; } /** * This function outputs 32-bit unsigned integer from internal state. * @param s pointer toa coding coefficient cc_tab[j] equaltinymt internal state. * @return 32-bit unsigned pseudos number */ static uint32_t tinymt32_temper (tinymt32_t * s) { uint32_t t0, t1; t0 = s->status[3]; t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); t0 ^= t1; t0 ^= -((int32_t)(t1 & 1)) & s->tmat; return t0; } /** * This function outputs 32-bit unsigned integer from internal state. * @param s pointer to1 (i.e., the source symbols correspondingtinymt internal state. * @return 32-bit unsigned integer r (0 <= r < 2^32) */ static uint32_t tinymt32_generate_uint32 (tinymt32_t * s) { tinymt32_next_state(s); return tinymt32_temper(s); } <CODE ENDS> Figure 2: TinyMT32 Reference Implementation In addition tozero coding coefficients are ignored). The XOR sum of the bytethat, any implementation ofposition ithis TinyMT32 PRNG MUST fulfill three validation criteria detailed ineach source is computed and storedAppendix A. These criteria consist in several random number sequences that MUST be matched. The first criteria focusses on thecorresponding byte ofinternal TinyMT32 unsigned 32-bit integer generator, therepair symbol, where i belongstwo others include the mapping to{0; E-1}. In practice,4-bit and 8-bit intervals. Finally, theXOR sums will be computed several bytes at a time (e.g., on 64 bit words, or on arraysdeterministic behavior of16 or more bytes when using SIMD CPU extensions). With both FEC Schemes,thedetailsimplementation ofhowFigure 2 has been checked across several platforms, from high-end 64-bit Mac OSX and Linux/Ubuntu laptops, tooptimizevarious low-end embedded cards based on 32-bit, 16-bit and 8-bit microcontrollers running RIOT [Baccelli18] (details in Appendix A). 3.6. Coding Coefficients Generation Function The coding coefficients, used during thecomputation of these linear combinationsencoding process, are generated at the RLC encoder by the generate_coding_coefficients() function each time a new repair symbol needs to be produced. The fraction ofhigh practical importance but outcoefficients that are non zero (i.e., the density) is controlled by the DT (Density Threshold) parameter. DT has values between 0 (the minimum value) and 15 (the maximum value), and the average probability ofscopehaving a non zero coefficient equals (DT + 1) / 16. In particular, when DT equals 15 the function guaranties that all coefficients are non zero (i.e., maximum density). These considerations apply to both the RLC over GF(2) and RLC over GF(2^^8), the only difference being the value ofthis document. 4. Sliding Windowthe m parameter. With the RLC over GF(2) FEC Scheme (Section 5), m is equal to 1. With RLC over GF(2^^8)for Arbitrary Packet Flows This fully-specifiedFEC Schemedefines(Section 4), m is equal to 8. <CODE BEGINS> /* * Fills in theSliding Window Random Linear Codes (RLC) over GF(2^^8). 4.1. Formats and Codes 4.1.1. FEC Framework Configuration Information Followingtable of coding coefficients (of theguidelinesright size) * provided with the appropriate number of[RFC6363], section 5.6, this section providescoding coefficients to * use for theFEC Framework Configuration Information (or FFCI). This FCCI needsrepair symbol key provided. * * (in) repair_key key associated tobe shared (e.g., using SDP) between the FECFRAME senderthis repair symbol. This * parameter is ignored (useless) if m=1 andreceiver instances in orderdt=15 * (in/out) cc_tab[] pointer tosynchronize them. It includesaFEC Encoding ID, mandatory for any FEC Scheme specification, plus scheme-specific elements. 4.1.1.1. FEC Encoding ID o FEC Encoding ID:table of thevalue assignedright size tothis fully specified FEC Scheme MUST be XXXX,store * coding coefficients. All coefficients are * stored asassigned by IANA (Section 10). When SDP is used to communicatebytes, regardless of theFFCI,m parameter, * upon return of thisFEC Encoding ID is carried in the 'encoding-id' parameter. 4.1.1.2. FEC Scheme-Specific Information The FEC Scheme-Specific Information (FSSI) includes elements that are specific to the present FEC Scheme. More precisely: Encoding symbol size (E): a non-negative integer that indicates the sizefunction. * (in) cc_nb number ofeach encoding symbolentries inbytes; This element is required both by the sender (RLC encoder) andthereceiver(s) (RLC decoder). When SDPtable. This value isused* equal tocommunicate the FFCI, this FEC Scheme-specific information is carried inthe'fssi' parameter in textual representation as specified in [RFC6364]. For instance: fssi=E:1400 If another mechanism requirescurrent encoding window size. * (in) dt integer between 0 and 15 (inclusive) that * controls theFSSIdensity. With value 15, all * coefficients are guaranteed to becarried as an opaque octet string (for instance, afternon zero * (i.e. equal to 1 with GF(2) and equal to aBase64 encoding), the encoding format consists* value in {1,... 255} with GF(2^^8)), otherwise * a fraction ofthe following 2 octets: Encoding symbol length (E): 16-bit field.them will be 0. * (in) m Finite Field GF(2^^m) parameter. In this * document only values 1 and 8 are considered. * (out) returns 0 in case of success, an error code * different than 0 otherwise. */ int generate_coding_coefficients (uint16_t repair_key, uint8_t cc_tab[], uint16_t cc_nb, uint8_t dt, uint8_t m) { uint32_t i; tinymt32_t s; /* PRNG internal state */ if (dt > 15) { return -1; /* error, bad dt parameter */ } switch (m) { case 1: if (dt == 15) { /* all coefficients are 1 */ memset(cc_tab, 1, cc_nb); } else { /* here coefficients are either 0 or 12 3 4 5 6 7 8 9*/ tinymt32_init(&s, repair_key); for (i = 0 ; i < cc_nb ; i++) { cc_tab[i] = (tinymt32_rand16(&s) <= dt) ? 12 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol Length (E) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 3: FSSI Encoding Format 4.1.2. Explicit Source FEC Payload ID A FEC Source Packet MUST contain an Explicit Source FEC Payload ID that: 0; } } break; case 8: tinymt32_init(&s, repair_key); if (dt == 15) { /* coefficient 0 isappendedavoided here in order to include * all theendsource symbols */ for (i = 0 ; i < cc_nb ; i++) { do { cc_tab[i] = (uint8_t) tinymt32_rand256(&s); } while (cc_tab[i] == 0); } } else { /* here a certain number ofthe packet as illustrated in Figure 4. +--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | ADU | +--------------------------------+ | Explicit Source FEC Payload ID | +--------------------------------+coefficients should be 0 */ for (i = 0 ; i < cc_nb ; i++) { if (tinymt32_rand16(&s) <= dt) { do { cc_tab[i] = (uint8_t) tinymt32_rand256(&s); } while (cc_tab[i] == 0); } else { cc_tab[i] = 0; } } } break; default: return -2; /* error, bad parameter m */ } return 0 /* success */ } <CODE ENDS> Figure4: Structure of an3: Coding Coefficients Generation Function Reference Implementation 3.7. Finite Fields Operations 3.7.1. Finite Field Definitions The two RLC FECSource Packet withSchemes specified in this document reuse theExplicit Source FEC Payload IDFinite Fields defined in [RFC5510], section 8.1. Moreprecisely,specifically, theExplicit Source FEC Payload ID is composedelements of thefollowingfield(Figure 5): Encoding Symbol ID (ESI) (32-bit field): this unsigned integer identifiesGF(2^^m) are represented by polynomials with binary coefficients (i.e., over GF(2)) and degree lower or equal to m-1. The addition between two elements is defined as thefirst source symboladdition of binary polynomials in GF(2), which is equivalent to a bitwise XOR operation on the binary representation of these elements. With GF(2^^8), multiplication between two elements is theADUI correspondingmultiplication modulo a given irreducible polynomial of degree 8. The following irreducible polynomial MUST be used for GF(2^^8): x^^8 + x^^4 + x^^3 + x^^2 + 1 With GF(2), multiplication corresponds tothis FECa logical AND operation. 3.7.2. Linear Combination of SourcePacket.Symbols Computation TheESI is incremented for each newtwo RLC FEC Schemes require the computation of a linear combination of sourcesymbol, and after reachingsymbols, using themaximum value (2^32-1), wrapping to zero occurs. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol ID (ESI) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 5: Source FEC Payload ID Encoding Format 4.1.3. Repair FEC Payload ID Acoding coefficients produced by the generate_coding_coefficients() function and stored in the cc_tab[] array. With the RLC over GF(2^^8) FECRepair Packet MAY contain one or more repair symbols. When there are several repair symbols, allScheme, a linear combination ofthem MUST have been generated fromthesameew_size source symbol present in the encoding window,using Repair_Key values that are managedsay src_0 to src_ew_size_1, in order to generate a repair symbol, is computed asexplained below. A receiver can easily deduce the numberfollows. For each byte ofrepair symbols within a FEC Repair Packet by comparingposition i in each source and thereceived FEC Repair Packet size (equalrepair symbol, where i belongs tothe UDP payload size when UDP{0; E-1}, compute: repair[i] = cc_tab[0] * src_0[i] XOR cc_tab[1] * src_1[i] XOR ... XOR cc_tab[ew_size - 1] * src_ew_size_1[i] where * is theunderlying transport protocol) and the symbol size, E, communicatedmultiplication over GF(2^^8). In practice various optimizations need to be used in order to make this computation efficient (see in particular [PGM13]). With theFFCI. ARLC over GF(2) FECRepair Packet MUST containScheme (binary case), aRepair FEC Payload ID thatlinear combination isprepended to thecomputed as follows. The repair symbolas illustrated in Figure 6. +--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | Repair FEC Payload ID | +--------------------------------+ | Repair Symbol | +--------------------------------+ Figure 6: Structure of an FEC Repair Packet with the Repair FEC Payload ID More precisely, the Repair FEC Payload ID is composed of the following fields (Figure 7): Repair_Key (16-bit field): this unsigned integerisused as a seed by the coefficient generation function (Section 3.5) in order to generatethedesired number of coding coefficients. When a FEC Repair Packet contains several repair symbols, this repair key value is thatXOR sum of all thefirst repair symbol. The remaining repair keys can be deduced by incrementing by 1 this value, upsource symbols corresponding to amaximum value of 65535 after which it loops back to 0. Density Threshold for the coding coefficients, DT (4-bit field): this unsigned integer carries the Density Threshold (DT) used by thecoding coefficientgeneration function Section 3.5. More precisely, it controlscc_tab[j] equal to 1 (i.e., theprobability of having a nonsource symbols corresponding to zero codingcoefficient, which equals (DT+1) / 16. When a FEC Repair Packet contains several repair symbols, the DT value applies to all of them; Numbercoefficients are ignored). The XOR sum ofSource Symbols in the encoding window, NSS (12-bit field): this unsigned integer indicatesthenumberbyte of position i in each sourcesymbolsis computed and stored in theencoding window when this repair symbol was generated. When a FEC Repair Packet contains severalcorresponding byte of the repairsymbols, this NSS value appliessymbol, where i belongs toall of them; ESI of First Source Symbol in the encoding window, FSS_ESI (32-bit field): this unsigned integer indicates the ESI of the first source symbol in{0; E-1}. In practice, theencoding window when this repair symbol was generated. When a FEC Repair Packet containsXOR sums will be computed severalrepair symbols, this FSS_ESI value applies to allbytes at a time (e.g., on 64 bit words, or on arrays ofthem; 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Repair_Key | DT |NSS (# src symb in ew) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FSS_ESI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 7: Repair16 or more bytes when using SIMD CPU extensions). With both FECPayload ID Encoding Format 4.1.4. Additional Procedures The following procedure applies: o The ESI of source symbols MUST start with value 0 forSchemes, thefirst source symbol and MUST be managed sequentially. Wrappingdetails of how tozero happens after reachingoptimize themaximum 32-bit value. 5.computation of these linear combinations are of high practical importance but out of scope of this document. 4. Sliding Window RLC FEC Scheme overGF(2)GF(2^^8) for Arbitrary Packet Flows This fully-specified FEC Scheme defines the Sliding Window Random Linear Codes (RLC) overGF(2) (binary case). 5.1.GF(2^^8). 4.1. Formats and Codes5.1.1.4.1.1. FEC Framework Configuration Information5.1.1.1. FEC Encoding ID o FEC Encoding ID: the value assigned to this fully specified FEC Scheme MUST be YYYY, as assigned by IANA (Section 10). When SDP is used to communicateFollowing theFFCI,guidelines of [RFC6363], section 5.6, thisFEC Encoding ID is carried insection provides the'encoding-id' parameter. 5.1.1.2.FECScheme-SpecificFramework Configuration InformationAll(or FFCI). This FCCI needs to be shared (e.g., using SDP) between theconsiderations of Section 4.1.1.2 apply here. 5.1.2. Explicit SourceFECFRAME sender and receiver instances in order to synchronize them. It includes a FECPayloadEncoding ID, mandatory for any FEC Scheme specification, plus scheme-specific elements. 4.1.1.1. FEC Encoding IDAllo FEC Encoding ID: theconsiderations of Section 4.1.1.2 apply here. 5.1.3. Repairvalue assigned to this fully specified FECPayload ID AllScheme MUST be XXXX, as assigned by IANA (Section 10). When SDP is used to communicate theconsiderations of Section 4.1.1.2 apply here, withFFCI, this FEC Encoding ID is carried in theonly exception'encoding-id' parameter. 4.1.1.2. FEC Scheme-Specific Information The FEC Scheme-Specific Information (FSSI) includes elements that are specific to theRepair_Key field is useless if DT = 15 (indeed, inpresent FEC Scheme. More precisely: Encoding symbol size (E): a non-negative integer thatcase allindicates thecoefficients are necessarily equalsize of each encoding symbol in bytes; Window Size Ratio (WSR) parameter: a non-negative integer between 0 and 255 (both inclusive) used to initialize window sizes. A value of 0 indicates this parameter is not considered (e.g., a fixed encoding window size may be chosen). A value between 1 and 255 inclusive is required by certain of thecoefficient generation function does not use any PRNG). When DT = 15 itparameter derivation techniques described in Appendix C; This element isRECOMMENDED thatrequired both by the senderuse value 0 for(RLC encoder) and theRepair_Key field, but a receiver SHALL ignorereceiver(s) (RLC decoder). When SDP is used to communicate the FFCI, thisfield. 5.1.4. Additional Procedures AllFEC Scheme-specific information is carried in theconsiderations of Section 4.1.1.2 apply here. 6. FEC Code Specification 6.1. Encoding Side This section provides a high level description of a Sliding Window RLC encoder. Whenever a new FEC Repair Packet is needed, the RLC encoder instance first gathers the ew_size source symbols currently in the sliding encoding window. Then it chooses a repair key, which can be a monotonically increasing integer value, incremented for each repair symbol up to a maximum value of 65535 (as it is carried within a 16-bit field) after which it loops back to 0. This repair key is communicated to the coefficient generation function (Section 3.5)'fssi' parameter inorder to generate ew_size coding coefficients. Finally, the FECFRAME sender computes the repair symboltextual representation asa linear combination of the ew_size source symbols usingspecified in [RFC6364]. For instance: fssi=E:1400,WSR:191 In that case theew_size coding coefficients (Section 3.6). When E is smallname values "E" andwhen there is an incentive"WSR" are used topack several repair symbols withinconvey thesame FEC Repair Packet,E and WSR parameters respectively. If another mechanism requires theappropriate number of repair symbols are computed. In that caseFSSI to be carried as an opaque octet string, therepair key for eachencoding format consists ofthem MUST be incremented by 1, keepingthesame ew_size source symbols, since onlyfollowing three octets, where thefirst repair key will beE field is carried inthe Repair FEC Payload ID. The FEC Repair Packet"big-endian" or "network order" format, that is, most significant byte first: Encoding symbol length (E): 16-bit field; Window Size Ratio Parameter (WSR): 8-bit field. These three octets canthenbepassed to the transport layercommunicated as such, or fortransmission. The source versus repair FEC packet transmission order is out of scope of this document and several approaches exist that are implementation specific. Other solutions are possibleinstance, be subject toselect a repair key value when a newan additional Base64 encoding. 0 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol Length (E) | WSR | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 4: FSSI Encoding Format 4.1.2. Explicit Source FECRepairPayload ID A FEC Source Packet MUST contain an Explicit Source FEC Payload ID that isneeded, for instance by choosing a random integer between 0 and 65535. However, selectingappended to thesame repair keyend of the packet asbefore (which may happenillustrated incaseFigure 5. +--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | ADU | +--------------------------------+ | Explicit Source FEC Payload ID | +--------------------------------+ Figure 5: Structure ofa random process) is only meaningful if the encoding window has changed, otherwise the samean FECRepairSource Packetwill be generated. 6.2. Decoding Side This section provides a high level description of a Sliding Window RLC decoder. A FECFRAME receiver needs to maintain a linear system whose variables arewith thereceived and lost source symbols. Upon receiving aExplicit Source FECRepair Packet, a receiver first extracts allPayload ID More precisely, therepair symbols it contains (in case several repair symbols are packed together). For each repair symbol, when at least oneExplicit Source FEC Payload ID is composed of thecorresponding source symbols it protects has been lost, the receiver adds an equation to the linear system (or no equation iffollowing field, carried in "big-endian" or "network order" format, that is, most significant byte first (Figure 6): Encoding Symbol ID (ESI) (32-bit field): thisrepair packet does not changeunsigned integer identifies thelinear system rank). This equationfirst source symbol ofcourse re-uses the ew_size coding coefficients that are computed by the same coefficient generation function (Section Section 3.5), usingtherepair keyADUI corresponding to this FEC Source Packet. The ESI is incremented for each new source symbol, andencoding window descriptions carried inafter reaching the maximum value (2^32-1), wrapping to zero occurs. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol ID (ESI) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 6: Source FEC Payload ID Encoding Format 4.1.3. Repair FEC PayloadID. Whenever possible (i.e., when a sub-system coveringID A FEC Repair Packet MAY contain one or morelost source symbols is of full rank), decoding is performed in order to recover lost sourcerepair symbols.Each time an ADUIWhen there are several repair symbols, all of them MUST have been generated from the same encoding window, using Repair_Key values that are managed as explained below. A receiver canbe totally recovered, padding is removed (thanks toeasily deduce theLength field, L,number of repair symbols within a FEC Repair Packet by comparing theADUI) and the ADU is assignedreceived FEC Repair Packet size (equal to thecorresponding application flow (thanks toUDP payload size when UDP is theFlow ID field, F, ofunderlying transport protocol) and theADUI). This ADUsymbol size, E, communicated in the FFCI. A FEC Repair Packet MUST contain a Repair FEC Payload ID that isfinally passedprepended to thecorresponding upper application. Receivedrepair symbol as illustrated in Figure 7. +--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | Repair FECSource Packets, containingPayload ID | +--------------------------------+ | Repair Symbol | +--------------------------------+ Figure 7: Structure of anADU, MAY be passed toFEC Repair Packet with theapplication either immediately or after some time to guaranty an ordered delivery toRepair FEC Payload ID More precisely, theapplication. This document does not mandate any approach as this is an operational and management decision. With real-time flows, a lost ADU thatRepair FEC Payload ID isdecoded aftercomposed of themaximum latencyfollowing fields where all integer fields are carried in "big-endian" oran ADU received after"network order" format, that is, most significant byte first (Figure 8): Repair_Key (16-bit field): thisdelay has no value tounsigned integer is used as a seed by theapplication. This raisescoefficient generation function (Section 3.6) in order to generate thequestiondesired number ofdeciding whether or not an ADU is late.coding coefficients. Thisdecision MAYrepair key may betaken within the FECFRAME receiver (e.g., using the decoding window, seea monotonically increasing integer value that loops back to 0 after reaching 65535 (see Section3.1) or within6.1). When a FEC Repair Packet contains several repair symbols, this repair key value is that of theapplication (e.g., using RTP timestamps within the ADU). Deciding which option to follow and whether or notfirst repair symbol. The remaining repair keys can be deduced by incrementing by 1 this value, up topass all ADUs, including those assumed late,a maximum value of 65535 after which it loops back to 0. Density Threshold for theapplication are operational decisions that depend oncoding coefficients, DT (4-bit field): this unsigned integer carries theapplication and are therefore outDensity Threshold (DT) used by the coding coefficient generation function Section 3.6. More precisely, it controls the probability ofscopehaving a non zero coding coefficient, which equals (DT+1) / 16. When a FEC Repair Packet contains several repair symbols, the DT value applies to all of them; Number of Source Symbols in the encoding window, NSS (12-bit field): thisdocument. Additionally, Appendix B discusses a backward compatible optimization whereby lateunsigned integer indicates the number of source symbolsMAY still be used within the FECFRAME receiverinorderthe encoding window when this repair symbol was generated. When a FEC Repair Packet contains several repair symbols, this NSS value applies toimprove transmission robustness. 7. Implementation Status Editor's notes: RFC Editor, please removeall of them; ESI of First Source Symbol in the encoding window, FSS_ESI (32-bit field): thissection motivated by RFC 6982 before publishingunsigned integer indicates theRFC. Thanks. An implementationESI of theSliding Window RLC FEC Scheme for FECFRAME exists: o Organisation: Inria o Description: This is an implementation offirst source symbol in theSliding Window RLCencoding window when this repair symbol was generated. When a FECScheme limited to GF(2^^8). It relies on a modified versionRepair Packet contains several repair symbols, this FSS_ESI value applies to all ofour OpenFEC (http://openfec.org) FEC code library. It is integratedthem; 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Repair_Key | DT |NSS (# src symb inour FECFRAME software (see [fecframe-ext]). o Maturity: prototype. o Coverage: this software complies withew) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FSS_ESI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 8: Repair FEC Payload ID Encoding Format 4.2. Procedures All the procedures of Section 3 apply to this FEC Scheme. 5. Sliding Window RLC FECScheme. o Licensing: proprietary. o Contact: vincent.roca@inria.fr 8. Security Considerations TheScheme over GF(2) for Arbitrary Packet Flows This fully-specified FEC Scheme defines the Sliding Window Random Linear Codes (RLC) over GF(2) (binary case). 5.1. Formats and Codes 5.1.1. FEC Frameworkdocument [RFC6363] provides a comprehensive analysis of security considerations applicableConfiguration Information 5.1.1.1. FEC Encoding ID o FEC Encoding ID: the value assigned to this fully specified FECSchemes. Therefore,Scheme MUST be YYYY, as assigned by IANA (Section 10). When SDP is used to communicate thepresent section followsFFCI, this FEC Encoding ID is carried in the 'encoding-id' parameter. 5.1.1.2. FEC Scheme-Specific Information All thesecurityconsiderationssectionof[RFC6363]Section 4.1.1.2 apply here. 5.1.2. Explicit Source FEC Payload ID All the considerations of Section 4.1.2 apply here. 5.1.3. Repair FEC Payload ID All the considerations of Section 4.1.3 apply here, with the only exception that the Repair_Key field is useless if DT = 15 (indeed, in that case all the coefficients are necessarily equal to 1 and the coefficient generation function does not use any PRNG). When DT = 15 the FECFRAME sender MUST set the Repair_Key field to zero on transmission and a receiver MUST ignore it on receipt. 5.2. Procedures All the procedures of Section 3 apply to this FEC Scheme. 6. FEC Code Specification 6.1. Encoding Side This section provides a high level description of a Sliding Window RLC encoder. Whenever a new FEC Repair Packet is needed, the RLC encoder instance first gathers the ew_size source symbols currently in the sliding encoding window. Then it chooses a repair key, which can be a monotonically increasing integer value, incremented for each repair symbol up to a maximum value of 65535 (as it is carried within a 16-bit field) after which it loops back to 0. This repair key is communicated to the coefficient generation function (Section 3.6) in order to generate ew_size coding coefficients. Finally, the FECFRAME sender computes the repair symbol as a linear combination of the ew_size source symbols using the ew_size coding coefficients (Section 3.7). When E is small and when there is an incentive to pack several repair symbols within the same FEC Repair Packet, the appropriate number of repair symbols are computed. In that case the repair key for each of them MUST be incremented by 1, keeping the same ew_size source symbols, since only the first repair key will be carried in the Repair FEC Payload ID. The FEC Repair Packet can then be passed to the transport layer for transmission. The source versus repair FEC packet transmission order is out of scope of this document and several approaches exist that are implementation-specific. Other solutions are possible to select a repair key value when a new FEC Repair Packet is needed, for instance, by choosing a random integer between 0 and 65535. However, selecting the same repair key as before (which may happen in case of a random process) is only meaningful if the encoding window has changed, otherwise the same FEC Repair Packet will be generated. 6.2. Decoding Side This section provides a high level description of a Sliding Window RLC decoder. A FECFRAME receiver needs to maintain a linear system whose variables are the received and lost source symbols. Upon receiving a FEC Repair Packet, a receiver first extracts all the repair symbols it contains (in case several repair symbols are packed together). For each repair symbol, when at least one of the corresponding source symbols it protects has been lost, the receiver adds an equation to the linear system (or no equation if this repair packet does not change the linear system rank). This equation of course re-uses the ew_size coding coefficients that are computed by the same coefficient generation function (Section Section 3.6), using the repair key and encoding window descriptions carried in the Repair FEC Payload ID. Whenever possible (i.e., when a sub-system covering one or more lost source symbols is of full rank), decoding is performed in order to recover lost source symbols. Gaussian elimination is one possible algorithm to solve this linear system. Each time an ADUI can be totally recovered, padding is removed (thanks to the Length field, L, of the ADUI) and the ADU is assigned to the corresponding application flow (thanks to the Flow ID field, F, of the ADUI). This ADU is finally passed to the corresponding upper application. Received FEC Source Packets, containing an ADU, MAY be passed to the application either immediately or after some time to guaranty an ordered delivery to the application. This document does not mandate any approach as this is an operational and management decision. With real-time flows, a lost ADU that is decoded after the maximum latency or an ADU received after this delay has no value to the application. This raises the question of deciding whether or not an ADU is late. This decision MAY be taken within the FECFRAME receiver (e.g., using the decoding window, see Section 3.1) or within the application (e.g., using RTP timestamps within the ADU). Deciding which option to follow and whether or not to pass all ADUs, including those assumed late, to the application are operational decisions that depend on the application and are therefore out of scope of this document. Additionally, Appendix D discusses a backward compatible optimization whereby late source symbols MAY still be used within the FECFRAME receiver in order to improve transmission robustness. 7. Implementation Status Editor's notes: RFC Editor, please remove this section motivated by RFC 6982 before publishing the RFC. Thanks. An implementation of the Sliding Window RLC FEC Scheme for FECFRAME exists: o Organisation: Inria o Description: This is an implementation of the Sliding Window RLC FEC Scheme limited to GF(2^^8). It relies on a modified version of our OpenFEC (http://openfec.org) FEC code library. It is integrated in our FECFRAME software (see [fecframe-ext]). o Maturity: prototype. o Coverage: this software complies with the Sliding Window RLC FEC Scheme. o Licensing: proprietary. o Contact: vincent.roca@inria.fr 8. Security Considerations The FEC Framework document [RFC6363] provides a fairly comprehensive analysis of security considerations applicable to FEC Schemes. Therefore, the present section follows the security considerations section of [RFC6363] and only discusses specific topics. 8.1. Attacks Against the Data Flow 8.1.1. Access to Confidential Content The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. To summarize, if confidentiality is a concern, it is RECOMMENDED that one of the solutions mentioned in [RFC6363] is used with special considerations to the way this solution is applied (e.g., is encryption applied before or after FEC protection, within the end-system or in a middlebox), to the operational constraints (e.g., performing FEC decoding in a protected environment may be complicated or even impossible) and to the threat model. 8.1.2. Content Corruption The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. To summarize, it is RECOMMENDED that one of the solutions mentioned in [RFC6363] is used on both the FEC Source and Repair Packets. 8.2. Attacks Against the FEC Parameters The FEC Scheme specified in this document defines parameters that can be the basis of attacks. More specifically, the following parameters of the FFCI may be modified by an attacker who targets receivers (Section 4.1.1.2): o FEC Encoding ID: changing this parameter leads a receiver to consider a different FEC Scheme. The consequences are severe, the format of the Explicit Source FEC Payload ID and Repair FEC Payload ID of received packets will probably differ, leading to various malfunctions. Even if the original and modified FEC Schemes share the same format, FEC decoding will either fail or lead to corrupted decoded symbols. This will happen if an attacker turns value YYYY (i.e., RLC over GF(2)) to value XXXX (RLC over GF(2^^8)), an additional consequence being a higher processing overhead at the receiver. In any case, the attack results in a form of Denial of Service (DoS) or corrupted content. o Encoding symbol length (E): setting this E parameter to a different value will confuse a receiver. If the size of a received FEC Repair Packet is no longer multiple of the modified E value, a receiver quickly detects a problem and SHOULD reject the packet. If the new E value is a sub-multiple of the original E value (e.g., half the original value), then receivers may not detect the problem immediately. For instance, a receiver may think that a received FEC Repair Packet contains more repair symbols (e.g., twice as many if E is reduced by half), leading to malfunctions whose nature depends on implementation details. Here also, the attack always results in a form of DoS or corrupted content. It is therefore RECOMMENDED that security measures be taken to guarantee the FFCI integrity, as specified in [RFC6363]. How to achieve this depends on the way the FFCI is communicated from the sender to the receiver, which is not specified in this document. Similarly, attacks are possible against the Explicit Source FEC Payload ID and Repair FEC Payload ID. More specifically, in case of a FEC Source Packet, the following value can be modified by an attacker who targets receivers: o Encoding Symbol ID (ESI): changing the ESI leads a receiver to consider a wrong ADU, resulting in severe consequences, including corrupted content passed to the receiving application; And in case of a FEC Repair Packet: o Repair Key: changing this value leads a receiver to generate a wrong coding coefficient sequence, and therefore any source symbol decoded using the repair symbols contained in this packet will be corrupted; o DT: changing this value also leads a receiver to generate a wrong coding coefficient sequence, and therefore any source symbol decoded using the repair symbols contained in this packet will be corrupted. In addition, if the DT value is significantly increased, it will generate a higher processing overhead at a receiver. In case of very large encoding windows, this may impact the terminal performance; o NSS: changing this value leads a receiver to consider a different set of source symbols, and therefore any source symbol decoded using the repair symbols contained in this packet will be corrupted. In addition, if the NSS value is significantly increased, it will generate a higher processing overhead at a receiver, which may impact the terminal performance; o FSS_ESI: changing this value also leads a receiver to consider a different set of source symbols and therefore any source symbol decoded using the repair symbols contained in this packet will be corrupted. It is therefore RECOMMENDED that security measures are taken to guarantee the FEC Source and Repair Packets as stated in [RFC6363]. 8.3. When Several Source Flows are to be Protected Together The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. 8.4. Baseline Secure FEC Framework Operation The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363] concerning the use of the IPsec/ESP security protocol as a mandatory to implement (but not mandatory to use) security scheme. This is well suited to situations where the only insecure domain is the one over which the FEC Framework operates. 8.5. Additional Security Considerations for Numerical Computations In addition to the above security considerations, inherited from [RFC6363], the present document introduces several formulae, in particular in Appendix C.1. It is RECOMMENDED to check that the computed values stay within reasonable bounds since numerical overflows, caused by an erroneous implementation or an erroneous input value, may lead to hazardous behaviours. However, what "reasonable bounds" means is use-case and implementation dependent and is not detailed in this document. Appendix C.2 also mentions the possibility of "using the timestamp field of an RTP packet header" when applicable. A malicious attacker may deliberately corrupt this header field in order to trigger hazardous behaviours at a FECFRAME receiver. Protection against this type of content corruption can be addressed with the above recommendations on a baseline secure operation. In addition, it is also RECOMMENDED to check that the timestamp value be within reasonable bounds. 9. Operations and Management Considerations The FEC Framework document [RFC6363] provides a fairly comprehensive analysis of operations and management considerations applicable to FEC Schemes. Therefore, the present section only discusses specific topics. 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8) The present document specifies two FEC Schemes that differ on the Finite Field used for the coding coefficients. It is expected that the RLC over GF(2^^8) FEC Scheme will be mostly used since it warrants a higher packet loss protection. In case of small encoding windows, the associated processing overhead is not an issue (e.g., we measured decoding speeds between 745 Mbps and 2.8 Gbps on an ARM Cortex-A15 embedded board in [Roca17] for an encoding window of size 18 or 23 symbols). Of course the CPU overhead will increase with the encoding window size, because more operations in the GF(2^^8) finite field will be needed. The RLC over GF(2) FEC Scheme offers an alternative. In that case operations symbols can be directly XOR-ed together which warrants high bitrate encoding and decoding operations, and can be an advantage with large encoding windows. However, packet loss protection is significantly reduced by using this FEC Scheme. 9.2. Operational Recommendations: Coding Coefficients Density Threshold In addition to the choice of the Finite Field, the two FEC Schemes define a coding coefficient density threshold (DT) parameter. This parameter enables a sender to control the code density, i.e., the proportion of coefficients that are non zero on average. With RLC over GF(2^^8), it is usually appropriate that small encoding windows be associated to a density threshold equal to 15, the maximum value, in order to warrant a high loss protection. On the opposite, with larger encoding windows, it is usually appropriate that the density threshold be reduced. With large encoding windows, an alternative can be to use RLC over GF(2) and a density threshold equal to 7 (i.e., an average density equal to 1/2) or smaller. Note that using a density threshold equal to 15 with RLC over GF(2) is equivalent to using an XOR code that computes the XOR sum of all the source symbols in the encoding window. In that case: (1) only a single repair symbol can be produced for any encoding window, and (2) the repair_key parameter becomes useless (the coding coefficients generation function does not rely on the PRNG). 10. IANA Considerations This document registers two values in the "FEC Framework (FECFRAME) FEC Encoding IDs" registry [RFC6363] as follows: o YYYY refers to the Sliding Window Random Linear Codes (RLC) over GF(2) FEC Scheme for Arbitrary Packet Flows, as defined in Section 5 of this document. o XXXX refers to the Sliding Window Random Linear Codes (RLC) over GF(2^^8) FEC Scheme for Arbitrary Packet Flows, as defined in Section 4 of this document. 11. Acknowledgments The authors would like to thank the three TSVWG chairs, Wesley Eddy, our shepherd, David Black and Gorry Fairhurst, as well as Spencer Dawkins, our responsible AD, and all those who provided comments, namely (alphabetical order) Alan DeKok, Jonathan Detchart, Russ Housley, Emmanuel Lochin, and Marie-Jose Montpetit. Last but not least, the authors are really grateful to the IESG members, in particular Benjamin Kaduk, Mirja Kuhlewind, Eric Rescorla, and Adam Roach for their highly valuable feedbacks that greatly contributed to improve this specification. 12. References 12.1. Normative References [fecframe-ext] Roca, V. and A. Begen, "Forward Error Correction (FEC) Framework Extension to Sliding Window Codes", Transport Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext (Work in Progress), January 2019, <https://tools.ietf.org/html/ draft-ietf-tsvwg-fecframe-ext>. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC6363] Watson, M., Begen, A., and V. Roca, "Forward Error Correction (FEC) Framework", RFC 6363, DOI 10.17487/RFC6363, October 2011, <https://www.rfc-editor.org/info/rfc6363>. [RFC6364] Begen, A., "Session Description Protocol Elements for the Forward Error Correction (FEC) Framework", RFC 6364, DOI 10.17487/RFC6364, October 2011, <https://www.rfc-editor.org/info/rfc6364>. [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>. 12.2. Informative References [Baccelli18] Baccelli, E., Gundogan, C., Hahm, O., Kietzmann, P., Lenders, M., Petersen, H., Schleiser, K., Schmidt, T., and M. Wahlisch, "RIOT: An Open Source Operating System for Low-End Embedded Devices in the IoT", IEEE Internet of Things Journal (Volume 5, Issue 6), DOI: 10.1109/JIOT.2018.2815038, December 2018. [KR12] Rikitake, K., "TinyMT Pseudo Random Number Generator for Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), September 14, 2012, Copenhagen, Denmark, DOI: http://dx.doi.org/10.1145/2364489.2364504, September 2012. [PGM13] Plank, J., Greenan, K., and E. Miller, "A Complete Treatment of Software Implementations of Finite Field Arithmetic for Erasure Coding Applications", University of Tennessee Technical Report UT-CS-13-717, http://web.eecs.utk.edu/~plank/plank/papers/ UT-CS-13-717.html, October 2013, <http://web.eecs.utk.edu/~plank/plank/papers/ UT-CS-13-717.html>. [RFC5170] Roca, V., Neumann, C., and D. Furodet, "Low Density Parity Check (LDPC) Staircase and Triangle Forward Error Correction (FEC) Schemes", RFC 5170, DOI 10.17487/RFC5170, June 2008, <https://www.rfc-editor.org/info/rfc5170>. [RFC5510] Lacan, J., Roca, V., Peltotalo, J., and S. Peltotalo, "Reed-Solomon Forward Error Correction (FEC) Schemes", RFC 5510, DOI 10.17487/RFC5510, April 2009, <https://www.rfc-editor.org/info/rfc5510>. [RFC6726] Paila, T., Walsh, R., Luby, M., Roca, V., and R. Lehtonen, "FLUTE - File Delivery over Unidirectional Transport", RFC 6726, DOI 10.17487/RFC6726, November 2012, <https://www.rfc-editor.org/info/rfc6726>. [RFC6816] Roca, V., Cunche, M., and J. Lacan, "Simple Low-Density Parity Check (LDPC) Staircase Forward Error Correction (FEC) Scheme for FECFRAME", RFC 6816, DOI 10.17487/RFC6816, December 2012, <https://www.rfc-editor.org/info/rfc6816>. [RFC6865] Roca, V., Cunche, M., Lacan, J., Bouabdallah, A., and K. Matsuzono, "Simple Reed-Solomon Forward Error Correction (FEC) Scheme for FECFRAME", RFC 6865, DOI 10.17487/RFC6865, February 2013, <https://www.rfc-editor.org/info/rfc6865>. [RFC8406] Adamson, B., Adjih, C., Bilbao, J., Firoiu, V., Fitzek, F., Ghanem, S., Lochin, E., Masucci, A., Montpetit, M-J., Pedersen, M., Peralta, G., Roca, V., Ed., Saxena, P., and S. Sivakumar, "Taxonomy of Coding Techniques for Efficient Network Communications", RFC 8406, DOI 10.17487/RFC8406, June 2018, <https://www.rfc-editor.org/info/rfc8406>. [Roca16] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. Thienot, "Block or Convolutional AL-FEC Codes? A Performance Comparison for Robust Low-Latency Communications", HAL open-archive document,hal-01395937 https://hal.inria.fr/hal-01395937/en/, November 2016, <https://hal.inria.fr/hal-01395937/en/>. [Roca17] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. Thienot, "Less Latency andonly discusses specific topics. 8.1. Attacks Against the Data Flow 8.1.1. Access to Confidential Content TheBetter Protection with AL-FEC Sliding WindowRLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. To summarize, if confidentiality isCodes: aconcern, itRobust Multimedia CBR Broadcast Case Study", 13th IEEE International Conference on Wireless and Mobile Computing, Networking and Communications (WiMob17), October 2017 https://hal.inria.fr/hal-01571609v1/en/, October 2017, <https://hal.inria.fr/hal-01571609v1/en/>. Appendix A. TinyMT32 Validation Criteria (Normative) PRNG determinism, for a given seed, isRECOMMENDED that one of the solutions mentioneda requirement. Consequently, in[RFC6363] is used with special considerationsorder to validate an implementation of theway this solution is applied (e.g., is encryption applied before or after FEC protection, within the end-system or in a middlebox), toTinyMT32 PRNG, theoperational constraints (e.g., performing FEC decoding in a protected environment mayfollowing criterias MUST becomplicated or even impossible) and to the threat model. 8.1.2. Content Corruptionmet. TheSliding Window RLC FEC Scheme specified in this document does not changefirst criteria focusses on therecommendations of [RFC6363]. To summarize, it is RECOMMENDEDcore TinyMT32 PRNG, thatoneproduces 32-bit pseudo-random numbers. Using a seed value of 1, thesolutions mentioned in [RFC6363] is used on both the FEC Source and Repair Packets. 8.2. Attacks Against the FEC Parameters The FEC Scheme specifiedfirst 50 values returned by: tinymt32_generate_uint32(s) as 32-bit unsigned integers MUST be equal to values provided inthis document defines parametersFigure 9. Note thatcan be the basis of attacks. More specifically, the following parameters ofthese values come from theFFCI may be modified by an attacker who targets receivers (Section 4.1.1.2): o FEC Encoding ID: changing this parameter leads a receivertinymt/check32.out.txt file provided by the authors toconsidervalidate implementations of TinyMT32, as part of the MersenneTwister-Lab/TinyMT Github repository. 2545341989 981918433 3715302833 2387538352 3591001365 3820442102 2114400566 2196103051 2783359912 764534509 643179475 1822416315 881558334 4207026366 3690273640 3240535687 2921447122 3984931427 4092394160 44209675 2188315343 2908663843 1834519336 3774670961 3019990707 4065554902 1239765502 4035716197 3412127188 552822483 161364450 353727785 140085994 149132008 2547770827 4064042525 4078297538 2057335507 622384752 2041665899 2193913817 1080849512 33160901 662956935 642999063 3384709977 1723175122 3866752252 521822317 2292524454 Figure 9: First 50 decimal values returned by tinymt32_generate_uint32(s) as 32-bit unsigned integers, with adifferent FEC Scheme.seed value of 1. Theconsequences are severe,second criteria focusses on theformat oftinymt32_rand256(), where theExplicit Source FEC Payload ID and Repair FEC Payload ID32-bit integer ofreceived packets will probably differ, leading to various malfunctions. Even if the original and modified FEC Schemes sharethesame format, FEC decoding will either fail or lead to corrupted decoded symbols. This will happen if an attacker turns value YYYY (i.e., RLC over GF(2))core TinyMT32 PRNG is scaled down tovalue XXXX (RLC over GF(2^^8)),anadditional consequence being8-bit integer. Using ahigher processing overhead at the receiver. In any case,seed value of 1, theattack resultsfirst 50 values returned by: tinymt32_rand256() as 8-bit unsigned integers MUST be equal to values provided in Figure 10. 37 225 177 176 21 246 54 139 168 237 211 187 62 190 104 135 210 99 176 11 207 35 40 113 179 214 254 101 212 211 226 41 234 232 203 29 194 211 112 107 217 104 197 135 23 89 210 252 109 166 Figure 10: First 50 decimal values returned by tinymt32_rand256() as 8-bit unsigned integers, with aformseed value ofDenial1. The third criteria focusses on the tinymt32_rand16(), where the 32-bit integer ofService (DoS); o Encoding symbol length (E): setting this E parameterthe core TinyMT32 PRNG is scaled down to adifferent value will confuse4-bit integer. Using areceiver. If the sizeseed value of 1, the first 50 values returned by: tinymt32_rand16() as 4-bit unsigned integers MUST be equal to values provided in Figure 11. 5 1 1 0 5 6 6 11 8 13 3 11 14 14 8 7 2 3 0 11 15 3 8 1 3 6 14 5 4 3 2 9 10 8 11 13 2 3 0 11 9 8 5 7 7 9 2 12 13 6 Figure 11: First 50 decimal values returned by tinymt32_rand16() as 4-bit unsigned integers, with areceived FEC Repair Packet is no longer multipleseed value of 1. The deterministic behavior of themodified E value,implementation of Figure 2 has been checked across several platforms: high-end laptops running 64-bits Mac OSX and Linux/Ubuntu; areceiver quickly detectsboard featuring aproblem32-bits ARM Cortex-A15 andSHOULD rejectrunning 32-bit Linux/Ubuntu; several embedded cards featuring either an ARM Cortex-M0+, a Cortex-M3 or a Cortex-M4 32-bit microcontroller, all of them running RIOT [Baccelli18]; two low-end embedded cards featuring either a 16-bit microcontroller (TI MSP430) or a 8-bit microcontroller (Arduino ATMEGA2560), both of them running RIOT. Appendix B. Assessing thepacket. IfPRNG Adequacy (Informational) This annex discusses thenew E value is a sub-multipleadequacy of theoriginal E value (e.g., halfTinyMT32 PRNG and theoriginal value), then receivers may not detecttinymt32_rand16() and tinymt32_rand256() functions, to theproblem immediately. For instance a receiver may think that a receivedRLC FECRepair Packet contains more repair symbols (e.g., twice as many if ESchemes. The goal isreduced by half), leadingtomalfunctions whose nature depends on implementation details. Here also,assess theattack always results in a formadequacy ofDoS; It is therefore RECOMMENDEDthese two functions in producing coding coefficients thatsecurity measuresare sufficiently different from one another, across various repair symbols with repair key values in sequence (we can expect this approach to betakencommonly used by implementers Section 6.1). This section is purely informational and does not claim toguaranteebe a solid evaluation. The two RLC FEC Schemes use theFFCI integrity, as specified in [RFC6363]. HowPRNG toachieve this depends on the wayproduce pseudo-random coding coefficients (Section 3.6), each time a new repair symbol is needed. A different repair key is used for each repair symbol, usually by incrementing theFFCIrepair key value (Section 6.1). For each repair symbol, a limited number of pseudo-random numbers iscommunicated fromneeded, depending on thesenderDT and encoding window size (Section 3.6), using either tinymt32_rand16() or tinymt32_rand256(). Therefore we are more interested in the randomness of small sequences of random numbers mapped to 4-bit or 8-bit integers, than in thereceiver,randomness of a very large sequence of random nmbers which is notspecified in this document. Similarly, attacks are possible against the Explicit Source FEC Payload ID and Repair FEC Payload ID. More specifically, in caserepresentative ofa FEC Source Packet, the following value can be modified by an attacker who targets receivers: o Encoding Symbol ID (ESI): changingtheESI leads a receiver to consider a wrong ADU, resulting in severe consequences, including corrupted content passed tousage of thereceiving application; And in casePRNG. Evaluation ofa FEC Repair Packet: o Repair Key: changing this value leads a receiver totinymt32_rand16(): We first generate awrong coding coefficient sequence,huge number (1,000,000,000) of small sequences (20 pseudo-random numbers per sequence), andtherefore any source symbol decoded usingperform statistics on therepair symbols contained in this packet will be corrupted; o DT: changing thisnumber of occurrences of each of the 16 possible values across all sequences. valuealso leadsoccurrences percentage (%) (total of 20000000000) 0 1250036799 6.2502 1 1249995831 6.2500 2 1250038674 6.2502 3 1250000881 6.2500 4 1250023929 6.2501 5 1249986320 6.2499 6 1249995587 6.2500 7 1250020363 6.2501 8 1249995276 6.2500 9 1249982856 6.2499 10 1249984111 6.2499 11 1250009551 6.2500 12 1249955768 6.2498 13 1249994654 6.2500 14 1250000569 6.2500 15 1249978831 6.2499 Figure 12: tinymt32_rand16(): occurrence statistics across areceiverhuge number (1,000,000,000) of small sequences (20 pseudo-random numbers per sequence), with 0 as the first PRNG seed. The results (Figure 12) show that all possible values are almost equally represented, or said differently, that the tinymt32_rand16() output converges togenerateawrong coding coefficient sequence, and therefore any source symbol decoded using the repair symbols contained in this packet will be corrupted. In addition, ifuniform distribution where each of theDT16 possible valueis significantly increased, it will generate a higher processing overhead at a receiver. In casewould appear exactly 1 / 16 * 100 = 6.25% ofvery large encoding windows, thistimes. Other types of biases mayimpactexist that may be visible with smaller tests (e.g., to evaluation theterminal performance; o NSS: changing this value leads a receiverconvergence speed toconsideradifferent set of source symbols, anduniform distribution). We thereforeany source symbol decoded using the repair symbols containedperform 200 tests, each of them consisting inthis packet will be corrupted. In addition, ifproducing 200 sequences, keeping ony theNSSfirst valueis significantly increased,of each sequence. We use non overlapping repair keys for each sequence, starting with value 0 and increasing itwill generate a higher processing overhead at a receiver, which may impact the terminal performance; o FSS_ESI: changing thisafter each use. valuealso leads a receiver to consider a different setmin occurrences max occurrences average occurrences 0 4 21 6.3675 1 4 22 6.0200 2 4 20 6.3125 3 5 23 6.1775 4 5 24 6.1000 5 4 21 6.5925 6 5 30 6.3075 7 6 22 6.2225 8 5 26 6.1750 9 3 21 5.9425 10 5 24 6.3175 11 4 22 6.4300 12 5 21 6.1600 13 5 22 6.3100 14 4 26 6.3950 15 4 21 6.1700 Figure 13: tinymt32_rand16(): occurrence statistics across 200 tests, each ofsource symbols and therefore any source symbol decoded using the repair symbols containedthem consisting inthis packet will be corrupted. It is therefore RECOMMENDED that security measures are taken to guarantee the FEC Source and Repair Packets as stated200 sequences of 1 pseudo-random number each, with non overlapping PRNG seeds in[RFC6363]. 8.3. When Several Source Flows are to be Protected Together The Sliding Window RLC FEC Scheme specifiedsequence starting from 0. Figure 13 shows across all 200 tests, for each of the 16 possible pseudo-random number values, the minimum (resp. maximum) number of times it appeared inthis document does not changea tests, as well as therecommendationsaverage number of[RFC6363]. 8.4. Baseline Secure FEC Framework Operation The Sliding Window RLC FEC Scheme specifiedoccurrences across the 200 tests. Although the distribution is not perfect, there is no major bias. On the opposite, inthis document does not changetherecommendations of [RFC6363] concerningsame conditions, theusePark Miller linear congruential PRNG ofthe IPsec/ESP security protocol as[RFC5170] with amandatory to implement (but not mandatory to use) security scheme. This is well suitedresult scaled down tosituations where4-bit values, using seeds in sequence starting from 1, returns systematically 0 as theonly insecure domainfirst value during some time, then after a certain repair key value threshold, it systematically returns 1, etc. Evaluation of tinymt32_rand256(): The same approach isthe one over which the FEC Framework operates. 8.5. Additional Security Considerations for Numerical Computations In additionused here. Results (not shown) are similar: occurrences vary between 7,810,3368 (i.e., 0.3905%) and 7,814,7952 (i.e., 0.3907%). Here also we see a convergence to theabove security considerations, inherited from [RFC6363],theoretical uniform distribution where each of thepresent document introduces several formulae, in particular inpossible value would appear exactly 1 / 256 * 100 = 0.390625% of times. Appendix C. Possible Parameter Derivation (Informational) Section3.1.1. It is RECOMMENDED3.1 defines several parameters tocheck thatcontrol thecomputed values stay within reasonnable bounds since numerical overflows, caused by an erroneous implementationencoder oran erroneous input value, may leaddecoder. This annex proposes techniques tohazardous behaviours. However what "reasonnable bounds" means is use-case and implementation dependent andderive these parameters according to the target use-case. This annex isnot detailedinformational, inthis document. Section 3.1.2 also mentionsthepossibility of "usingsense that using a different derivation technique will not prevent thetimestamp field of an RTP packet header" when applicable. A malicious attacker may deliberately corrupt this header field in orderencoder and decoder totrigger hazardous behaviours atinteroperate: aFECFRAME receiver. Protection against this type of content corruptiondecoder canbe addressed with the above recommendations on a baseline secure operation. In addition, it is also RECOMMENDEDstill recover an erased source symbol without any error. However, in case of a real-time flow, an inappropriate parameter derivation may lead tocheck thatthetimestamp value be within reasonnable bounds. 9. Operations and Management Considerations The FEC Framework document [RFC6363] provides a comprehensive analysisdecoding ofoperations and management considerations applicableerased source packets after their validity period, making them useless toFEC Schemes. Therefore,thepresent section only discusses specific topics. 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8)target application. This annex proposes an approach to reduce this risk, among other things. Thepresent document specifies twoFEC Schemesthat differdefined in this document can be used in various manners, depending on theFinite Field used fortarget use-case: o thecoding coefficients. It is expected thatsource ADU flow they protect may or may not have real-time constraints; o theRLC over GF(2^^8) FEC Scheme willsource ADU flow may bemostly used since it warrantsahigher packet loss protection. In case of small encoding windows,Constant Bitrate (CBR) or Variable BitRate (VBR) flow; o with a VBR source ADU flow, theassociated processing overhead isflow's minimum and maximum bitrates may or may notan issue (e.g., we measured decoding speeds between 745 Mbpsbe known; o and2.8 Gbps on an ARM Cortex-A15 embedded board in [Roca17]). Of course the CPU overhead will increase with the encoding window size, because more operations intheGF(2^^8) finite field willcommunication path between encoder and decoder may beneeded.a CBR communication path (e.g., as with certain LTE-based broadcast channels) or not (general case, e.g., with Internet). TheRLC over GF(2) FEC Scheme offers an alternative. In that case operations symbols can be directly XOR-ed together which warrants high bitrate encoding and decoding operations, and canparameter derivation technique should bean advantagesuited to the use-case, as described in the following sections. C.1. Case of a CBR Real-Time Flow In the following, we consider a real-time flow withlargemax_lat latency budget. The encodingwindows. However packetsymbol size, E, is constant. The code rate, cr, is also constant, its value depending on the expected communication lossprotectionmodel (this choice issignificantly reduced by usingout of scope of thisFEC Scheme. 9.2. Operational Recommendations: Coding Coefficients Density Thresholddocument). Inaddition toa first configuration, thechoice ofsource ADU flow bitrate at theFinite Field,input of thetwo FEC Schemes define a coding coefficient density threshold (DT) parameter. This parameter enables aFECFRAME sender is fixed and equal tocontrolbr_in (in bits/s), and this value is known by thecode density, i.e.,FECFRAME sender. It follows that theproportiontransmission bitrate at the output ofcoefficients that are non zerothe FECFRAME sender will be higher, depending onaverage. With RLC over GF(2^^8), it is usually appropriatethe added repair flow overhead. In order to comply with the maximum FEC-related latency budget, we have: dw_max_size = (max_lat * br_in) / (8 * E) assuming thatsmallthe encodingwindows be associatedand decoding times are negligible with respect to the target max_lat. This is adensity threshold equal to 15,reasonable assumption in many situations (e.g., see Section 9.1 in case of small window sizes). Otherwise themaximum value,max_lat parameter should be adjusted in order towarrant a high loss protection. On the opposite, with larger encoding windows, it is usually appropriate thatavoid thedensity threshold be reduced. With large encoding windows, an alternative canproblem. In any case, interoperability will never beto use RLC over GF(2) andcompromized by choosing a too large value. In adensity threshold equal to 7 (i.e., an average densitysecond configuration, the FECFRAME sender generates a fixed bitrate flow, equal to1/2) or smaller. Note that using a density thresholdthe CBR communication path bitrate equal to15 with RLC over GF(2)br_out (in bits/s), and this value isequivalent to using an XOR code that compute the XOR sum of allknown by thesource symbolsFECFRAME sender, as in [Roca17]. The maximum source flow bitrate needs to be such that, with theencoding window. In that case: (1) a singleadded repairsymbol can be produced for anyflow overhead, the total transmission bitrate remains inferior or equal to br_out. We have: dw_max_size = (max_lat * br_out * cr) / (8 * E) assuming here also that the encodingwindow,and(2)decoding times are negligible with respect to therepair_key parameter becomes useless (the coding coefficients generation function does not rely ontarget max_lat. For decoding to be possible within thePRNG). 10. IANA Considerations This document registers two values inlatency budget, it is required that the"FEC Framework (FECFRAME) FEC Encoding IDs" registry [RFC6363] as follows: o YYYY refersencoding window maximum size be smaller than or at most equal to theSliding Window Random Linear Codes (RLC) over GF(2) FEC Scheme for Arbitrary Packet Flows, as defined in Section 5 of this document. o XXXX refers todecoding window maximum size. The ew_max_size is theSliding Window Random Linear Codes (RLC) over GF(2^^8) FEC Scheme for Arbitrary Packet Flows, as defined in Section 4 of this document. 11. Acknowledgmentsmain parameter at a FECFRAME sender, but its exact value has no impact on the the FEC-related latency budget. Theauthors would likeew_max_size parameter is computed as follows: ew_max_size = dw_max_size * WSR / 255 In line with [Roca17], WSR = 191 is considered as a reasonable value (the resulting encoding tothank Russ Housley, Alan DeKok, Spencer Dawkins, Gorry Fairhurst, Jonathan Detchart, Emmanuel Lochin,decoding window size ratio is then close to 0.75), but other values between 1 andMarie-Jose Montpetit for their valuable feedbacks255 inclusive are possible, depending onthis document. 12. References 12.1. Normative References [fecframe-ext] Roca, V. and A. Begen, "Forward Error Correction (FEC) Framework Extension to Sliding Window Codes", Transport Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext (Work in Progress), September 2018, <https://tools.ietf.org/html/ draft-ietf-tsvwg-fecframe-ext>. [RFC2119] Bradner, S., "Key words for use in RFCsthe use-case. The dw_max_size is computed by a FECFRAME sender but not explicitly communicated toIndicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC6363] Watson, M., Begen, A., and V. Roca, "Forward Error Correction (FEC) Framework", RFC 6363, DOI 10.17487/RFC6363, October 2011, <https://www.rfc-editor.org/info/rfc6363>. [RFC6364] Begen, A., "Session Description Protocol Elements fora FECFRAME receiver. However, a FECFRAME receiver can easily evaluate theForward Error Correction (FEC) Framework", RFC 6364, DOI 10.17487/RFC6364, October 2011, <https://www.rfc-editor.org/info/rfc6364>. [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>. 12.2. Informative References [KR12] Rikitake, K., "TinyMT Pseudo Randomew_max_size by observing the maximum NumberGenerator for Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), September 14, 2012, Copenhagen, Denmark, DOI: http://dx.doi.org/10.1145/2364489.2364504, September 2012. [PGM13] Plank, J., Greenan, K., and E. Miller, "A Complete TreatmentofSoftware ImplementationsSource Symbols (NSS) value contained in the Repair FEC Payload ID ofFinite Field Arithmeticreceived FEC Repair Packets (Section 4.1.3). A receiver can then easily compute dw_max_size: dw_max_size = max_NSS_observed * 255 / WSR A receiver can then chose an appropriate linear system maximum size: ls_max_size >= dw_max_size It is good practice to use a larger value forErasure Coding Applications", University of Tennessee Technical Report UT-CS-13-717, http://web.eecs.utk.edu/~plank/plank/papers/ UT-CS-13-717.html, October 2013, <http://web.eecs.utk.edu/~plank/plank/papers/ UT-CS-13-717.html>. [RFC5510] Lacan, J., Roca, V., Peltotalo, J., and S. Peltotalo, "Reed-Solomon Forward Error Correction (FEC) Schemes", RFC 5510, DOI 10.17487/RFC5510, April 2009, <https://www.rfc-editor.org/info/rfc5510>. [RFC6726] Paila, T., Walsh, R., Luby, M., Roca, V., and R. Lehtonen, "FLUTE - File Delivery over Unidirectional Transport", RFC 6726, DOI 10.17487/RFC6726, November 2012, <https://www.rfc-editor.org/info/rfc6726>. [RFC6816] Roca, V., Cunche, M., and J. Lacan, "Simple Low-Density Parity Check (LDPC) Staircase Forward Error Correction (FEC) Schemels_max_size as explained in Appendix D, which does not impact maximum latency nor interoperability. In any case, forFECFRAME", RFC 6816, DOI 10.17487/RFC6816, December 2012, <https://www.rfc-editor.org/info/rfc6816>. [RFC6865] Roca, V., Cunche, M., Lacan, J., Bouabdallah, A., and K. Matsuzono, "Simple Reed-Solomon Forward Error Correction (FEC) Schemea given use-case (i.e., forFECFRAME", RFC 6865, DOI 10.17487/RFC6865, February 2013, <https://www.rfc-editor.org/info/rfc6865>. [RFC8406] Adamson, B., Adjih, C., Bilbao, J., Firoiu, V., Fitzek, F., Ghanem, S., Lochin, E., Masucci, A., Montpetit, M-J., Pedersen, M., Peralta, G., Roca, V., Ed., Saxena, P.,target encoding andS. Sivakumar, "Taxonomydecoding devices and desired protection levels in front ofCoding Techniques for Efficient Network Communications", RFC 8406, DOI 10.17487/RFC8406, June 2018, <https://www.rfc-editor.org/info/rfc8406>. [Roca16] Roca, V., Teibi, B., Burdinat, C., Tran, T.,communication impairments) andC. Thienot, "Block or Convolutional AL-FEC Codes? A Performance ComparisonforRobust Low-Latency Communications", HAL open-archive document,hal-01395937 https://hal.inria.fr/hal-01395937/en/, November 2016, <https://hal.inria.fr/hal-01395937/en/>. [Roca17] Roca, V., Teibi, B., Burdinat, C., Tran, T.,the computed ew_max_size, dw_max_size andC. Thienot, "Less Latencyls_max_size values, it is RECOMMENDED to check that the maximum encoding time andBetter Protection with AL-FEC Sliding Window Codes:maximum memory requirements at aRobust Multimedia CBR Broadcast Case Study", 13th IEEE International Conference on WirelessFECFRAME sender, andMobile Computing, Networkingmaximum decoding time andCommunications (WiMob17), October 2017 https://hal.inria.fr/hal-01571609v1/en/, October 2017, <https://hal.inria.fr/hal-01571609v1/en/>. Appendix A. TinyMT32 Pseudo-Random Number Generatormaximum memory requirements at a FECFRAME receiver, stay within reasonable bounds. When assuming that the encoding and decoding times are negligible with respect to the target max_lat, this should be verified as well, otherwise the max_lat SHOULD be adjusted accordingly. TheTinyMT32 PRNG reference implementationparticular case of session start needs to be managed appropriately since the ew_size, starting at zero, increases each time a new source ADU isdistributed underreceived by the FECFRAME sender, until it reaches the ew_max_size value. Therefore a FECFRAME receiver SHOULD continuously observe the received FEC Repair Packets, since the NSS value carried in the Repair FEC Payload ID will increase too, and adjust its ls_max_size accordingly if need be. With a CBR flow, session start is expected to be the only moment when the encoding window size will increase. Similarly, with a CBR real-time flow, the session end is expected to be the only moment when the encoding window size will progressively decrease. No adjustment of the ls_max_size is required at the FECFRAME receiver in that case. C.2. Other Types of Real-Time Flow In the following, we consider a real-time source ADU flow with aBSD license by the authorsmax_lat latency budget andexcerptsa variable bitrate (VBR) measured at the entry ofit are reproduced in Figure 8. The differences with respect totheoriginal source code are: oFECFRAME sender. A first approach consists in considering theunused partssmallest instantaneous bitrate of theoriginalsourcecode have been removed; o the appropriateADU flow, when this parameterset has been addedis known, and to reuse theinitialization function; oderivation of Appendix C.1. Considering thetinymt32_rand() function has been added; osmallest bitrate means that thefunction order has been changed; o certain internal variables have been renamed for compactness purposes. <CODE BEGINS> /** * Tiny Mersenne Twister only 127 bit internal state * * Authors : Mutsuo Saito (Hiroshima University) * Makoto Matsumoto (University of Tokyo) * * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, * Hiroshima University and The University of Tokyo. * All rights reserved. * * Redistribution and use in sourceencoding andbinary forms, with or without * modification,decoding window maximum size estimations arepermitted provided thatpessimistic: these windows have thefollowing conditions * are met: * * - Redistributions of source code must retainsmallest size required to enable on-time decoding at a FECFRAME receiver. If theabove copyright * notice,instantaneous bitrate is higher than thislist of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above * copyright notice,smallest bitrate, thislistapproach leads to an encoding window that is unnecessarily small, which reduces robustness in front ofconditions and the following * disclaimerlong erasure bursts. Another approach consists in using ADU timing information (e.g., using thedocumentation and/or other materials * provided with the distribution. * - Neither the nametimestamp field of an RTP packet header, or registering theHiroshima University nortime upon receiving a new ADU). From thenames of * its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <stdint.h> /** * tinymt32 internal state vector and parameters */ typedef struct { uint32_t status[4]; uint32_t mat1; uint32_t mat2; uint32_t tmat; } tinymt32_t; static void tinymt32_next_state (tinymt32_t * s); static uint32_t tinymt32_temper (tinymt32_t * s); static double tinymt32_generate_32double (tinymt32_t * s); /** * Parameter set to useglobal FEC-related latency budget, the FECFRAME sender can derive a practical maximum latency budget for encoding operations, max_lat_for_encoding. For theIETF RLCFEC Schemesspecification. * Do not change. * This parameter set is the first entry of the precalculated parameter * setsspecified infile tinymt32dc.0.1048576.txt, by Kenji Rikitake, available * at: https://github.com/jj1bdx/tinymtdc-longbatch/blob/master/ * tinymt32dc/tinymt32dc.0.1048576.txtthis document, this latency budget SHOULD be computed with: max_lat_for_encoding = max_lat * WSR / 255 Itis alsofollows that any source symbols associated to an ADU that has timed-out with respect to max_lat_for_encoding SHOULD be removed from theparameter set used: * Rikitake, K., "TinyMT Pseudo Random Number Generator for * Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), * September, 2012. */ #define TINYMT32_MAT1_PARAM 0x8f7011ee #define TINYMT32_MAT2_PARAM 0xfc78ff1f #define TINYMT32_TMAT_PARAM 0x3793fdff /** * This function initializesencoding window. With this approach there is no pre-determined ew_size value: this value fluctuates over theinternal state array with a 32-bit * unsigned integer seed. * @param s pointertime according totinymt internal state. * @param seedthe instantaneous source ADU flow bitrate. For practical reasons, a32-bit unsigned integer used asFECFRAME sender may still require that ew_size does not increase beyond aseed. */ void tinymt32_init (tinymt32_t * s, uint32_t seed) { #define MIN_LOOP 8 #define PRE_LOOP 8 s->status[0] = seed; s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; for (int i = 1; i < MIN_LOOP; i++) { s->status[i & 3] ^= i + UINT32_C(1812433253) * (s->status[(i - 1) & 3] ^ (s->status[(i - 1) & 3] >> 30)); } for (int i = 0; i < PRE_LOOP; i++) { tinymt32_next_state(s); } } /** * This function outputsmaximum value (Appendix C.3). With both approaches, and no matter the choice of the FECFRAME sender, a FECFRAME receiver can still easily evaluate the ew_max_size by observing the maximum Number of Source Symbols (NSS) value contained in the Repair FEC Payload ID of received FEC Repair Packets. A receiver can then compute dw_max_size and derive anintegerappropriate ls_max_size as explained in Appendix C.1. When the[0 .. maxv-1] range. * @param s pointerobserved NSS fluctuates significantly, a FECFRAME receiver may want totinymt internal state. * @return 32-bit unsigned integeradapt its ls_max_size accordingly. In particular when the NSS is significantly reduced, a FECFRAME receiver may want to reduce the ls_max_size too in order to limit computation complexity. A balance must be found between0using an ls_max_size "too large" (which increases computation complexity andmaxv-1 inclusive. */ uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv) { return (uint32_t)(tinymt32_generate_32double(s) * (double)maxv); } /** * Internal tinymt32 constantsmemory requirements) andfunctions. * Users should not call these functions directly. */ #define TINYMT32_MEXP 127 #define TINYMT32_SH0 1 #define TINYMT32_SH1 10 #define TINYMT32_SH8 8 #define TINYMT32_MASK UINT32_C(0x7fffffff) #define TINYMT32_MUL (1.0f / 16777216.0f) /** * This function changes internal state of tinymt32. * @param s pointer to tinymt internal state. */ static void tinymt32_next_state (tinymt32_t * s) { uint32_t x; uint32_t y; y = s->status[3]; x = (s->status[0] & TINYMT32_MASK) ^ s->status[1] ^ s->status[2]; x ^= (x << TINYMT32_SH0); y ^= (y >> TINYMT32_SH0) ^ x; s->status[0] = s->status[1]; s->status[1] = s->status[2]; s->status[2] = x ^ (y << TINYMT32_SH1); s->status[3] = y; s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; } /** * This function outputs 32-bit unsigned integerthe opposite (which reduces recovery performance). C.3. Case of a Non Real-Time Flow Finally there are configurations where a source ADU flow has no real- time constraints. FECFRAME and the FEC Schemes defined in this document can still be used. The choice of appropriate parameter values can be directed by practical considerations. For instance, it can derive frominternal state. * @param s pointeran estimation of the maximum memory amount that could be dedicated totinymt internal state. * @return 32-bit unsigned pseudos number */ static uint32_t tinymt32_temper (tinymt32_t * s) { uint32_t t0, t1; t0 = s->status[3]; t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); t0 ^= t1; t0 ^= -((int32_t)(t1 & 1)) & s->tmat; return t0; } /** * This function outputs double precision floating point number from * internal state.the linear system at a FECFRAME receiver, or the maximum computation complexity at a FECFRAME receiver, both of them depending on the ls_max_size parameter. Thereturnedsame considerations also apply to the FECFRAME sender, where the maximum memory amount and computation complexity depend on the ew_max_size parameter. Here also, the NSS valuehas 32-bit precision. * In other words, this function makes one double precision floating * point number from one 32-bit unsigned integer. * @param s pointercontained in FEC Repair Packets is used by a FECFRAME receiver totinymt internal state. * @return floating point number r (0.0 <= r < 1.0) */ static double tinymt32_generate_32double (tinymt32_t * s) { tinymt32_next_state(s); return (double)tinymt32_temper(s) * (1.0 / 4294967296.0); } <CODE ENDS> Figure 8: TinyMT32 pseudo-codedetermine the current coding window size and ew_max_size by observing its maximum value over the time. AppendixB.D. Decoding Beyond Maximum Latency Optimization (Informational) This annex introduces non normative considerations. It is provided as suggestions, without any impact on interoperability. For more information see [Roca16]. With a real-time source ADU flow, it is possible to improve the decoding performance of sliding window codes without impacting maximum latency, at the cost of extra memory and CPU overhead. The optimization consists, for a FECFRAME receiver, to extend the linear system beyond the decoding window maximum size, by keeping a certain number of old source symbols whereas their associated ADUs timed-out: ls_max_size > dw_max_size Usually the following choice is a good trade-off between decoding performance and extra CPU overhead: ls_max_size = 2 * dw_max_size When the dw_max_size is very small, it may be preferable to keep a minimum ls_max_size value (e.g., LS_MIN_SIZE_DEFAULT = 40 symbols). Going below this threshold will not save a significant amount of memory nor CPU cycles. Therefore: ls_max_size = max(2 * dw_max_size, LS_MIN_SIZE_DEFAULT) Finally, it is worth noting that agood receiver, i.e., areceiver that benefits from an FEC protection significantly higher than what is required to recover from packet losses, can choose to reduce the ls_max_size. In that case lost ADUs will be recovered without relying on this optimization. ls_max_size /---------------------------------^-------------------------------\ late source symbols (pot. decoded but not delivered) dw_max_size /--------------^-----------------\ /--------------^---------------\ src0 src1 src2 src3 src4 src5 src6 src7 src8 src9 src10 src11 src12 Figure9:14: Relationship between parameters to decode beyond maximum latency. It means that source symbols, and therefore ADUs, may be decoded even if the added latency exceeds the maximum value permitted by the application (the "late source symbols" of Figure9).14). It follows that the corresponding ADUs will not be useful to the application. However, decoding these "late symbols" significantly improves the global robustness in bad reception conditions and is therefore recommended for receivers experiencing bad communication conditions [Roca16]. In any case whether or not to use this optimization and what exact value to use for the ls_max_size parameter are local decisions made by each receiver independently, without any impact on the other receivers nor on the source. Authors' Addresses Vincent Roca INRIA Univ. Grenoble Alpes France EMail: vincent.roca@inria.fr Belkacem Teibi INRIA Univ. Grenoble Alpes France EMail:belkacem.teibi@inria.frbelkacem.teibi@gmail.com Emmanuel Baccelli INRIA France EMail: emmanuel.baccelli@inria.fr