|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 #include "nsINetAddr.idl" |
|
7 |
|
8 interface nsIUDPSocketInternal; |
|
9 |
|
10 %{ C++ |
|
11 namespace mozilla { |
|
12 namespace net { |
|
13 union NetAddr; |
|
14 } |
|
15 } |
|
16 %} |
|
17 native NetAddr(mozilla::net::NetAddr); |
|
18 [ptr] native NetAddrPtr(mozilla::net::NetAddr); |
|
19 |
|
20 [scriptable, uuid(B47E5A0F-D384-48EF-8885-4259793D9CF0)] |
|
21 interface nsIUDPSocketChild : nsISupports |
|
22 { |
|
23 readonly attribute unsigned short localPort; |
|
24 readonly attribute AUTF8String localAddress; |
|
25 attribute AUTF8String filterName; |
|
26 |
|
27 // Tell the chrome process to bind the UDP socket to a given local host and port |
|
28 void bind(in nsIUDPSocketInternal socket, in AUTF8String host, in unsigned short port); |
|
29 |
|
30 // Tell the chrome process to perform equivalent operations to all following methods |
|
31 void send(in AUTF8String host, in unsigned short port, |
|
32 [const, array, size_is(byteLength)] in uint8_t bytes, |
|
33 in unsigned long byteLength); |
|
34 // Send without DNS query |
|
35 void sendWithAddr(in nsINetAddr addr, |
|
36 [const, array, size_is(byteLength)] in uint8_t bytes, |
|
37 in unsigned long byteLength); |
|
38 [noscript] void sendWithAddress([const] in NetAddrPtr addr, |
|
39 [const, array, size_is(byteLength)] in uint8_t bytes, |
|
40 in unsigned long byteLength); |
|
41 void close(); |
|
42 }; |
|
43 |
|
44 /* |
|
45 * Internal interface for callback from chrome process |
|
46 */ |
|
47 [scriptable, uuid(1E27E9B3-C1C8-4B05-A415-1A2C1A641C60)] |
|
48 interface nsIUDPSocketInternal : nsISupports |
|
49 { |
|
50 void callListenerError(in AUTF8String type, in AUTF8String message, in AUTF8String filename, |
|
51 in uint32_t lineNumber, in uint32_t columnNumber); |
|
52 void callListenerReceivedData(in AUTF8String type, in AUTF8String host, in unsigned short port, |
|
53 [array, size_is(dataLength)] in uint8_t data, |
|
54 in unsigned long dataLength); |
|
55 void callListenerVoid(in AUTF8String type); |
|
56 void callListenerSent(in AUTF8String type, in nsresult status); |
|
57 void updateReadyState(in AUTF8String readyState); |
|
58 }; |