/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var kurentoClient = require('kurento-client');
/**
* Possible DSCP values
* <p>
* WebRTC recommended values are taken from RFC 8837
* https://datatracker.ietf.org/doc/html/rfc8837#section-5 , These are the
* name indicates kind of traffic that it should apply to, the second
* indicates relative priority. For video, a third field would indicate if
* As indicated on RFC 8837 section 5 diagram:
* +=======================+==========+=====+============+============+
* | Flow Type | Very Low | Low | Medium | High
* |
* +=======================+==========+=====+============+============+
* | Audio | LE (1) | DF | EF (46) | EF (46)
* |
* | | | (0) | |
* |
* +-----------------------+----------+-----+------------+------------+
* +-----------------------+----------+-----+------------+------------+
* | Interactive Video | LE (1) | DF | AF42, AF43 | AF41, AF42
* |
* | with or without Audio | | (0) | (36, 38) | (34, 36)
* |
* +-----------------------+----------+-----+------------+------------+
* +-----------------------+----------+-----+------------+------------+
* | Non-Interactive Video | LE (1) | DF | AF32, AF33 | AF31, AF32
* |
* | with or without Audio | | (0) | (28, 30) | (26, 28)
* |
* +-----------------------+----------+-----+------------+------------+
* +-----------------------+----------+-----+------------+------------+
* | Data | LE (1) | DF | AF11 | AF21
* |
* | | | (0) | |
* |
* +-----------------------+----------+-----+------------+------------+
* As indicated also in RFC, non interactive video is not considered
* <p>
* Apart from the WebRTC recommended values, we also include all possible
* values are referenced in
* http://www.iana.org/assignments/dscp-registry/dscp-registry.xml of
* course some of
* those values are synonyms for the WebRTC recommended ones, they are
* included mainly for completeness
* <p>
* And as a last point, we include a shorthand for Chrome supported
* markings for low (CS0), very low (CS1), medium (CS7) and high (CS7)
* priorities in priority property for RTCRtpSender parameters. See
* https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/setParameters
* <p>
* This only covers outgoing network packets from KMS, to complete the
* solution, DSCP must be also requested on client, unfortunately for
* traffic on the other direction, this must be requested to the
* browser or client. On browser, the client application needs to use the
* following API https://www.w3.org/TR/webrtc-priority/
*
* @typedef elements/complexTypes.DSCPValue
*
* @type {(NO_DSCP|NO_VALUE|AUDIO_VERYLOW|AUDIO_LOW|AUDIO_MEDIUM|AUDIO_HIGH|VIDEO_VERYLOW|VIDEO_LOW|VIDEO_MEDIUM|VIDEO_MEDIUM_THROUGHPUT|VIDEO_HIGH|VIDEO_HIGH_THROUGHPUT|DATA_VERYLOW|DATA_LOW|DATA_MEDIUM|DATA_HIGH|CHROME_HIGH|CHROME_MEDIUM|CHROME_LOW|CHROME_VERYLOW|CS0|CS1|CS2|CS3|CS4|CS5|CS6|CS7|AF11|AF12|AF13|AF21|AF22|AF23|AF31|AF32|AF33|AF41|AF42|AF43|EF|VOICEADMIT|LE)}
*/
/**
* Checker for {@link module:elements/complexTypes.DSCPValue}
*
* @memberof module:elements/complexTypes
*
* @param {external:String} key
* @param {module:elements/complexTypes.DSCPValue} value
*/
function checkDSCPValue(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('NO_DSCP|NO_VALUE|AUDIO_VERYLOW|AUDIO_LOW|AUDIO_MEDIUM|AUDIO_HIGH|VIDEO_VERYLOW|VIDEO_LOW|VIDEO_MEDIUM|VIDEO_MEDIUM_THROUGHPUT|VIDEO_HIGH|VIDEO_HIGH_THROUGHPUT|DATA_VERYLOW|DATA_LOW|DATA_MEDIUM|DATA_HIGH|CHROME_HIGH|CHROME_MEDIUM|CHROME_LOW|CHROME_VERYLOW|CS0|CS1|CS2|CS3|CS4|CS5|CS6|CS7|AF11|AF12|AF13|AF21|AF22|AF23|AF31|AF32|AF33|AF41|AF42|AF43|EF|VOICEADMIT|LE'))
throw SyntaxError(key+' param is not one of [NO_DSCP|NO_VALUE|AUDIO_VERYLOW|AUDIO_LOW|AUDIO_MEDIUM|AUDIO_HIGH|VIDEO_VERYLOW|VIDEO_LOW|VIDEO_MEDIUM|VIDEO_MEDIUM_THROUGHPUT|VIDEO_HIGH|VIDEO_HIGH_THROUGHPUT|DATA_VERYLOW|DATA_LOW|DATA_MEDIUM|DATA_HIGH|CHROME_HIGH|CHROME_MEDIUM|CHROME_LOW|CHROME_VERYLOW|CS0|CS1|CS2|CS3|CS4|CS5|CS6|CS7|AF11|AF12|AF13|AF21|AF22|AF23|AF31|AF32|AF33|AF41|AF42|AF43|EF|VOICEADMIT|LE] ('+value+')');
};
module.exports = checkDSCPValue;