Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: ppapi/c/ppb_websocket.h

Issue 9813011: Websocket documentation change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 Fri Mar 23 15:38:12 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
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 a 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 a 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 27 matching lines...) Expand all
312 * WebSocket. 312 * WebSocket.
313 * 313 *
314 * @param[in] message A message to send. The message is copied to an internal 314 * @param[in] message A message to send. The message is copied to an internal
315 * buffer, so the caller can free <code>message</code> safely after returning 315 * buffer, so the caller can free <code>message</code> safely after returning
316 * from the function. Its sent <code>PP_VarType</code> must be 316 * from the function. Its sent <code>PP_VarType</code> must be
317 * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>. 317 * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>.
318 * 318 *
319 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 319 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
320 * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is 320 * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is
321 * <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>. 321 * <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>.
322 * <code>PP_ERROR_FAILED</code> corresponds to the JavaScript 322 * <code>PP_ERROR_FAILED</code> corresponds to a JavaScript
323 * InvalidStateError in the WebSocket API specification. 323 * InvalidStateError in the WebSocket API specification.
324 * Returns <code>PP_ERROR_BADARGUMENT</code> if the provided 324 * Returns <code>PP_ERROR_BADARGUMENT</code> if the provided
325 * <code>message</code> contains an invalid character as a UTF-8 string. 325 * <code>message</code> contains an invalid character as a UTF-8 string.
326 * <code>PP_ERROR_BADARGUMENT</code> corresponds to the JavaScript 326 * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript
327 * SyntaxError in the WebSocket API specification. 327 * SyntaxError in the WebSocket API specification.
328 * Otherwise, returns <code>PP_OK</code>, which doesn't necessarily mean 328 * Otherwise, returns <code>PP_OK</code>, which doesn't necessarily mean
329 * that the server received the message. 329 * that the server received the message.
330 */ 330 */
331 int32_t (*SendMessage)(PP_Resource web_socket, struct PP_Var message); 331 int32_t (*SendMessage)(PP_Resource web_socket, struct PP_Var message);
332 /** 332 /**
333 * GetBufferedAmount() returns the number of bytes of text and binary 333 * GetBufferedAmount() returns the number of bytes of text and binary
334 * messages that have been queued for the WebSocket connection to send, but 334 * messages that have been queued for the WebSocket connection to send, but
335 * have not been transmitted to the network yet. 335 * have not been transmitted to the network yet.
336 * 336 *
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698