| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_websocket_dev.idl modified Mon Nov 7 15:21:42 2011. */ | 6 /* From dev/ppb_websocket_dev.idl modified Wed Nov 16 02:46:08 2011. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ |
| 9 #define PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ | 9 #define PPAPI_C_DEV_PPB_WEBSOCKET_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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 29 * @addtogroup Enums | 29 * @addtogroup Enums |
| 30 * @{ | 30 * @{ |
| 31 */ | 31 */ |
| 32 /** | 32 /** |
| 33 * This enumeration contains the types representing the WebSocket ready state | 33 * This enumeration contains the types representing the WebSocket ready state |
| 34 * and these states are based on the JavaScript WebSocket API specification. | 34 * and these states are based on the JavaScript WebSocket API specification. |
| 35 * GetReadyState() returns one of these states. | 35 * GetReadyState() returns one of these states. |
| 36 */ | 36 */ |
| 37 typedef enum { | 37 typedef enum { |
| 38 /** | 38 /** |
| 39 * Ready state is queried on an invalid resource. |
| 40 */ |
| 41 PP_WEBSOCKETREADYSTATE_INVALID_DEV = -1, |
| 42 /** |
| 39 * Ready state that the connection has not yet been established. | 43 * Ready state that the connection has not yet been established. |
| 40 */ | 44 */ |
| 41 PP_WEBSOCKETREADYSTATE_CONNECTING_DEV = 0, | 45 PP_WEBSOCKETREADYSTATE_CONNECTING_DEV = 0, |
| 42 /** | 46 /** |
| 43 * Ready state that the WebSocket connection is established and communication | 47 * Ready state that the WebSocket connection is established and communication |
| 44 * is possible. | 48 * is possible. |
| 45 */ | 49 */ |
| 46 PP_WEBSOCKETREADYSTATE_OPEN_DEV = 1, | 50 PP_WEBSOCKETREADYSTATE_OPEN_DEV = 1, |
| 47 /** | 51 /** |
| 48 * Ready state that the connection is going through the closing handshake. | 52 * Ready state that the connection is going through the closing handshake. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 * @return Returns 0 if called before the close code is set. | 240 * @return Returns 0 if called before the close code is set. |
| 237 */ | 241 */ |
| 238 uint16_t (*GetCloseCode)(PP_Resource web_socket); | 242 uint16_t (*GetCloseCode)(PP_Resource web_socket); |
| 239 /** | 243 /** |
| 240 * GetCloseReason() returns the connection close reason for the WebSocket | 244 * GetCloseReason() returns the connection close reason for the WebSocket |
| 241 * connection. | 245 * connection. |
| 242 * | 246 * |
| 243 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 247 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 244 * WebSocket. | 248 * WebSocket. |
| 245 * | 249 * |
| 246 * @return Returns a <code>PP_VARTYPE_NULL</code> var if called before the | 250 * @return Returns a <code>PP_VARTYPE_STRING</code> var. if called before the |
| 247 * close reason is set, or <code>PP_VARTYPE_UNDEFINED</code> if called on an | 251 * close reason is set, its data is empty string. Returns a |
| 248 * invalid resource. | 252 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| 249 */ | 253 */ |
| 250 struct PP_Var (*GetCloseReason)(PP_Resource web_socket); | 254 struct PP_Var (*GetCloseReason)(PP_Resource web_socket); |
| 251 /** | 255 /** |
| 252 * GetCloseWasClean() returns if the connection was closed cleanly for the | 256 * GetCloseWasClean() returns if the connection was closed cleanly for the |
| 253 * specified WebSocket connection. | 257 * specified WebSocket connection. |
| 254 * | 258 * |
| 255 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 259 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 256 * WebSocket. | 260 * WebSocket. |
| 257 * | 261 * |
| 258 * @return Returns <code>PP_FALSE</code> if called before the connection is | 262 * @return Returns <code>PP_FALSE</code> if called before the connection is |
| 259 * closed. Otherwise, returns <code>PP_TRUE</code> if the connection was | 263 * closed, or called on an invalid resource. Otherwise, returns |
| 260 * closed cleanly and returns <code>PP_FALSE</code> if the connection was | 264 * <code>PP_TRUE</code> if the connection was closed cleanly, or returns |
| 261 * closed by abnormal reasons. | 265 * <code>PP_FALSE</code> if the connection was closed by abnormal reasons. |
| 262 */ | 266 */ |
| 263 PP_Bool (*GetCloseWasClean)(PP_Resource web_socket); | 267 PP_Bool (*GetCloseWasClean)(PP_Resource web_socket); |
| 264 /** | 268 /** |
| 265 * GetExtensions() returns the extensions selected by the server for the | 269 * GetExtensions() returns the extensions selected by the server for the |
| 266 * specified WebSocket connection. | 270 * specified WebSocket connection. |
| 267 * | 271 * |
| 268 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 272 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 269 * WebSocket. | 273 * WebSocket. |
| 270 * | 274 * |
| 271 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 275 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| 272 * connection is established or called on an invalid resource, its data is | 276 * connection is established, its data is empty string. Returns a |
| 273 * empty string. | 277 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| 274 * Currently its data is always empty string. | 278 * Currently its data for valid resources are always empty string. |
| 275 */ | 279 */ |
| 276 struct PP_Var (*GetExtensions)(PP_Resource web_socket); | 280 struct PP_Var (*GetExtensions)(PP_Resource web_socket); |
| 277 /** | 281 /** |
| 278 * GetProtocol() returns the sub-protocol chosen by the server for the | 282 * GetProtocol() returns the sub-protocol chosen by the server for the |
| 279 * specified WebSocket connection. | 283 * specified WebSocket connection. |
| 280 * | 284 * |
| 281 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 285 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 282 * WebSocket. | 286 * WebSocket. |
| 283 * | 287 * |
| 284 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 288 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| 285 * connection is established, or called on an invalid resource, its data is | 289 * connection is established, its data is empty string. Returns a |
| 286 * empty string. | 290 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| 287 */ | 291 */ |
| 288 struct PP_Var (*GetProtocol)(PP_Resource web_socket); | 292 struct PP_Var (*GetProtocol)(PP_Resource web_socket); |
| 289 /** | 293 /** |
| 290 * GetReadyState() returns the ready state of the specified WebSocket | 294 * GetReadyState() returns the ready state of the specified WebSocket |
| 291 * connection. | 295 * connection. |
| 292 * | 296 * |
| 293 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 297 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 294 * WebSocket. | 298 * WebSocket. |
| 295 * | 299 * |
| 296 * @return Returns <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code> if called | 300 * @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called |
| 297 * before the connection is established. | 301 * before connect() is called, or called on an invalid resource. |
| 298 */ | 302 */ |
| 299 PP_WebSocketReadyState_Dev (*GetReadyState)(PP_Resource web_socket); | 303 PP_WebSocketReadyState_Dev (*GetReadyState)(PP_Resource web_socket); |
| 300 /** | 304 /** |
| 301 * GetURL() returns the URL associated with specified WebSocket connection. | 305 * GetURL() returns the URL associated with specified WebSocket connection. |
| 302 * | 306 * |
| 303 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a | 307 * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| 304 * WebSocket. | 308 * WebSocket. |
| 305 * | 309 * |
| 306 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the | 310 * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| 307 * connection is established, or called on an invalid resource, its data is | 311 * connection is established, its data is empty string. Return a |
| 308 * empty string. | 312 * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| 309 */ | 313 */ |
| 310 struct PP_Var (*GetURL)(PP_Resource web_socket); | 314 struct PP_Var (*GetURL)(PP_Resource web_socket); |
| 311 }; | 315 }; |
| 312 /** | 316 /** |
| 313 * @} | 317 * @} |
| 314 */ | 318 */ |
| 315 | 319 |
| 316 #endif /* PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ */ | 320 #endif /* PPAPI_C_DEV_PPB_WEBSOCKET_DEV_H_ */ |
| 317 | 321 |
| OLD | NEW |