OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef PPAPI_C_PPB_TRANSPORT_DEV_H_ | 5 #ifndef PPAPI_C_PPB_TRANSPORT_DEV_H_ |
6 #define PPAPI_C_PPB_TRANSPORT_DEV_H_ | 6 #define PPAPI_C_PPB_TRANSPORT_DEV_H_ |
7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
10 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
12 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
13 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
14 | 15 |
15 #define PPB_TRANSPORT_DEV_INTERFACE "PPB_Transport;0.1" | 16 #define PPB_TRANSPORT_DEV_INTERFACE "PPB_Transport;0.2" |
16 | 17 |
17 struct PPB_Transport_Dev { | 18 struct PPB_Transport_Dev { |
18 // Creates a new transport object with the specified name | 19 // Creates a new transport object with the specified name |
19 // using the specified protocol. | 20 // using the specified protocol. |
20 PP_Resource (*CreateTransport)(PP_Module module, | 21 PP_Resource (*CreateTransport)(PP_Module module, |
21 const char* name, | 22 const char* name, |
22 const char* proto); | 23 const char* proto); |
23 | 24 |
24 // Returns whether or not resource is a Transport | 25 // Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. |
25 bool (*IsTransport)(PP_Resource resource); | 26 PP_Bool (*IsTransport)(PP_Resource resource); |
26 | 27 |
27 // Returns whether the transport is currently writable | 28 // Returns PP_TRUE if the transport is currently writable |
28 // (i.e. can send data to the remote peer) | 29 // (i.e. can send data to the remote peer), PP_FALSE otherwise. |
29 bool (*IsWritable)(PP_Resource transport); | 30 PP_Bool (*IsWritable)(PP_Resource transport); |
30 // TODO(juberti): other getters/setters | 31 // TODO(juberti): other getters/setters |
31 // connect state | 32 // connect state |
32 // connect type, protocol | 33 // connect type, protocol |
33 // RTT | 34 // RTT |
34 | 35 |
35 // Establishes a connection to the remote peer. | 36 // Establishes a connection to the remote peer. |
36 // Returns PP_ERROR_WOULDBLOCK and notifies on |cb| | 37 // Returns PP_ERROR_WOULDBLOCK and notifies on |cb| |
37 // when connectivity is established (or timeout occurs). | 38 // when connectivity is established (or timeout occurs). |
38 int32_t (*Connect)(PP_Resource transport, | 39 int32_t (*Connect)(PP_Resource transport, |
39 PP_CompletionCallback cb); | 40 struct PP_CompletionCallback cb); |
40 | 41 |
41 // Obtains another ICE candidate address to be provided | 42 // Obtains another ICE candidate address to be provided |
42 // to the remote peer. Returns PP_ERROR_WOULDBLOCK | 43 // to the remote peer. Returns PP_ERROR_WOULDBLOCK |
43 // if there are no more addresses to be sent. | 44 // if there are no more addresses to be sent. |
44 int32_t (*GetNextAddress)(PP_Resource transport, | 45 int32_t (*GetNextAddress)(PP_Resource transport, |
45 PP_Var* address, | 46 struct PP_Var* address, |
46 PP_CompletionCallback cb); | 47 struct PP_CompletionCallback cb); |
47 // Provides an ICE candidate address that was received | 48 // Provides an ICE candidate address that was received |
48 // from the remote peer. | 49 // from the remote peer. |
49 int32_t (*ReceiveRemoteAddress)(PP_Resource transport, | 50 int32_t (*ReceiveRemoteAddress)(PP_Resource transport, |
50 PP_Var address); | 51 struct PP_Var address); |
51 | 52 |
52 // Like recv(), receives data. Returns PP_ERROR_WOULDBLOCK | 53 // Like recv(), receives data. Returns PP_ERROR_WOULDBLOCK |
53 // if there is currently no data to receive. | 54 // if there is currently no data to receive. |
54 int32_t (*Recv)(PP_Resource transport, | 55 int32_t (*Recv)(PP_Resource transport, |
55 void* data, | 56 void* data, |
56 uint32_t len, | 57 uint32_t len, |
57 PP_CompletionCallback cb); | 58 struct PP_CompletionCallback cb); |
58 // Like send(), sends data. Returns PP_ERROR_WOULDBLOCK | 59 // Like send(), sends data. Returns PP_ERROR_WOULDBLOCK |
59 // if the socket is currently flow-controlled. | 60 // if the socket is currently flow-controlled. |
60 int32_t (*Send)(PP_Resource transport, | 61 int32_t (*Send)(PP_Resource transport, |
61 const void* data, | 62 const void* data, |
62 uint32_t len, | 63 uint32_t len, |
63 PP_CompletionCallback cb); | 64 struct PP_CompletionCallback cb); |
64 | 65 |
65 // Disconnects from the remote peer. | 66 // Disconnects from the remote peer. |
66 int32_t (*Close)(PP_Resource transport); | 67 int32_t (*Close)(PP_Resource transport); |
67 }; | 68 }; |
68 | 69 |
69 #endif // PPAPI_C_PPB_TRANSPORT_DEV_H_ | 70 #endif // PPAPI_C_PPB_TRANSPORT_DEV_H_ |
70 | |
OLD | NEW |