diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-06 07:06:25 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-06 07:06:25 +0000 |
commit | 7d107f337c365ad5f473bcc68adfa15b2a8e7a6d (patch) | |
tree | 741015ca816b8bb42552f4474f778a0346c30674 /ppapi/api/ppb_websocket.idl | |
parent | 436d72e873098925ad9d8cd78fe2054ddb9afd66 (diff) | |
download | chromium_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/api/ppb_websocket.idl')
-rw-r--r-- | ppapi/api/ppb_websocket.idl | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/ppapi/api/ppb_websocket.idl b/ppapi/api/ppb_websocket.idl index 7dd42b1..c5bb7c2 100644 --- a/ppapi/api/ppb_websocket.idl +++ b/ppapi/api/ppb_websocket.idl @@ -44,6 +44,122 @@ enum PP_WebSocketReadyState { PP_WEBSOCKETREADYSTATE_CLOSED = 3 }; +/** + * 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(). + */ +[assert_size(4)] +enum PP_WebSocketCloseCode { + /** + * 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 +}; + interface PPB_WebSocket { /** * Create() creates a WebSocket instance. @@ -121,6 +237,12 @@ interface PPB_WebSocket { * 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>. |