OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /* From private/ppb_udp_socket_private.idl modified Wed Feb 8 18:02:19 2012. */ | 6 /* From private/ppb_udp_socket_private.idl modified Tue Aug 21 11:41:45 2012. */ |
7 | 7 |
8 #ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ | 8 #ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ |
9 #define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ | 9 #define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_macros.h" | 14 #include "ppapi/c/pp_macros.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 17 #include "ppapi/c/pp_var.h" |
17 #include "ppapi/c/private/ppb_net_address_private.h" | 18 #include "ppapi/c/private/ppb_net_address_private.h" |
18 | 19 |
19 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 "PPB_UDPSocket_Private;0.2" | 20 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 "PPB_UDPSocket_Private;0.2" |
20 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_UDPSocket_Private;0.3" | 21 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_UDPSocket_Private;0.3" |
21 #define PPB_UDPSOCKET_PRIVATE_INTERFACE PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3 | 22 #define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_UDPSocket_Private;0.4" |
| 23 #define PPB_UDPSOCKET_PRIVATE_INTERFACE PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4 |
22 | 24 |
23 /** | 25 /** |
24 * @file | 26 * @file |
25 * This file defines the <code>PPB_UDPSocket_Private</code> interface. | 27 * This file defines the <code>PPB_UDPSocket_Private</code> interface. |
26 */ | 28 */ |
27 | 29 |
28 | 30 |
29 /** | 31 /** |
| 32 * @addtogroup Enums |
| 33 * @{ |
| 34 */ |
| 35 typedef enum { |
| 36 /* Allow the socket to share the local address to which socket will |
| 37 * be bound with other processes. Value's type should be |
| 38 * PP_VARTYPE_BOOL. */ |
| 39 PP_UDPSOCKETFEATURE_ADDRESS_REUSE = 0, |
| 40 /* Allow sending and receiving packets sent to and from broadcast |
| 41 * addresses. Value's type should be PP_VARTYPE_BOOL. */ |
| 42 PP_UDPSOCKETFEATURE_BROADCAST = 1, |
| 43 /* Special value for counting the number of available |
| 44 * features. Should not be passed to SetSocketFeature(). */ |
| 45 PP_UDPSOCKETFEATURE_COUNT = 2 |
| 46 } PP_UDPSocketFeature_Private; |
| 47 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocketFeature_Private, 4); |
| 48 /** |
| 49 * @} |
| 50 */ |
| 51 |
| 52 /** |
30 * @addtogroup Interfaces | 53 * @addtogroup Interfaces |
31 * @{ | 54 * @{ |
32 */ | 55 */ |
33 struct PPB_UDPSocket_Private_0_3 { | 56 struct PPB_UDPSocket_Private_0_4 { |
34 /** | 57 /** |
35 * Creates a UDP socket resource. | 58 * Creates a UDP socket resource. |
36 */ | 59 */ |
37 PP_Resource (*Create)(PP_Instance instance_id); | 60 PP_Resource (*Create)(PP_Instance instance_id); |
38 /** | 61 /** |
39 * Determines if a given resource is a UDP socket. | 62 * Determines if a given resource is a UDP socket. |
40 */ | 63 */ |
41 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); | 64 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); |
| 65 /** |
| 66 * Sets a socket feature to |udp_socket|. Should be called before |
| 67 * Bind(). Possible values for |name|, |value| and |value|'s type |
| 68 * are described in PP_UDPSocketFeature_Private description. If no |
| 69 * error occurs, returns PP_OK. Otherwise, returns PP_ERROR_FAILED. |
| 70 */ |
| 71 int32_t (*SetSocketFeature)(PP_Resource udp_socket, |
| 72 PP_UDPSocketFeature_Private name, |
| 73 struct PP_Var value); |
42 /* Creates a socket and binds to the address given by |addr|. */ | 74 /* Creates a socket and binds to the address given by |addr|. */ |
43 int32_t (*Bind)(PP_Resource udp_socket, | 75 int32_t (*Bind)(PP_Resource udp_socket, |
44 const struct PP_NetAddress_Private* addr, | 76 const struct PP_NetAddress_Private* addr, |
45 struct PP_CompletionCallback callback); | 77 struct PP_CompletionCallback callback); |
46 /* Returns the address that the socket has bound to. A successful | 78 /* Returns the address that the socket has bound to. A successful |
47 * call to Bind must be called first. Returns PP_FALSE if Bind | 79 * call to Bind must be called first. Returns PP_FALSE if Bind |
48 * fails, or if Close has been called. | 80 * fails, or if Close has been called. |
49 */ | 81 */ |
50 PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, | 82 PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, |
51 struct PP_NetAddress_Private* addr); | 83 struct PP_NetAddress_Private* addr); |
(...skipping 17 matching lines...) Expand all Loading... |
69 */ | 101 */ |
70 int32_t (*SendTo)(PP_Resource udp_socket, | 102 int32_t (*SendTo)(PP_Resource udp_socket, |
71 const char* buffer, | 103 const char* buffer, |
72 int32_t num_bytes, | 104 int32_t num_bytes, |
73 const struct PP_NetAddress_Private* addr, | 105 const struct PP_NetAddress_Private* addr, |
74 struct PP_CompletionCallback callback); | 106 struct PP_CompletionCallback callback); |
75 /* Cancels all pending reads and writes, and closes the socket. */ | 107 /* Cancels all pending reads and writes, and closes the socket. */ |
76 void (*Close)(PP_Resource udp_socket); | 108 void (*Close)(PP_Resource udp_socket); |
77 }; | 109 }; |
78 | 110 |
79 typedef struct PPB_UDPSocket_Private_0_3 PPB_UDPSocket_Private; | 111 typedef struct PPB_UDPSocket_Private_0_4 PPB_UDPSocket_Private; |
80 | 112 |
81 struct PPB_UDPSocket_Private_0_2 { | 113 struct PPB_UDPSocket_Private_0_2 { |
82 PP_Resource (*Create)(PP_Instance instance_id); | 114 PP_Resource (*Create)(PP_Instance instance_id); |
83 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); | 115 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); |
84 int32_t (*Bind)(PP_Resource udp_socket, | 116 int32_t (*Bind)(PP_Resource udp_socket, |
85 const struct PP_NetAddress_Private* addr, | 117 const struct PP_NetAddress_Private* addr, |
86 struct PP_CompletionCallback callback); | 118 struct PP_CompletionCallback callback); |
87 int32_t (*RecvFrom)(PP_Resource udp_socket, | 119 int32_t (*RecvFrom)(PP_Resource udp_socket, |
88 char* buffer, | 120 char* buffer, |
89 int32_t num_bytes, | 121 int32_t num_bytes, |
90 struct PP_CompletionCallback callback); | 122 struct PP_CompletionCallback callback); |
91 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, | 123 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, |
92 struct PP_NetAddress_Private* addr); | 124 struct PP_NetAddress_Private* addr); |
93 int32_t (*SendTo)(PP_Resource udp_socket, | 125 int32_t (*SendTo)(PP_Resource udp_socket, |
94 const char* buffer, | 126 const char* buffer, |
95 int32_t num_bytes, | 127 int32_t num_bytes, |
96 const struct PP_NetAddress_Private* addr, | 128 const struct PP_NetAddress_Private* addr, |
97 struct PP_CompletionCallback callback); | 129 struct PP_CompletionCallback callback); |
98 void (*Close)(PP_Resource udp_socket); | 130 void (*Close)(PP_Resource udp_socket); |
99 }; | 131 }; |
| 132 |
| 133 struct PPB_UDPSocket_Private_0_3 { |
| 134 PP_Resource (*Create)(PP_Instance instance_id); |
| 135 PP_Bool (*IsUDPSocket)(PP_Resource resource_id); |
| 136 int32_t (*Bind)(PP_Resource udp_socket, |
| 137 const struct PP_NetAddress_Private* addr, |
| 138 struct PP_CompletionCallback callback); |
| 139 PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, |
| 140 struct PP_NetAddress_Private* addr); |
| 141 int32_t (*RecvFrom)(PP_Resource udp_socket, |
| 142 char* buffer, |
| 143 int32_t num_bytes, |
| 144 struct PP_CompletionCallback callback); |
| 145 PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, |
| 146 struct PP_NetAddress_Private* addr); |
| 147 int32_t (*SendTo)(PP_Resource udp_socket, |
| 148 const char* buffer, |
| 149 int32_t num_bytes, |
| 150 const struct PP_NetAddress_Private* addr, |
| 151 struct PP_CompletionCallback callback); |
| 152 void (*Close)(PP_Resource udp_socket); |
| 153 }; |
100 /** | 154 /** |
101 * @} | 155 * @} |
102 */ | 156 */ |
103 | 157 |
104 #endif /* PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ */ | 158 #endif /* PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ */ |
105 | 159 |
OLD | NEW |