Chromium Code Reviews| 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_5 "PPB_Transport;0.5" |
|
brettw
2011/08/25 16:48:43
Since we're not keeping backwards compat, you can
Sergey Ulanov
2011/08/25 17:36:53
Done.
| |
| 17 #define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_5 | 17 #define PPB_TRANSPORT_DEV_INTERFACE_0_6 "PPB_Transport;0.6" |
| 18 #define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_6 | |
| 19 | |
| 20 typedef enum { | |
| 21 // STUN server address and port, e.g "stun.l.google.com:19302". | |
|
brettw
2011/08/25 16:48:43
Why don't you use "...example.com" here and below
Sergey Ulanov
2011/08/25 17:36:53
Done.
| |
| 22 PP_TRANSPORTPROPERTY_STUN_SERVER, | |
|
brettw
2011/08/25 16:48:43
These should have explicit values, so can you say
Sergey Ulanov
2011/08/25 17:36:53
Done.
| |
| 23 | |
| 24 // Relay server name, e.g. "relay.google.com". | |
| 25 PP_TRANSPORTPROPERTY_RELAY_SERVER, | |
| 26 | |
| 27 // Single string that specifies token for use with relay server. | |
| 28 PP_TRANSPORTPROPERTY_RELAY_TOKEN, | |
| 29 | |
| 30 // TCP receive window in bytes. Takes effect only for PseudoTCP | |
| 31 // connections. | |
| 32 PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW, | |
| 33 | |
| 34 // TCP send window in bytes. Takes effect only for PseudoTCP | |
| 35 // connections. | |
| 36 PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW | |
| 37 } PP_TransportProperty; | |
| 38 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportProperty, 4); | |
| 18 | 39 |
| 19 struct PPB_Transport_Dev { | 40 struct PPB_Transport_Dev { |
| 20 // Creates a new transport object with the specified name using the | 41 // Creates a new transport object with the specified name using the |
| 21 // specified protocol. | 42 // specified protocol. |
| 22 PP_Resource (*CreateTransport)(PP_Instance instance, | 43 PP_Resource (*CreateTransport)(PP_Instance instance, |
| 23 const char* name, | 44 const char* name, |
| 24 const char* proto); | 45 const char* proto); |
| 25 | 46 |
| 26 // Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. | 47 // Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. |
| 27 PP_Bool (*IsTransport)(PP_Resource resource); | 48 PP_Bool (*IsTransport)(PP_Resource resource); |
| 28 | 49 |
| 29 // Returns PP_TRUE if the transport is currently writable (i.e. can | 50 // Returns PP_TRUE if the transport is currently writable (i.e. can |
| 30 // send data to the remote peer), PP_FALSE otherwise. | 51 // send data to the remote peer), PP_FALSE otherwise. |
| 31 PP_Bool (*IsWritable)(PP_Resource transport); | 52 PP_Bool (*IsWritable)(PP_Resource transport); |
| 32 // TODO(juberti): other getters/setters | 53 // TODO(juberti): other getters/setters |
| 33 // connect state | 54 // connect state |
| 34 // connect type, protocol | 55 // connect type, protocol |
| 35 // RTT | 56 // RTT |
| 36 | 57 |
| 58 // Sets various configuration properties of the transport. | |
| 59 int32_t (*SetProperty)(PP_Resource transport, | |
| 60 PP_TransportProperty property, | |
| 61 struct PP_Var value); | |
| 62 | |
| 37 // Establishes a connection to the remote peer. Returns | 63 // Establishes a connection to the remote peer. Returns |
| 38 // PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is | 64 // PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is |
| 39 // established (or timeout occurs). | 65 // established (or timeout occurs). |
| 40 int32_t (*Connect)(PP_Resource transport, | 66 int32_t (*Connect)(PP_Resource transport, |
| 41 struct PP_CompletionCallback cb); | 67 struct PP_CompletionCallback cb); |
| 42 | 68 |
| 43 // Obtains another ICE candidate address to be provided to the | 69 // Obtains another ICE candidate address to be provided to the |
| 44 // remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more | 70 // remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more |
| 45 // addresses to be sent. After the callback is called | 71 // addresses to be sent. After the callback is called |
| 46 // GetNextAddress() must be called again to get the address. | 72 // GetNextAddress() must be called again to get the address. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 65 int32_t (*Send)(PP_Resource transport, | 91 int32_t (*Send)(PP_Resource transport, |
| 66 const void* data, | 92 const void* data, |
| 67 uint32_t len, | 93 uint32_t len, |
| 68 struct PP_CompletionCallback cb); | 94 struct PP_CompletionCallback cb); |
| 69 | 95 |
| 70 // Disconnects from the remote peer. | 96 // Disconnects from the remote peer. |
| 71 int32_t (*Close)(PP_Resource transport); | 97 int32_t (*Close)(PP_Resource transport); |
| 72 }; | 98 }; |
| 73 | 99 |
| 74 #endif /* PPAPI_C_PPB_TRANSPORT_DEV_H_ */ | 100 #endif /* PPAPI_C_PPB_TRANSPORT_DEV_H_ */ |
| OLD | NEW |