1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://www.w3.org/2012/sysapps/tcp-udp-sockets/#interface-udpsocket
8 * http://www.w3.org/2012/sysapps/tcp-udp-sockets/#dictionary-udpoptions
9 */
10
11dictionary UDPOptions {
12    DOMString      localAddress;
13    unsigned short localPort;
14    DOMString      remoteAddress;
15    unsigned short remotePort;
16    boolean        addressReuse = true;
17    boolean        loopback = false;
18};
19
20[Constructor (optional UDPOptions options),
21 Pref="dom.udpsocket.enabled",
22 ChromeOnly]
23interface UDPSocket : EventTarget {
24    readonly    attribute DOMString?       localAddress;
25    readonly    attribute unsigned short?  localPort;
26    readonly    attribute DOMString?       remoteAddress;
27    readonly    attribute unsigned short?  remotePort;
28    readonly    attribute boolean          addressReuse;
29    readonly    attribute boolean          loopback;
30    readonly    attribute SocketReadyState readyState;
31    readonly    attribute Promise<void>    opened;
32    readonly    attribute Promise<void>    closed;
33//    readonly    attribute ReadableStream   input; //Bug 1056444: Stream API is not ready
34//    readonly    attribute WriteableStream  output; //Bug 1056444: Stream API is not ready
35                attribute EventHandler     onmessage; //Bug 1056444: use event interface before Stream API is ready
36    Promise<void> close ();
37    [Throws] void    joinMulticastGroup (DOMString multicastGroupAddress);
38    [Throws] void    leaveMulticastGroup (DOMString multicastGroupAddress);
39    [Throws] boolean send ((DOMString or Blob or ArrayBuffer or ArrayBufferView) data, optional DOMString? remoteAddress, optional unsigned short? remotePort); //Bug 1056444: use send method before Stream API is ready
40};
41