Source: node_modules/kurento-client-elements/lib/complexTypes/SDES.js

/* Autogenerated with Kurento Idl */

/*
 * (C) Copyright 2013-2015 Kurento (http://kurento.org/)
 *
 * 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 inherits = require('inherits');

var kurentoClient = require('kurento-client');

var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;

var ComplexType = require('kurento-client-core').complexTypes.ComplexType;


/**
 * Security Descriptions for Media Streams
 *
 * @constructor module:elements/complexTypes.SDES
 *
 * @property {external:String} key
 *   A string representing the cryptographic key used. The length varies 
 *   depending on the cryptographic method used (30 bytes length for AES_128_CM,
 * @property {module:elements/complexTypes.CryptoSuite} crypto
 *  Selects the cryptographic suite to be used. For available values, please see
 */
function SDES(sDESDict){
  if(!(this instanceof SDES))
    return new SDES(sDESDict)

  sDESDict = sDESDict || {}

  // Check sDESDict has the required fields
  checkType('String', 'sDESDict.key', sDESDict.key);
  checkType('CryptoSuite', 'sDESDict.crypto', sDESDict.crypto);

  // Init parent class
  SDES.super_.call(this, sDESDict)

  // Set object properties
  Object.defineProperties(this, {
    key: {
      writable: true,
      enumerable: true,
      value: sDESDict.key
    },
    crypto: {
      writable: true,
      enumerable: true,
      value: sDESDict.crypto
    }
  })
}
inherits(SDES, ComplexType)

// Private identifiers to allow re-construction of the complexType on the server
// They need to be enumerable so JSON.stringify() can access to them
Object.defineProperties(SDES.prototype, {
  __module__: {
    enumerable: true,
    value: "kurento"
  },
  __type__: {
    enumerable: true,
    value: "SDES"
  }
})

/**
 * Checker for {@link module:elements/complexTypes.SDES}
 *
 * @memberof module:elements/complexTypes
 *
 * @param {external:String} key
 * @param {module:elements/complexTypes.SDES} value
 */
function checkSDES(key, value)
{
  if(!(value instanceof SDES))
    throw ChecktypeError(key, SDES, value);
};


module.exports = SDES;

SDES.check = checkSDES;