// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// The <code>chrome.webrtc.castUdpTransport</code> API represents a UDP
// transport for Cast RTP streams. This API is not useful when standalone
// since it does not have send and receive methods.
// It is used to configure the UDP transport used in Cast session.
//
// Valid transport IDs are positive and non-zero.
namespace cast.streaming.udpTransport {
  // The UDP socket address and port.
  dictionary IPEndPoint {
    DOMString address;
    long port;
  };

  interface Functions {
    // Destroys a UDP transport.
    // |transportId| : The transport ID.
    [nocompile] static void destroy(long transportId);

    // Sets parameters for this UDP transport. This can only be called
    // once per transport.
    // |transportId| : The transport ID.
    // |destination| : The address and port to send packets to.
    [nocompile] static void setDestination(long transportId,
                                           IPEndPoint destination);

    // Sets the options.
    // Attributes of this object will be used to activate optional
    // behaviours in the transport. Normally this is only used for
    // experimentation. Must be called before setDestination.
    // |transportId| : The transport ID that is created by
    // chrome.cast.streaming.session.create().
    // |options| : A dictionary of key-value pairs of options.
    // See media/cast/net/cast_transport_sender_impl.h for supported
    // options.
    [nocompile] static void setOptions(long transportId,
                                       object options);
  };
};
