Chromium Code Reviews| Index: mojo/services/public/interfaces/network/udp_socket.mojom |
| diff --git a/mojo/services/public/interfaces/network/udp_socket.mojom b/mojo/services/public/interfaces/network/udp_socket.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1cac8b079f96a8c01af793fdaa9ee0bc902211b |
| --- /dev/null |
| +++ b/mojo/services/public/interfaces/network/udp_socket.mojom |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2014 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. |
| + |
| +import "mojo/services/public/interfaces/network/net_address.mojom" |
| +import "mojo/services/public/interfaces/network/network_error.mojom" |
| + |
| +module mojo { |
| + |
| +[Client=UDPSocketClient] |
| +interface UDPSocket { |
| + // Sets the send buffer size (in bytes) for the socket. |
|
brettw
2014/09/29 17:41:22
Does this need to be called before bind or can it
yzshen1
2014/09/29 19:32:36
Right. Thanks!
|
| + // |
| + // Note: This is only treated as a hint. Even if it succeeds, the service |
| + // doesn't guarantee it will conform to the size. |
| + SetSendBufferSize(uint32 size) => (NetworkError result); |
| + |
| + // Sets the receive buffer size (in bytes) for the socket. |
| + // |
| + // Note: This is only treated as a hint. Even if it succeeds, the service |
| + // doesn't guarantee it will conform to the size. |
| + SetReceiveBufferSize(uint32 size) => (NetworkError result); |
| + |
| + // Allows the socket to share the local address to which it will be bound with |
| + // other processes. Should be called before Bind(). |
|
brettw
2014/09/29 17:41:22
I don't really understand what this means or what
yzshen1
2014/09/29 19:32:35
Pepper UDP socket users don't seem to have problem
brettw
2014/09/29 19:55:33
I think mentioning that this is equivalent to SO_R
yzshen1
2014/09/29 21:08:42
Done.
|
| + AllowAddressReuse() => (NetworkError result); |
| + |
| + // Binds the socket to the given address. |
| + // |bound_addr| is non-NULL on success. |
| + Bind(NetAddress addr) => (NetworkError result, NetAddress? bound_addr); |
|
brettw
2014/09/29 17:41:22
It's not quite clear to me how I use this class. I
yzshen1
2014/09/29 19:32:36
Done. Please let me know whether it looks okay. Th
|
| + |
| + // Notifies that the client is ready to accept |number| of packets. |
| + // Correspondingly, OnReceived() of the UDPSocketClient interface will be |
| + // called |number| times (errors also count), unless the connection is closed |
| + // before that. The socket must be bound. |
| + // |
| + // It is allowed to call this method again before the previous request is |
| + // completely satisfied. For example: |
| + // service->ReceiveMorePackets(3); |
| + // ... |
| + // // OnReceived() is called. |
| + // // OnReceived() is called. |
| + // ... |
| + // service->ReceiveMorePackets(3); |
| + // // The client expects 4 more calls to OnReceived(). |
| + ReceiveMorePackets(uint32 number); |
| + |
| + // Sends data to the specified destination. The socket must be bound. |
| + // The method doesn't report the result of the operation. |
| + SendToAndForget(NetAddress addr, uint8[] data); |
| + |
| + // Sends data to the specified destination. The socket must be bound. |
| + SendTo(NetAddress addr, uint8[] data) => (NetworkError result); |
|
yzshen1
2014/09/23 06:50:45
NetworkError here seems to be consistent with othe
brettw
2014/09/29 17:41:22
I like the network error.
|
| +}; |
| + |
| +interface UDPSocketClient { |
| + // |addr| and |data| are non-NULL on success. |
| + OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); |
| +}; |
| + |
| +} |