Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 import "mojo/services/public/interfaces/network/net_address.mojom" | |
| 6 import "mojo/services/public/interfaces/network/network_error.mojom" | |
| 7 | |
| 8 module mojo { | |
| 9 | |
| 10 [Client=UDPSocketClient] | |
| 11 interface UDPSocket { | |
| 12 // 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!
| |
| 13 // | |
| 14 // 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 SetSendBufferSize(uint32 size) => (NetworkError result); | |
| 17 | |
| 18 // Sets the receive buffer size (in bytes) for the socket. | |
| 19 // | |
| 20 // Note: This is only treated as a hint. Even if it succeeds, the service | |
| 21 // doesn't guarantee it will conform to the size. | |
| 22 SetReceiveBufferSize(uint32 size) => (NetworkError result); | |
| 23 | |
| 24 // Allows the socket to share the local address to which it will be bound with | |
| 25 // 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.
| |
| 26 AllowAddressReuse() => (NetworkError result); | |
| 27 | |
| 28 // Binds the socket to the given address. | |
| 29 // |bound_addr| is non-NULL on success. | |
| 30 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
| |
| 31 | |
| 32 // Notifies that the client is ready to accept |number| of packets. | |
| 33 // Correspondingly, OnReceived() of the UDPSocketClient interface will be | |
| 34 // called |number| times (errors also count), unless the connection is closed | |
| 35 // before that. The socket must be bound. | |
| 36 // | |
| 37 // It is allowed to call this method again before the previous request is | |
| 38 // completely satisfied. For example: | |
| 39 // service->ReceiveMorePackets(3); | |
| 40 // ... | |
| 41 // // OnReceived() is called. | |
| 42 // // OnReceived() is called. | |
| 43 // ... | |
| 44 // service->ReceiveMorePackets(3); | |
| 45 // // The client expects 4 more calls to OnReceived(). | |
| 46 ReceiveMorePackets(uint32 number); | |
| 47 | |
| 48 // Sends data to the specified destination. The socket must be bound. | |
| 49 // The method doesn't report the result of the operation. | |
| 50 SendToAndForget(NetAddress addr, uint8[] data); | |
| 51 | |
| 52 // Sends data to the specified destination. The socket must be bound. | |
| 53 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.
| |
| 54 }; | |
| 55 | |
| 56 interface UDPSocketClient { | |
| 57 // |addr| and |data| are non-NULL on success. | |
| 58 OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); | |
| 59 }; | |
| 60 | |
| 61 } | |
| OLD | NEW |