OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_NET_CONNECTOR_H_ |
| 6 #define PPAPI_C_PRIVATE_PPB_FLASH_NET_CONNECTOR_H_ |
| 7 |
| 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_resource.h" |
| 11 #include "ppapi/c/private/ppb_flash.h" // For |PP_FileHandle|. |
| 12 |
| 13 #define PPB_FLASH_NETCONNECTOR_INTERFACE "PPB_Flash_NetConnector;1" |
| 14 |
| 15 // This is an opaque type holding a network address. |
| 16 struct PP_Flash_NetAddress { |
| 17 size_t size; |
| 18 char data[128]; |
| 19 }; |
| 20 |
| 21 struct PPB_Flash_NetConnector { |
| 22 PP_Resource (*Create)(PP_Instance instance_id); |
| 23 PP_Bool (*IsFlashNetConnector)(PP_Resource resource_id); |
| 24 |
| 25 // Connect to a TCP port given as a host-port pair. The local and remote |
| 26 // addresses of the connection (if successful) are returned in |
| 27 // |local_addr_out| and |remote_addr_out|, respectively, if non-null. |
| 28 int32_t (*ConnectTcp)(PP_Resource connector_id, |
| 29 const char* host, |
| 30 uint16_t port, |
| 31 PP_FileHandle* socket_out, |
| 32 struct PP_Flash_NetAddress* local_addr_out, |
| 33 struct PP_Flash_NetAddress* remote_addr_out, |
| 34 struct PP_CompletionCallback callback); |
| 35 |
| 36 // Same as |ConnectTcp()|, but connecting to the address given by |addr|. A |
| 37 // typical use-case would be for reconnections. |
| 38 int32_t (*ConnectTcpAddress)(PP_Resource connector_id, |
| 39 const struct PP_Flash_NetAddress* addr, |
| 40 PP_FileHandle* socket_out, |
| 41 struct PP_Flash_NetAddress* local_addr_out, |
| 42 struct PP_Flash_NetAddress* remote_addr_out, |
| 43 struct PP_CompletionCallback callback); |
| 44 }; |
| 45 |
| 46 #endif // PPAPI_C_PRIVATE_PPB_FLASH_NET_CONNECTOR_H_ |
OLD | NEW |