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 | |
6 /* From ppb_flash_udp_socket.idl modified Mon Sep 26 09:04:41 2011. */ | |
7 | |
8 #ifndef PPAPI_C_PPB_FLASH_UDP_SOCKET_H_ | |
yzshen1
2011/09/26 17:03:27
Please add back 'PRIVATE' in line 8, 9 and 75.
mtilburg
2011/09/26 17:16:18
Ah yes, I'll have to do this manually for now, but
| |
9 #define PPAPI_C_PPB_FLASH_UDP_SOCKET_H_ | |
10 | |
11 #include "ppapi/c/pp_bool.h" | |
12 #include "ppapi/c/pp_completion_callback.h" | |
13 #include "ppapi/c/pp_instance.h" | |
14 #include "ppapi/c/pp_macros.h" | |
15 #include "ppapi/c/pp_resource.h" | |
16 #include "ppapi/c/pp_stdint.h" | |
17 #include "ppapi/c/private/ppb_flash_tcp_socket.h" | |
18 | |
19 #define PPB_FLASH_UDPSOCKET_INTERFACE_0_1 "PPB_Flash_UDPSocket;0.1" | |
20 #define PPB_FLASH_UDPSOCKET_INTERFACE PPB_FLASH_UDPSOCKET_INTERFACE_0_1 | |
21 | |
22 /** | |
23 * @file | |
24 * This file defines the <code>PPB_Flash_UDPSocket</code> interface. | |
25 */ | |
26 | |
27 | |
28 /** | |
29 * @addtogroup Interfaces | |
30 * @{ | |
31 */ | |
32 struct PPB_Flash_UDPSocket { | |
33 /** | |
34 * Creates a UDP socket resource. | |
35 */ | |
36 PP_Resource (*Create)(PP_Instance instance_id); | |
37 /** | |
38 * Determines if a given resource is a UDP socket. | |
39 */ | |
40 PP_Bool (*IsFlashUDPSocket)(PP_Resource resource_id); | |
41 /* Creates a socket and binds to the address given by |addr|. */ | |
42 int32_t (*Bind)(PP_Resource udp_socket, | |
43 const struct PP_Flash_NetAddress* addr, | |
44 struct PP_CompletionCallback callback); | |
45 /* Performs a non-blocking recvfrom call on socket. | |
46 * Bind must be called first. |callback| is invoked when recvfrom | |
47 * reads data. You must call GetRecvFromAddress to recover the | |
48 * address the data was retrieved from. | |
49 */ | |
50 int32_t (*RecvFrom)(PP_Resource udp_socket, | |
51 char* buffer, | |
52 int32_t num_bytes, | |
53 struct PP_CompletionCallback callback); | |
54 /* Upon successful completion of RecvFrom, the address that the data | |
55 * was received from is stored in |addr|. | |
56 */ | |
57 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, | |
58 struct PP_Flash_NetAddress* addr); | |
59 /* Performs a non-blocking sendto call on the socket created and | |
60 * bound(has already called Bind). The callback |callback| is | |
61 * invoked when sendto completes. | |
62 */ | |
63 int32_t (*SendTo)(PP_Resource udp_socket, | |
64 const char* buffer, | |
65 int32_t num_bytes, | |
66 const struct PP_Flash_NetAddress* addr, | |
67 struct PP_CompletionCallback callback); | |
68 /* Cancels all pending reads and writes, and closes the socket. */ | |
69 void (*Close)(PP_Resource udp_socket); | |
70 }; | |
71 /** | |
72 * @} | |
73 */ | |
74 | |
75 #endif /* PPAPI_C_PPB_FLASH_UDP_SOCKET_H_ */ | |
76 | |
OLD | NEW |