michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsINetAddr.idl" michael@0: michael@0: interface nsIUDPSocketInternal; michael@0: michael@0: %{ C++ michael@0: namespace mozilla { michael@0: namespace net { michael@0: union NetAddr; michael@0: } michael@0: } michael@0: %} michael@0: native NetAddr(mozilla::net::NetAddr); michael@0: [ptr] native NetAddrPtr(mozilla::net::NetAddr); michael@0: michael@0: [scriptable, uuid(B47E5A0F-D384-48EF-8885-4259793D9CF0)] michael@0: interface nsIUDPSocketChild : nsISupports michael@0: { michael@0: readonly attribute unsigned short localPort; michael@0: readonly attribute AUTF8String localAddress; michael@0: attribute AUTF8String filterName; michael@0: michael@0: // Tell the chrome process to bind the UDP socket to a given local host and port michael@0: void bind(in nsIUDPSocketInternal socket, in AUTF8String host, in unsigned short port); michael@0: michael@0: // Tell the chrome process to perform equivalent operations to all following methods michael@0: void send(in AUTF8String host, in unsigned short port, michael@0: [const, array, size_is(byteLength)] in uint8_t bytes, michael@0: in unsigned long byteLength); michael@0: // Send without DNS query michael@0: void sendWithAddr(in nsINetAddr addr, michael@0: [const, array, size_is(byteLength)] in uint8_t bytes, michael@0: in unsigned long byteLength); michael@0: [noscript] void sendWithAddress([const] in NetAddrPtr addr, michael@0: [const, array, size_is(byteLength)] in uint8_t bytes, michael@0: in unsigned long byteLength); michael@0: void close(); michael@0: }; michael@0: michael@0: /* michael@0: * Internal interface for callback from chrome process michael@0: */ michael@0: [scriptable, uuid(1E27E9B3-C1C8-4B05-A415-1A2C1A641C60)] michael@0: interface nsIUDPSocketInternal : nsISupports michael@0: { michael@0: void callListenerError(in AUTF8String type, in AUTF8String message, in AUTF8String filename, michael@0: in uint32_t lineNumber, in uint32_t columnNumber); michael@0: void callListenerReceivedData(in AUTF8String type, in AUTF8String host, in unsigned short port, michael@0: [array, size_is(dataLength)] in uint8_t data, michael@0: in unsigned long dataLength); michael@0: void callListenerVoid(in AUTF8String type); michael@0: void callListenerSent(in AUTF8String type, in nsresult status); michael@0: void updateReadyState(in AUTF8String readyState); michael@0: };