OLD | NEW |
---|---|
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /** | 6 /** |
7 * This file defines the <code>PPB_UDPSocket_Private</code> interface. | 7 * This file defines the <code>PPB_UDPSocket_Private</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 label Chrome { | 10 label Chrome { |
11 M17 = 0.2 | 11 M17 = 0.2, |
12 M19 = 0.3 | |
12 }; | 13 }; |
13 | 14 |
14 interface PPB_UDPSocket_Private { | 15 interface PPB_UDPSocket_Private { |
15 /** | 16 /** |
16 * Creates a UDP socket resource. | 17 * Creates a UDP socket resource. |
17 */ | 18 */ |
18 PP_Resource Create([in] PP_Instance instance_id); | 19 PP_Resource Create([in] PP_Instance instance_id); |
19 | 20 |
20 /** | 21 /** |
21 * Determines if a given resource is a UDP socket. | 22 * Determines if a given resource is a UDP socket. |
22 */ | 23 */ |
23 PP_Bool IsUDPSocket([in] PP_Resource resource_id); | 24 PP_Bool IsUDPSocket([in] PP_Resource resource_id); |
24 | 25 |
25 /* Creates a socket and binds to the address given by |addr|. */ | 26 /* Creates a socket and binds to the address given by |addr|. */ |
26 int32_t Bind([in] PP_Resource udp_socket, | 27 int32_t Bind([in] PP_Resource udp_socket, |
27 [in] PP_NetAddress_Private addr, | 28 [in] PP_NetAddress_Private addr, |
28 [in] PP_CompletionCallback callback); | 29 [in] PP_CompletionCallback callback); |
29 | 30 |
31 /* Returns the address that the socket has bound to. If there has | |
viettrungluu
2012/02/07 23:03:58
This comment doesn't actually make sense (especial
mtilburg1
2012/02/08 15:27:01
Done.
| |
32 * not been a successful call to Bind, or the socket has been closed, | |
33 * an error is returned. | |
34 */ | |
35 [version=0.3] | |
36 PP_Bool GetBoundAddress([in] PP_Resource udp_socket, | |
37 [out] PP_NetAddress_Private addr); | |
38 | |
30 /* Performs a non-blocking recvfrom call on socket. | 39 /* Performs a non-blocking recvfrom call on socket. |
31 * Bind must be called first. |callback| is invoked when recvfrom | 40 * Bind must be called first. |callback| is invoked when recvfrom |
32 * reads data. You must call GetRecvFromAddress to recover the | 41 * reads data. You must call GetRecvFromAddress to recover the |
33 * address the data was retrieved from. | 42 * address the data was retrieved from. |
34 */ | 43 */ |
35 int32_t RecvFrom([in] PP_Resource udp_socket, | 44 int32_t RecvFrom([in] PP_Resource udp_socket, |
36 [out] str_t buffer, | 45 [out] str_t buffer, |
37 [in] int32_t num_bytes, | 46 [in] int32_t num_bytes, |
38 [in] PP_CompletionCallback callback); | 47 [in] PP_CompletionCallback callback); |
39 | 48 |
40 /* Upon successful completion of RecvFrom, the address that the data | 49 /* Upon successful completion of RecvFrom, the address that the data |
41 * was received from is stored in |addr|. | 50 * was received from is stored in |addr|. |
42 */ | 51 */ |
43 PP_Bool GetRecvFromAddress([in] PP_Resource udp_socket, | 52 PP_Bool GetRecvFromAddress([in] PP_Resource udp_socket, |
44 [out] PP_NetAddress_Private addr); | 53 [out] PP_NetAddress_Private addr); |
45 | 54 |
46 /* Performs a non-blocking sendto call on the socket created and | 55 /* Performs a non-blocking sendto call on the socket created and |
47 * bound(has already called Bind). The callback |callback| is | 56 * bound(has already called Bind). The callback |callback| is |
48 * invoked when sendto completes. | 57 * invoked when sendto completes. |
49 */ | 58 */ |
50 int32_t SendTo([in] PP_Resource udp_socket, | 59 int32_t SendTo([in] PP_Resource udp_socket, |
51 [in] str_t buffer, | 60 [in] str_t buffer, |
52 [in] int32_t num_bytes, | 61 [in] int32_t num_bytes, |
53 [in] PP_NetAddress_Private addr, | 62 [in] PP_NetAddress_Private addr, |
54 [in] PP_CompletionCallback callback); | 63 [in] PP_CompletionCallback callback); |
55 | 64 |
56 /* Cancels all pending reads and writes, and closes the socket. */ | 65 /* Cancels all pending reads and writes, and closes the socket. */ |
57 void Close([in] PP_Resource udp_socket); | 66 void Close([in] PP_Resource udp_socket); |
58 }; | 67 }; |
OLD | NEW |