| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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_bool.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
| 11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
| 14 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
| 15 | 15 |
| 16 #define PPB_TRANSPORT_DEV_INTERFACE_0_5 "PPB_Transport;0.5" | 16 #define PPB_TRANSPORT_DEV_INTERFACE_0_6 "PPB_Transport;0.6" |
| 17 #define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_5 | 17 #define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_6 |
| 18 |
| 19 typedef enum { |
| 20 // STUN server address and port, e.g "stun.example.com:19302". |
| 21 PP_TRANSPORTPROPERTY_STUN_SERVER = 0, |
| 22 |
| 23 // Relay server name, e.g. "relay.example.com". |
| 24 PP_TRANSPORTPROPERTY_RELAY_SERVER = 1, |
| 25 |
| 26 // Single string that specifies token for use with relay server. |
| 27 PP_TRANSPORTPROPERTY_RELAY_TOKEN = 2, |
| 28 |
| 29 // TCP receive window in bytes. Takes effect only for PseudoTCP |
| 30 // connections. |
| 31 PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW = 3, |
| 32 |
| 33 // TCP send window in bytes. Takes effect only for PseudoTCP |
| 34 // connections. |
| 35 PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW = 4 |
| 36 } PP_TransportProperty; |
| 37 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportProperty, 4); |
| 18 | 38 |
| 19 struct PPB_Transport_Dev { | 39 struct PPB_Transport_Dev { |
| 20 // Creates a new transport object with the specified name using the | 40 // Creates a new transport object with the specified name using the |
| 21 // specified protocol. | 41 // specified protocol. |
| 22 PP_Resource (*CreateTransport)(PP_Instance instance, | 42 PP_Resource (*CreateTransport)(PP_Instance instance, |
| 23 const char* name, | 43 const char* name, |
| 24 const char* proto); | 44 const char* proto); |
| 25 | 45 |
| 26 // Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. | 46 // Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. |
| 27 PP_Bool (*IsTransport)(PP_Resource resource); | 47 PP_Bool (*IsTransport)(PP_Resource resource); |
| 28 | 48 |
| 29 // Returns PP_TRUE if the transport is currently writable (i.e. can | 49 // Returns PP_TRUE if the transport is currently writable (i.e. can |
| 30 // send data to the remote peer), PP_FALSE otherwise. | 50 // send data to the remote peer), PP_FALSE otherwise. |
| 31 PP_Bool (*IsWritable)(PP_Resource transport); | 51 PP_Bool (*IsWritable)(PP_Resource transport); |
| 32 // TODO(juberti): other getters/setters | 52 // TODO(juberti): other getters/setters |
| 33 // connect state | 53 // connect state |
| 34 // connect type, protocol | 54 // connect type, protocol |
| 35 // RTT | 55 // RTT |
| 36 | 56 |
| 57 // Sets various configuration properties of the transport. |
| 58 int32_t (*SetProperty)(PP_Resource transport, |
| 59 PP_TransportProperty property, |
| 60 struct PP_Var value); |
| 61 |
| 37 // Establishes a connection to the remote peer. Returns | 62 // Establishes a connection to the remote peer. Returns |
| 38 // PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is | 63 // PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is |
| 39 // established (or timeout occurs). | 64 // established (or timeout occurs). |
| 40 int32_t (*Connect)(PP_Resource transport, | 65 int32_t (*Connect)(PP_Resource transport, |
| 41 struct PP_CompletionCallback cb); | 66 struct PP_CompletionCallback cb); |
| 42 | 67 |
| 43 // Obtains another ICE candidate address to be provided to the | 68 // Obtains another ICE candidate address to be provided to the |
| 44 // remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more | 69 // remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more |
| 45 // addresses to be sent. After the callback is called | 70 // addresses to be sent. After the callback is called |
| 46 // GetNextAddress() must be called again to get the address. | 71 // GetNextAddress() must be called again to get the address. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 int32_t (*Send)(PP_Resource transport, | 90 int32_t (*Send)(PP_Resource transport, |
| 66 const void* data, | 91 const void* data, |
| 67 uint32_t len, | 92 uint32_t len, |
| 68 struct PP_CompletionCallback cb); | 93 struct PP_CompletionCallback cb); |
| 69 | 94 |
| 70 // Disconnects from the remote peer. | 95 // Disconnects from the remote peer. |
| 71 int32_t (*Close)(PP_Resource transport); | 96 int32_t (*Close)(PP_Resource transport); |
| 72 }; | 97 }; |
| 73 | 98 |
| 74 #endif /* PPAPI_C_PPB_TRANSPORT_DEV_H_ */ | 99 #endif /* PPAPI_C_PPB_TRANSPORT_DEV_H_ */ |
| OLD | NEW |