summaryrefslogtreecommitdiffstats
path: root/ppapi/c/ppb_websocket.h
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-06 07:06:25 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-06 07:06:25 +0000
commit7d107f337c365ad5f473bcc68adfa15b2a8e7a6d (patch)
tree741015ca816b8bb42552f4474f778a0346c30674 /ppapi/c/ppb_websocket.h
parent436d72e873098925ad9d8cd78fe2054ddb9afd66 (diff)
downloadchromium_src-7d107f337c365ad5f473bcc68adfa15b2a8e7a6d.zip
chromium_src-7d107f337c365ad5f473bcc68adfa15b2a8e7a6d.tar.gz
chromium_src-7d107f337c365ad5f473bcc68adfa15b2a8e7a6d.tar.bz2
WebSocket Pepper API: Add close status code definition
BUG=112776 TEST=no tests because this CL just adds definitions Review URL: http://codereview.chromium.org/9315050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/ppb_websocket.h')
-rw-r--r--ppapi/c/ppb_websocket.h107
1 files changed, 106 insertions, 1 deletions
diff --git a/ppapi/c/ppb_websocket.h b/ppapi/c/ppb_websocket.h
index 9124c28..8fac7d2 100644
--- a/ppapi/c/ppb_websocket.h
+++ b/ppapi/c/ppb_websocket.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_websocket.idl modified Fri Jan 27 15:51:19 2012. */
+/* From ppb_websocket.idl modified Mon Feb 6 14:29:34 2012. */
#ifndef PPAPI_C_PPB_WEBSOCKET_H_
#define PPAPI_C_PPB_WEBSOCKET_H_
@@ -58,6 +58,105 @@ typedef enum {
PP_WEBSOCKETREADYSTATE_CLOSED = 3
} PP_WebSocketReadyState;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketReadyState, 4);
+
+/**
+ * This enumeration contains status codes. These codes are used in Close() and
+ * GetCloseCode(). See also RFC 6455, The WebSocket Protocol.
+ * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> and codes in the range
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are valid for Close().
+ */
+typedef enum {
+ /**
+ * Status codes in the range 0-999 are not used.
+ */
+ /**
+ * Indicates a normal closure.
+ */
+ PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000,
+ /**
+ * Indicates that an endpoint is "going away", such as a server going down.
+ */
+ PP_WEBSOCKETSTATUSCODE_GOING_AWAY = 1001,
+ /**
+ * Indicates that an endpoint is terminating the connection due to a protocol
+ * error.
+ */
+ PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR = 1002,
+ /**
+ * Indicates that an endpoint is terminating the connection because it has
+ * received a type of data it cannot accept.
+ */
+ PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA = 1003,
+ /**
+ * Status code 1004 is reserved.
+ */
+ /**
+ * Pseudo code to indicate that receiving close frame doesn't contain any
+ * status code.
+ */
+ PP_WEBSOCKETSTATUSCODE_NO_STATUS_RECEIVED = 1005,
+ /**
+ * Pseudo code to indicate that connection was closed abnormally, e.g.,
+ * without closing handshake.
+ */
+ PP_WEBSOCKETSTATUSCODE_ABNORMAL_CLOSURE = 1006,
+ /**
+ * Indicates that an endpoint is terminating the connection because it has
+ * received data within a message that was not consistent with the type of
+ * the message (e.g., non-UTF-8 data within a text message).
+ */
+ PP_WEBSOCKETSTATUSCODE_INVALID_FRAME_PAYLOAD_DATA = 1007,
+ /**
+ * Indicates that an endpoint is terminating the connection because it has
+ * received a message that violates its policy.
+ */
+ PP_WEBSOCKETSTATUSCODE_POLICY_VIOLATION = 1008,
+ /**
+ * Indicates that an endpoint is terminating the connection because it has
+ * received a message that is too big for it to process.
+ */
+ PP_WEBSOCKETSTATUSCODE_MESSAGE_TOO_BIG = 1009,
+ /**
+ * Indicates that an endpoint (client) is terminating the connection because
+ * it has expected the server to negotiate one or more extension, but the
+ * server didn't return them in the response message of the WebSocket
+ * handshake.
+ */
+ PP_WEBSOCKETSTATUSCODE_MANDATORY_EXTENSION = 1010,
+ /**
+ * Indicates that a server is terminating the connection because it
+ * encountered an unexpected condition.
+ */
+ PP_WEBSOCKETSTATUSCODE_INTERNAL_SERVER_ERROR = 1011,
+ /**
+ * Status codes in the range 1012-1014 are reserved.
+ */
+ /**
+ * Pseudo code to indicate that the connection was closed due to a failure to
+ * perform a TLS handshake.
+ */
+ PP_WEBSOCKETSTATUSCODE_TLS_HANDSHAKE = 1015,
+ /**
+ * Status codes in the range 1016-2999 are reserved.
+ */
+ /**
+ * Status codes in the range 3000-3999 are reserved for use by libraries,
+ * frameworks, and applications. These codes are registered directly with
+ * IANA.
+ */
+ PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN = 3000,
+ PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX = 3999,
+ /**
+ * Status codes in the range 4000-4999 are reserved for private use.
+ * Application can use these codes for application specific purposes freely.
+ */
+ PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN = 4000,
+ PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX = 4999
+} PP_WebSocketCloseCode;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketCloseCode, 4);
/**
* @}
*/
@@ -140,6 +239,12 @@ struct PPB_WebSocket_1_0 {
* WebSocket.
*
* @param[in] code The WebSocket close code. Ignored if it is 0.
+ * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the
+ * usual case. To indicate some specific error cases, codes in the range
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to
+ * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available.
*
* @param[in] reason A <code>PP_Var</code> which represents the WebSocket
* close reason. Ignored if it is <code>PP_VARTYPE_UNDEFINED</code>.