source: OpenRLabs-Git/web2py/applications/rlabs/static/js/guacamole-common-js/modules/Status.js

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20var Guacamole = Guacamole || {};
21
22/**
23 * A Guacamole status. Each Guacamole status consists of a status code, defined
24 * by the protocol, and an optional human-readable message, usually only
25 * included for debugging convenience.
26 *
27 * @constructor
28 * @param {Number} code
29 *     The Guacamole status code, as defined by Guacamole.Status.Code.
30 *
31 * @param {String} [message]
32 *     An optional human-readable message.
33 */
34Guacamole.Status = function(code, message) {
35
36    /**
37     * Reference to this Guacamole.Status.
38     * @private
39     */
40    var guac_status = this;
41
42    /**
43     * The Guacamole status code.
44     * @see Guacamole.Status.Code
45     * @type {Number}
46     */
47    this.code = code;
48
49    /**
50     * An arbitrary human-readable message associated with this status, if any.
51     * The human-readable message is not required, and is generally provided
52     * for debugging purposes only. For user feedback, it is better to translate
53     * the Guacamole status code into a message.
54     *
55     * @type {String}
56     */
57    this.message = message;
58
59    /**
60     * Returns whether this status represents an error.
61     * @returns {Boolean} true if this status represents an error, false
62     *                    otherwise.
63     */
64    this.isError = function() {
65        return guac_status.code < 0 || guac_status.code > 0x00FF;
66    };
67
68};
69
70/**
71 * Enumeration of all Guacamole status codes.
72 */
73Guacamole.Status.Code = {
74
75    /**
76     * The operation succeeded.
77     *
78     * @type {Number}
79     */
80    "SUCCESS": 0x0000,
81
82    /**
83     * The requested operation is unsupported.
84     *
85     * @type {Number}
86     */
87    "UNSUPPORTED": 0x0100,
88
89    /**
90     * The operation could not be performed due to an internal failure.
91     *
92     * @type {Number}
93     */
94    "SERVER_ERROR": 0x0200,
95
96    /**
97     * The operation could not be performed as the server is busy.
98     *
99     * @type {Number}
100     */
101    "SERVER_BUSY": 0x0201,
102
103    /**
104     * The operation could not be performed because the upstream server is not
105     * responding.
106     *
107     * @type {Number}
108     */
109    "UPSTREAM_TIMEOUT": 0x0202,
110
111    /**
112     * The operation was unsuccessful due to an error or otherwise unexpected
113     * condition of the upstream server.
114     *
115     * @type {Number}
116     */
117    "UPSTREAM_ERROR": 0x0203,
118
119    /**
120     * The operation could not be performed as the requested resource does not
121     * exist.
122     *
123     * @type {Number}
124     */
125    "RESOURCE_NOT_FOUND": 0x0204,
126
127    /**
128     * The operation could not be performed as the requested resource is
129     * already in use.
130     *
131     * @type {Number}
132     */
133    "RESOURCE_CONFLICT": 0x0205,
134
135    /**
136     * The operation could not be performed as the requested resource is now
137     * closed.
138     *
139     * @type {Number}
140     */
141    "RESOURCE_CLOSED": 0x0206,
142
143    /**
144     * The operation could not be performed because the upstream server does
145     * not appear to exist.
146     *
147     * @type {Number}
148     */
149    "UPSTREAM_NOT_FOUND": 0x0207,
150
151    /**
152     * The operation could not be performed because the upstream server is not
153     * available to service the request.
154     *
155     * @type {Number}
156     */
157    "UPSTREAM_UNAVAILABLE": 0x0208,
158
159    /**
160     * The session within the upstream server has ended because it conflicted
161     * with another session.
162     *
163     * @type {Number}
164     */
165    "SESSION_CONFLICT": 0x0209,
166
167    /**
168     * The session within the upstream server has ended because it appeared to
169     * be inactive.
170     *
171     * @type {Number}
172     */
173    "SESSION_TIMEOUT": 0x020A,
174
175    /**
176     * The session within the upstream server has been forcibly terminated.
177     *
178     * @type {Number}
179     */
180    "SESSION_CLOSED": 0x020B,
181
182    /**
183     * The operation could not be performed because bad parameters were given.
184     *
185     * @type {Number}
186     */
187    "CLIENT_BAD_REQUEST": 0x0300,
188
189    /**
190     * Permission was denied to perform the operation, as the user is not yet
191     * authorized (not yet logged in, for example).
192     *
193     * @type {Number}
194     */
195    "CLIENT_UNAUTHORIZED": 0x0301,
196
197    /**
198     * Permission was denied to perform the operation, and this permission will
199     * not be granted even if the user is authorized.
200     *
201     * @type {Number}
202     */
203    "CLIENT_FORBIDDEN": 0x0303,
204
205    /**
206     * The client took too long to respond.
207     *
208     * @type {Number}
209     */
210    "CLIENT_TIMEOUT": 0x0308,
211
212    /**
213     * The client sent too much data.
214     *
215     * @type {Number}
216     */
217    "CLIENT_OVERRUN": 0x030D,
218
219    /**
220     * The client sent data of an unsupported or unexpected type.
221     *
222     * @type {Number}
223     */
224    "CLIENT_BAD_TYPE": 0x030F,
225
226    /**
227     * The operation failed because the current client is already using too
228     * many resources.
229     *
230     * @type {Number}
231     */
232    "CLIENT_TOO_MANY": 0x031D
233
234};
Note: See TracBrowser for help on using the repository browser.