| 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 module mojo; |
| 6 |
| 5 import "mojo/services/public/interfaces/network/net_address.mojom"; | 7 import "mojo/services/public/interfaces/network/net_address.mojom"; |
| 6 import "mojo/services/public/interfaces/network/network_error.mojom"; | 8 import "mojo/services/public/interfaces/network/network_error.mojom"; |
| 7 | 9 |
| 8 module mojo { | |
| 9 | |
| 10 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The | 10 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The |
| 11 // typical flow of using the interfaces is: | 11 // typical flow of using the interfaces is: |
| 12 // - Acquire a UDPSocket interface pointer and set a UDPSocketClient instance. | 12 // - Acquire a UDPSocket interface pointer and set a UDPSocketClient instance. |
| 13 // - (optional) Set options which are allowed prior to Bind(). | 13 // - (optional) Set options which are allowed prior to Bind(). |
| 14 // - Bind the socket. | 14 // - Bind the socket. |
| 15 // - (optional) Set options which are allowed after Bind(). | 15 // - (optional) Set options which are allowed after Bind(). |
| 16 // - Send / request to receive datagrams. Received datagrams will be delivered | 16 // - Send / request to receive datagrams. Received datagrams will be delivered |
| 17 // to UDPSocketClient.OnReceived(). | 17 // to UDPSocketClient.OnReceived(). |
| 18 | 18 |
| 19 [Client=UDPSocketClient] | 19 [Client=UDPSocketClient] |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // TODO(yzshen): Formalize Mojo networking error codes. | 97 // TODO(yzshen): Formalize Mojo networking error codes. |
| 98 SendTo(NetAddress dest_addr, array<uint8> data) => (NetworkError result); | 98 SendTo(NetAddress dest_addr, array<uint8> data) => (NetworkError result); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 interface UDPSocketClient { | 101 interface UDPSocketClient { |
| 102 // On success, |src_addr| and |data| are non-NULL, and |result.code| is a | 102 // On success, |src_addr| and |data| are non-NULL, and |result.code| is a |
| 103 // non-negative number indicating how many bytes have been received. On | 103 // non-negative number indicating how many bytes have been received. On |
| 104 // failure, |result.code| is a network error code. | 104 // failure, |result.code| is a network error code. |
| 105 OnReceived(NetworkError result, NetAddress? src_addr, array<uint8>? data); | 105 OnReceived(NetworkError result, NetAddress? src_addr, array<uint8>? data); |
| 106 }; | 106 }; |
| 107 | |
| 108 } | |
| OLD | NEW |