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_UDP_SOCKET_H_ | |
6 #define PPAPI_C_PRIVATE_PPB_FLASH_UDP_SOCKET_H_ | |
7 | |
8 #include "ppapi/c/pp_bool.h" | |
9 #include "ppapi/c/pp_completion_callback.h" | |
10 #include "ppapi/c/pp_instance.h" | |
11 #include "ppapi/c/pp_resource.h" | |
12 #include "ppapi/c/pp_stdint.h" | |
13 #include "ppapi/c/private/ppb_flash_tcp_socket.h" // for PP_Flash_NetAddress | |
14 | |
15 #define PPB_FLASH_UDPSOCKET_INTERFACE "PPB_Flash_UDPSocket;0.1" | |
16 | |
17 struct PPB_Flash_UDPSocket { | |
18 PP_Resource (*Create)(PP_Instance instance, int32_t family); | |
yzshen1
2011/09/17 02:10:07
I read pepper_message_filter and found that |famil
mtilburg
2011/09/21 01:46:43
You're right... CreateSocket in udp_socket_libeven
| |
19 | |
20 PP_Bool (*IsFlashUDPSocket)(PP_Resource resource); | |
21 | |
22 // Creates a socket and binds to the address given by |addr|. | |
23 int32_t (*Bind)(PP_Resource udp_socket, | |
24 const struct PP_Flash_NetAddress* addr, | |
25 struct PP_CompletionCallback callback); | |
26 | |
27 // Performs a non-blocking recvfrom call on socket. | |
28 // Bind must be called first. |callback| is invoked when recvfrom | |
29 // reads data. You must call GetRecvFromAddress to recover the | |
30 // address the data was retrieved from. | |
31 int32_t (*RecvFrom)(PP_Resource udp_socket, | |
32 char* buffer, | |
33 int32_t num_bytes, | |
34 struct PP_CompletionCallback callback); | |
35 | |
36 // Upon successful completion of RecvFrom, the address that the data | |
37 // was received from is stored in |addr|. | |
38 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, | |
39 struct PP_Flash_NetAddress* addr); | |
40 | |
41 // Performs a non-blocking sendto call on the socket created and | |
42 // bound(has already called Bind). The callback |callback| is | |
43 // invoked when sendto completes. | |
44 int32_t (*SendTo)(PP_Resource udp_socket, | |
45 const char* buffer, | |
46 int32_t num_bytes, | |
47 const struct PP_Flash_NetAddress* addr, | |
48 struct PP_CompletionCallback callback); | |
49 | |
50 // Cancels all pending reads and writes, and closes the socket. | |
51 void (*Disconnect)(PP_Resource udp_socket); | |
yzshen1
2011/09/17 02:10:07
Does it make sense to use Close instead of Disconn
mtilburg
2011/09/21 01:46:43
Yes. Changed
| |
52 }; | |
53 | |
54 #endif // PPAPI_C_PRIVATE_PPB_FLASH_UDP_SOCKET_H_ | |
55 | |
OLD | NEW |