OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import "mojo/services/public/interfaces/network/net_address.mojom" | 5 import "mojo/services/public/interfaces/network/net_address.mojom" |
6 import "mojo/services/public/interfaces/network/network_error.mojom" | 6 import "mojo/services/public/interfaces/network/network_error.mojom" |
7 | 7 |
8 module mojo { | 8 module mojo { |
9 | 9 |
10 [Client=UDPSocketClient] | 10 [Client=UDPSocketClient] |
11 interface UDPSocket { | 11 interface UDPSocket { |
12 // Sets the send buffer size (in bytes) for the socket. | 12 // Sets the send buffer size (in bytes) for the socket. The socket must be |
13 // bound. | |
13 // | 14 // |
14 // Note: This is only treated as a hint. Even if it succeeds, the service | 15 // Note: This is only treated as a hint. Even if it succeeds, the service |
15 // doesn't guarantee it will conform to the size. | 16 // doesn't guarantee it will conform to the size. |
16 SetSendBufferSize(uint32 size) => (NetworkError result); | 17 SetSendBufferSize(uint32 size) => (NetworkError result); |
17 | 18 |
18 // Sets the receive buffer size (in bytes) for the socket. | 19 // Sets the receive buffer size (in bytes) for the socket. The socket must be |
20 // bound. | |
19 // | 21 // |
20 // Note: This is only treated as a hint. Even if it succeeds, the service | 22 // Note: This is only treated as a hint. Even if it succeeds, the service |
21 // doesn't guarantee it will conform to the size. | 23 // doesn't guarantee it will conform to the size. |
22 SetReceiveBufferSize(uint32 size) => (NetworkError result); | 24 SetReceiveBufferSize(uint32 size) => (NetworkError result); |
23 | 25 |
24 // Allows the socket to share the local address to which it will be bound with | 26 // Allows the socket to share the local address to which it will be bound with |
25 // other processes. Should be called before Bind(). | 27 // other processes. Should be called before Bind(). |
26 AllowAddressReuse() => (NetworkError result); | 28 AllowAddressReuse() => (NetworkError result); |
27 | 29 |
28 // Binds the socket to the given address. | 30 // Binds the socket to the given address. |
(...skipping 14 matching lines...) Expand all Loading... | |
43 // ... | 45 // ... |
44 // service->ReceiveMorePackets(3); | 46 // service->ReceiveMorePackets(3); |
45 // // The client expects 4 more calls to OnReceived(). | 47 // // The client expects 4 more calls to OnReceived(). |
46 ReceiveMorePackets(uint32 number); | 48 ReceiveMorePackets(uint32 number); |
47 | 49 |
48 // Sends data to the specified destination. The socket must be bound. | 50 // Sends data to the specified destination. The socket must be bound. |
49 // The method doesn't report the result of the operation. | 51 // The method doesn't report the result of the operation. |
50 SendToAndForget(NetAddress addr, uint8[] data); | 52 SendToAndForget(NetAddress addr, uint8[] data); |
51 | 53 |
52 // Sends data to the specified destination. The socket must be bound. | 54 // Sends data to the specified destination. The socket must be bound. |
53 SendTo(NetAddress addr, uint8[] data) => (NetworkError result); | 55 SendTo(NetAddress addr, uint8[] data) => (NetworkError result); |
Matt Perry
2014/09/29 23:39:08
Have you considered using a DataPipe for the data
| |
54 }; | 56 }; |
55 | 57 |
56 interface UDPSocketClient { | 58 interface UDPSocketClient { |
57 // |addr| and |data| are non-NULL on success. | 59 // |addr| and |data| are non-NULL on success. |
58 OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); | 60 OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); |
59 }; | 61 }; |
60 | 62 |
61 } | 63 } |
OLD | NEW |