protocol-types.h (10812B)
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 20#ifndef _GUAC_PROTOCOL_TYPES_H 21#define _GUAC_PROTOCOL_TYPES_H 22 23/** 24 * Type definitions related to the Guacamole protocol. 25 * 26 * @file protocol-types.h 27 */ 28 29/** 30 * Set of all possible status codes returned by protocol operations. These 31 * codes relate to Guacamole server/client communication, and not to internal 32 * communication of errors within libguac and linked software. 33 * 34 * In general: 35 * 36 * 0x0000 - 0x00FF: Successful operations. 37 * 0x0100 - 0x01FF: Operations that failed due to implementation status. 38 * 0x0200 - 0x02FF: Operations that failed due to remote state/environment. 39 * 0x0300 - 0x03FF: Operations that failed due to user/client action. 40 * 41 * There is a general correspondence of these status codes with HTTP response 42 * codes. 43 */ 44typedef enum guac_protocol_status { 45 46 /** 47 * The operation succeeded. 48 */ 49 GUAC_PROTOCOL_STATUS_SUCCESS = 0x0000, 50 51 /** 52 * The requested operation is unsupported. 53 */ 54 GUAC_PROTOCOL_STATUS_UNSUPPORTED = 0x0100, 55 56 /** 57 * The operation could not be performed due to an internal failure. 58 */ 59 GUAC_PROTOCOL_STATUS_SERVER_ERROR = 0x0200, 60 61 /** 62 * The operation could not be performed due as the server is busy. 63 */ 64 GUAC_PROTOCOL_STATUS_SERVER_BUSY = 0x0201, 65 66 /** 67 * The operation could not be performed because the upstream server 68 * is not responding. 69 */ 70 GUAC_PROTOCOL_STATUS_UPSTREAM_TIMEOUT = 0x0202, 71 72 /** 73 * The operation was unsuccessful due to an error or otherwise 74 * unexpected condition of the upstream server. 75 */ 76 GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR = 0x0203, 77 78 /** 79 * The operation could not be performed as the requested resource 80 * does not exist. 81 */ 82 GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND = 0x0204, 83 84 /** 85 * The operation could not be performed as the requested resource is 86 * already in use. 87 */ 88 GUAC_PROTOCOL_STATUS_RESOURCE_CONFLICT = 0x0205, 89 90 /** 91 * The operation could not be performed as the requested resource is now 92 * closed. 93 */ 94 GUAC_PROTOCOL_STATUS_RESOURCE_CLOSED = 0x0206, 95 96 /** 97 * The operation could not be performed because the upstream server does 98 * not appear to exist. 99 */ 100 GUAC_PROTOCOL_STATUS_UPSTREAM_NOT_FOUND = 0x0207, 101 102 /** 103 * The operation could not be performed because the upstream server is not 104 * available to service the request. 105 */ 106 GUAC_PROTOCOL_STATUS_UPSTREAM_UNAVAILABLE = 0x0208, 107 108 /** 109 * The session within the upstream server has ended because it conflicted 110 * with another session. 111 */ 112 GUAC_PROTOCOL_STATUS_SESSION_CONFLICT = 0x0209, 113 114 /** 115 * The session within the upstream server has ended because it appeared to 116 * be inactive. 117 */ 118 GUAC_PROTOCOL_STATUS_SESSION_TIMEOUT = 0x020A, 119 120 /** 121 * The session within the upstream server has been forcibly terminated. 122 */ 123 GUAC_PROTOCOL_STATUS_SESSION_CLOSED = 0x020B, 124 125 /** 126 * The operation could not be performed because bad parameters were 127 * given. 128 */ 129 GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST = 0x300, 130 131 /** 132 * Permission was denied to perform the operation, as the user is not 133 * yet authorized (not yet logged in, for example). 134 */ 135 GUAC_PROTOCOL_STATUS_CLIENT_UNAUTHORIZED = 0x0301, 136 137 /** 138 * Permission was denied to perform the operation, and this permission 139 * will not be granted even if the user is authorized. 140 */ 141 GUAC_PROTOCOL_STATUS_CLIENT_FORBIDDEN = 0x0303, 142 143 /** 144 * The client took too long to respond. 145 */ 146 GUAC_PROTOCOL_STATUS_CLIENT_TIMEOUT = 0x308, 147 148 /** 149 * The client sent too much data. 150 */ 151 GUAC_PROTOCOL_STATUS_CLIENT_OVERRUN = 0x30D, 152 153 /** 154 * The client sent data of an unsupported or unexpected type. 155 */ 156 GUAC_PROTOCOL_STATUS_CLIENT_BAD_TYPE = 0x30F, 157 158 /** 159 * The operation failed because the current client is already 160 * using too many resources. 161 */ 162 GUAC_PROTOCOL_STATUS_CLIENT_TOO_MANY = 0x31D 163 164} guac_protocol_status; 165 166/** 167 * Composite modes used by Guacamole draw instructions. Each 168 * composite mode maps to a unique channel mask integer. 169 */ 170typedef enum guac_composite_mode { 171 172 /* 173 * A: Source where destination transparent = S n D' 174 * B: Source where destination opaque = S n D 175 * C: Destination where source transparent = D n S' 176 * D: Destination where source opaque = D n S 177 * 178 * 0 = Active, 1 = Inactive 179 */ 180 /* ABCD */ 181 GUAC_COMP_ROUT = 0x2, /* 0010 - Clears destination where source opaque */ 182 GUAC_COMP_ATOP = 0x6, /* 0110 - Fill where destination opaque only */ 183 GUAC_COMP_XOR = 0xA, /* 1010 - XOR */ 184 GUAC_COMP_ROVER = 0xB, /* 1011 - Fill where destination transparent only */ 185 GUAC_COMP_OVER = 0xE, /* 1110 - Draw normally */ 186 GUAC_COMP_PLUS = 0xF, /* 1111 - Add */ 187 188 /* Unimplemented in client: */ 189 /* NOT IMPLEMENTED: 0000 - Clear */ 190 /* NOT IMPLEMENTED: 0011 - No operation */ 191 /* NOT IMPLEMENTED: 0101 - Additive IN */ 192 /* NOT IMPLEMENTED: 0111 - Additive ATOP */ 193 /* NOT IMPLEMENTED: 1101 - Additive RATOP */ 194 195 /* Buggy in webkit browsers, as they keep channel C on in all cases: */ 196 GUAC_COMP_RIN = 0x1, /* 0001 */ 197 GUAC_COMP_IN = 0x4, /* 0100 */ 198 GUAC_COMP_OUT = 0x8, /* 1000 */ 199 GUAC_COMP_RATOP = 0x9, /* 1001 */ 200 GUAC_COMP_SRC = 0xC /* 1100 */ 201 202 /* Bitwise composite operations (binary) */ 203 204 /* 205 * A: S' & D' 206 * B: S' & D 207 * C: S & D' 208 * D: S & D 209 * 210 * 0 = Active, 1 = Inactive 211 */ 212 213} guac_composite_mode; 214 215/** 216 * Default transfer functions. There is no current facility in the 217 * Guacamole protocol to define custom transfer functions. 218 */ 219typedef enum guac_transfer_function { 220 221 /* Constant functions */ /* ABCD */ 222 GUAC_TRANSFER_BINARY_BLACK = 0x0, /* 0000 */ 223 GUAC_TRANSFER_BINARY_WHITE = 0xF, /* 1111 */ 224 225 /* Copy functions */ 226 GUAC_TRANSFER_BINARY_SRC = 0x3, /* 0011 */ 227 GUAC_TRANSFER_BINARY_DEST = 0x5, /* 0101 */ 228 GUAC_TRANSFER_BINARY_NSRC = 0xC, /* 1100 */ 229 GUAC_TRANSFER_BINARY_NDEST = 0xA, /* 1010 */ 230 231 /* AND / NAND */ 232 GUAC_TRANSFER_BINARY_AND = 0x1, /* 0001 */ 233 GUAC_TRANSFER_BINARY_NAND = 0xE, /* 1110 */ 234 235 /* OR / NOR */ 236 GUAC_TRANSFER_BINARY_OR = 0x7, /* 0111 */ 237 GUAC_TRANSFER_BINARY_NOR = 0x8, /* 1000 */ 238 239 /* XOR / XNOR */ 240 GUAC_TRANSFER_BINARY_XOR = 0x6, /* 0110 */ 241 GUAC_TRANSFER_BINARY_XNOR = 0x9, /* 1001 */ 242 243 /* AND / NAND with inverted source */ 244 GUAC_TRANSFER_BINARY_NSRC_AND = 0x4, /* 0100 */ 245 GUAC_TRANSFER_BINARY_NSRC_NAND = 0xB, /* 1011 */ 246 247 /* OR / NOR with inverted source */ 248 GUAC_TRANSFER_BINARY_NSRC_OR = 0xD, /* 1101 */ 249 GUAC_TRANSFER_BINARY_NSRC_NOR = 0x2, /* 0010 */ 250 251 /* AND / NAND with inverted destination */ 252 GUAC_TRANSFER_BINARY_NDEST_AND = 0x2, /* 0010 */ 253 GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD, /* 1101 */ 254 255 /* OR / NOR with inverted destination */ 256 GUAC_TRANSFER_BINARY_NDEST_OR = 0xB, /* 1011 */ 257 GUAC_TRANSFER_BINARY_NDEST_NOR = 0x4 /* 0100 */ 258 259} guac_transfer_function; 260 261/** 262 * Supported line cap styles 263 */ 264typedef enum guac_line_cap_style { 265 GUAC_LINE_CAP_BUTT = 0x0, 266 GUAC_LINE_CAP_ROUND = 0x1, 267 GUAC_LINE_CAP_SQUARE = 0x2 268} guac_line_cap_style; 269 270/** 271 * Supported line join styles 272 */ 273typedef enum guac_line_join_style { 274 GUAC_LINE_JOIN_BEVEL = 0x0, 275 GUAC_LINE_JOIN_MITER = 0x1, 276 GUAC_LINE_JOIN_ROUND = 0x2 277} guac_line_join_style; 278 279/** 280 * The set of protocol versions known to guacd to handle negotiation or feature 281 * support between differing versions of Guacamole clients and guacd. 282 */ 283typedef enum guac_protocol_version { 284 285 /** 286 * An unknown version of the Guacamole protocol. 287 */ 288 GUAC_PROTOCOL_VERSION_UNKNOWN = 0x000000, 289 290 /** 291 * Original protocol version 1.0.0, which lacks support for negotiating 292 * parameters and protocol version, and requires that parameters in the 293 * client/server handshake be delivered in order. 294 */ 295 GUAC_PROTOCOL_VERSION_1_0_0 = 0x010000, 296 297 /** 298 * Protocol version 1.1.0, which includes support for parameter and version 299 * negotiation and for sending timezone information from the client 300 * to the server. 301 */ 302 GUAC_PROTOCOL_VERSION_1_1_0 = 0x010100, 303 304 /** 305 * Protocol version 1.3.0, which supports the "required" instruction, 306 * allowing connections in guacd to request information from the client and 307 * await a response. 308 */ 309 GUAC_PROTOCOL_VERSION_1_3_0 = 0x010300, 310 311 /** 312 * Protocol version 1.5.0, which supports the "msg" instruction, allowing 313 * messages to be sent to the client, and adds support for the "name" 314 * handshake instruction. 315 */ 316 GUAC_PROTOCOL_VERSION_1_5_0 = 0x010500 317 318} guac_protocol_version; 319 320/** 321 * A type that represents codes for human-readable messages sent by the "msg" 322 * instruction to the Client, that will be displayed in the client's browser. 323 * The codes will be interpreted by the client into translatable messages, and 324 * make take arguments, as noted below. 325 */ 326typedef enum guac_message_type { 327 328 /** 329 * A message that notifies the owner of a connection that another user has 330 * joined their connection. There should be a single argument provided, the 331 * name of the user who has joined. 332 */ 333 GUAC_MESSAGE_USER_JOINED = 0x0001, 334 335 /** 336 * A message that notifies the owner of a connection that another user has 337 * left their connection. There should be a single argument provided, the 338 * name of the user who has left. 339 */ 340 GUAC_MESSAGE_USER_LEFT = 0x0002 341 342} guac_message_type; 343 344#endif 345