OLD | NEW |
1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright 2013 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 dev/ppb_udp_socket_dev.idl modified Thu Jun 13 09:38:45 2013. */ | 6 /* From dev/ppb_udp_socket_dev.idl modified Sat Jun 15 15:22:39 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ |
9 #define PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ | 9 #define PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_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/pp_var.h" |
18 | 18 |
19 #define PPB_UDPSOCKET_DEV_INTERFACE_0_1 "PPB_UDPSocket(Dev);0.1" | 19 #define PPB_UDPSOCKET_DEV_INTERFACE_0_1 "PPB_UDPSocket(Dev);0.1" |
20 #define PPB_UDPSOCKET_DEV_INTERFACE PPB_UDPSOCKET_DEV_INTERFACE_0_1 | 20 #define PPB_UDPSOCKET_DEV_INTERFACE PPB_UDPSOCKET_DEV_INTERFACE_0_1 |
21 | 21 |
22 /** | 22 /** |
23 * @file | 23 * @file |
24 * This file defines the <code>PPB_UDPSocket_Dev</code> interface. | 24 * This file defines the <code>PPB_UDPSocket_Dev</code> interface. |
25 * TODO(yzshen): Tidy up the document. | 25 * TODO(yzshen): Tidy up the document. |
26 */ | 26 */ |
27 | 27 |
28 | 28 |
29 /** | 29 /** |
30 * @addtogroup Enums | 30 * @addtogroup Enums |
31 * @{ | 31 * @{ |
32 */ | 32 */ |
33 typedef enum { | 33 typedef enum { |
34 /* Allows the socket to share the local address to which it will be bound with | 34 /* Allows the socket to share the local address to which it will be bound with |
35 * other processes. Value's type should be PP_VARTYPE_BOOL. */ | 35 * other processes. Value's type should be PP_VARTYPE_BOOL. |
| 36 * Takes effect if set before Bind(). */ |
36 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, | 37 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, |
37 /* Allows sending and receiving packets to and from broadcast addresses. | 38 /* Allows sending and receiving packets to and from broadcast addresses. |
38 * Value's type should be PP_VARTYPE_BOOL. */ | 39 * Value's type should be PP_VARTYPE_BOOL. |
| 40 * Takes effect if set before Bind(). */ |
39 PP_UDPSOCKET_OPTION_BROADCAST = 1, | 41 PP_UDPSOCKET_OPTION_BROADCAST = 1, |
40 /* Specifies the total per-socket buffer space reserved for sends. Value's | 42 /* Specifies the total per-socket buffer space reserved for sends. Value's |
41 * type should be PP_VARTYPE_INT32. | 43 * type should be PP_VARTYPE_INT32. |
42 * Note: This is only treated as a hint for the browser to set the buffer | 44 * Note: This is only treated as a hint for the browser to set the buffer |
43 * size. Even if SetOption() reports that this option has been successfully | 45 * size. Even if SetOption() reports that this option has been successfully |
44 * set, the browser doesn't guarantee it will conform to it. */ | 46 * set, the browser doesn't guarantee it will conform to it. */ |
45 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, | 47 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, |
46 /* Specifies the total per-socket buffer space reserved for receives. Value's | 48 /* Specifies the total per-socket buffer space reserved for receives. Value's |
47 * type should be PP_VARTYPE_INT32. | 49 * type should be PP_VARTYPE_INT32. |
48 * Note: This is only treated as a hint for the browser to set the buffer | 50 * Note: This is only treated as a hint for the browser to set the buffer |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 int32_t (*SendTo)(PP_Resource udp_socket, | 101 int32_t (*SendTo)(PP_Resource udp_socket, |
100 const char* buffer, | 102 const char* buffer, |
101 int32_t num_bytes, | 103 int32_t num_bytes, |
102 PP_Resource addr, | 104 PP_Resource addr, |
103 struct PP_CompletionCallback callback); | 105 struct PP_CompletionCallback callback); |
104 /** | 106 /** |
105 * Cancels all pending reads and writes, and closes the socket. | 107 * Cancels all pending reads and writes, and closes the socket. |
106 */ | 108 */ |
107 void (*Close)(PP_Resource udp_socket); | 109 void (*Close)(PP_Resource udp_socket); |
108 /** | 110 /** |
109 * Sets a socket option to |udp_socket|. Should be called before Bind(). | 111 * Sets a socket option to |udp_socket|. |
110 * See the PP_UDPSocket_Option_Dev description for option names, value types | 112 * See the PP_UDPSocket_Option_Dev description for option names, value types |
111 * and allowed values. | 113 * and allowed values. |
112 * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad | 114 * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad |
113 * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's | 115 * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's |
114 * type provided) or PP_ERROR_FAILED in the case of internal errors. | 116 * type provided) or PP_ERROR_FAILED in the case of internal errors. |
115 */ | 117 */ |
116 int32_t (*SetOption)(PP_Resource udp_socket, | 118 int32_t (*SetOption)(PP_Resource udp_socket, |
117 PP_UDPSocket_Option_Dev name, | 119 PP_UDPSocket_Option_Dev name, |
118 struct PP_Var value, | 120 struct PP_Var value, |
119 struct PP_CompletionCallback callback); | 121 struct PP_CompletionCallback callback); |
120 }; | 122 }; |
121 | 123 |
122 typedef struct PPB_UDPSocket_Dev_0_1 PPB_UDPSocket_Dev; | 124 typedef struct PPB_UDPSocket_Dev_0_1 PPB_UDPSocket_Dev; |
123 /** | 125 /** |
124 * @} | 126 * @} |
125 */ | 127 */ |
126 | 128 |
127 #endif /* PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ */ | 129 #endif /* PPAPI_C_DEV_PPB_UDP_SOCKET_DEV_H_ */ |
128 | 130 |
OLD | NEW |