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 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The | 10 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // requests directly with error code ERR_INSUFFICIENT_RESOURCES and discards | 47 // requests directly with error code ERR_INSUFFICIENT_RESOURCES and discards |
48 // those datagrams. If the client wants to avoid such failures, it needs to | 48 // those datagrams. If the client wants to avoid such failures, it needs to |
49 // keep track of how many SendTo() calls are pending and make sure the number | 49 // keep track of how many SendTo() calls are pending and make sure the number |
50 // doesn't exceed the result of this method. | 50 // doesn't exceed the result of this method. |
51 NegotiateMaxPendingSendRequests(uint32 requested_size) | 51 NegotiateMaxPendingSendRequests(uint32 requested_size) |
52 => (uint32 actual_size); | 52 => (uint32 actual_size); |
53 | 53 |
54 // Notifies that the client is ready to accept |number| of datagrams. | 54 // Notifies that the client is ready to accept |number| of datagrams. |
55 // Correspondingly, OnReceived() of the UDPSocketClient interface will be | 55 // Correspondingly, OnReceived() of the UDPSocketClient interface will be |
56 // called |number| times (errors also count), unless the connection is closed | 56 // called |number| times (errors also count), unless the connection is closed |
57 // before that. The socket must be bound. | 57 // before that. |
58 // | 58 // |
59 // It is allowed to call this method again before the previous request is | 59 // It is allowed to call this method again before the previous request is |
60 // completely satisfied. For example: | 60 // completely satisfied. For example: |
61 // service->ReceiveMore(3); | 61 // service->ReceiveMore(3); |
62 // ... | 62 // ... |
63 // // OnReceived() is called. | 63 // // OnReceived() is called. |
64 // // OnReceived() is called. | 64 // // OnReceived() is called. |
65 // ... | 65 // ... |
66 // service->ReceiveMore(3); | 66 // service->ReceiveMore(3); |
67 // // The client expects 4 more calls to OnReceived(). | 67 // // The client expects 4 more calls to OnReceived(). |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 107 |
108 } | 108 } |
OLD | NEW |