| 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 ppb_websocket.idl modified Wed Mar 14 01:49:27 2012. */ | 6 /* From ppb_websocket.idl modified Wed Mar 21 09:36:29 2012. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_PPB_WEBSOCKET_H_ | 8 #ifndef PPAPI_C_PPB_WEBSOCKET_H_ |
| 9 #define PPAPI_C_PPB_WEBSOCKET_H_ | 9 #define PPAPI_C_PPB_WEBSOCKET_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" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 * connection. | 219 * connection. |
| 220 * | 220 * |
| 221 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 221 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 222 * Returns <code>PP_ERROR_BADARGUMENT</code> if the specified | 222 * Returns <code>PP_ERROR_BADARGUMENT</code> if the specified |
| 223 * <code>url</code>, or <code>protocols</code> contain an invalid string as | 223 * <code>url</code>, or <code>protocols</code> contain an invalid string as |
| 224 * defined in the WebSocket API specification. | 224 * defined in the WebSocket API specification. |
| 225 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the | 225 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the |
| 226 * WebSocket API specification. | 226 * WebSocket API specification. |
| 227 * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the | 227 * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the |
| 228 * <code>url</code> is not a secure protocol, but the origin of the caller | 228 * <code>url</code> is not a secure protocol, but the origin of the caller |
| 229 * has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</CODE> if the | 229 * has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</code> if the |
| 230 * port specified in the <code>url</code> is a port that the user agent | 230 * port specified in the <code>url</code> is a port that the user agent |
| 231 * is configured to block access to because it is a well-known port like | 231 * is configured to block access to because it is a well-known port like |
| 232 * SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to SecurityError of the | 232 * SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to SecurityError of the |
| 233 * specification. | 233 * specification. |
| 234 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to | 234 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to |
| 235 * Connect(). | 235 * Connect(). |
| 236 */ | 236 */ |
| 237 int32_t (*Connect)(PP_Resource web_socket, | 237 int32_t (*Connect)(PP_Resource web_socket, |
| 238 struct PP_Var url, | 238 struct PP_Var url, |
| 239 const struct PP_Var protocols[], | 239 const struct PP_Var protocols[], |
| 240 uint32_t protocol_count, | 240 uint32_t protocol_count, |
| 241 struct PP_CompletionCallback callback); | 241 struct PP_CompletionCallback callback); |
| 242 /** | 242 /** |
| 243 * Close() closes the specified WebSocket connection by specifying | 243 * Close() closes the specified WebSocket connection by specifying |
| 244 * <code>code</code> and <code>reason</code>. | 244 * <code>code</code> and <code>reason</code>. |
| 245 * | 245 * |
| 246 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 246 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 247 * WebSocket. | 247 * WebSocket. |
| 248 * | 248 * |
| 249 * @param[in] code The WebSocket close code. Ignored if it is 0. | 249 * @param[in] code The WebSocket close code. This is ignored if it is 0. |
| 250 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the | 250 * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the |
| 251 * usual case. To indicate some specific error cases, codes in the range | 251 * usual case. To indicate some specific error cases, codes in the range |
| 252 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to | 252 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to |
| 253 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range | 253 * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range |
| 254 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to | 254 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to |
| 255 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. | 255 * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. |
| 256 * | 256 * |
| 257 * @param[in] reason A <code>PP_Var</code> representing the WebSocket | 257 * @param[in] reason A <code>PP_Var</code> representing the WebSocket |
| 258 * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. | 258 * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. |
| 259 * Otherwise, its <code>PP_VarType</code> must be | 259 * Otherwise, its <code>PP_VarType</code> must be |
| 260 * <code>PP_VARTYPE_STRING</code>. | 260 * <code>PP_VARTYPE_STRING</code>. |
| 261 * | 261 * |
| 262 * @param[in] callback A <code>PP_CompletionCallback</code> called | 262 * @param[in] callback A <code>PP_CompletionCallback</code> called |
| 263 * when the connection is closed or an error occurs in closing the | 263 * when the connection is closed or an error occurs in closing the |
| 264 * connection. | 264 * connection. |
| 265 * | 265 * |
| 266 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 266 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 267 * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains | 267 * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains |
| 268 * an invalid character as a UTF-8 string, or is longer than 123 bytes. | 268 * an invalid character as a UTF-8 string, or is longer than 123 bytes. |
| 269 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError | 269 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError |
| 270 * in the WebSocket API specification. | 270 * in the WebSocket API specification. |
| 271 * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer | 271 * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer |
| 272 * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> | 272 * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> |
| 273 * corresponds to InvalidAccessError of the specification. Returns | 273 * corresponds to InvalidAccessError in the WebSocket API specification. |
| 274 * <code>PP_ERROR_INPROGRESS</code> if this is not the first call to | 274 * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to |
| 275 * Close(). | 275 * Close(). |
| 276 */ | 276 */ |
| 277 int32_t (*Close)(PP_Resource web_socket, | 277 int32_t (*Close)(PP_Resource web_socket, |
| 278 uint16_t code, | 278 uint16_t code, |
| 279 struct PP_Var reason, | 279 struct PP_Var reason, |
| 280 struct PP_CompletionCallback callback); | 280 struct PP_CompletionCallback callback); |
| 281 /** | 281 /** |
| 282 * ReceiveMessage() receives a message from the WebSocket server. | 282 * ReceiveMessage() receives a message from the WebSocket server. |
| 283 * This interface only returns a single message. That is, this interface must | 283 * This interface only returns a single message. That is, this interface must |
| 284 * be called at least N times to receive N messages, no matter the size of | 284 * be called at least N times to receive N messages, no matter the size of |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 struct PP_Var (*GetURL)(PP_Resource web_socket); | 425 struct PP_Var (*GetURL)(PP_Resource web_socket); |
| 426 }; | 426 }; |
| 427 | 427 |
| 428 typedef struct PPB_WebSocket_1_0 PPB_WebSocket; | 428 typedef struct PPB_WebSocket_1_0 PPB_WebSocket; |
| 429 /** | 429 /** |
| 430 * @} | 430 * @} |
| 431 */ | 431 */ |
| 432 | 432 |
| 433 #endif /* PPAPI_C_PPB_WEBSOCKET_H_ */ | 433 #endif /* PPAPI_C_PPB_WEBSOCKET_H_ */ |
| 434 | 434 |
| OLD | NEW |