/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.guacamole.protocol;

/**
 * An enum that specifies protocol capabilities that can be used to help
 * detect whether or not a particular protocol version contains a capability.
 */
public enum GuacamoleProtocolCapability {
    
    /**
     * Whether or not the protocol supports arbitrary ordering of the
     * handshake instructions.  This was introduced in VERSION_1_1_0.
     */
    ARBITRARY_HANDSHAKE_ORDER(GuacamoleProtocolVersion.VERSION_1_1_0),
    
    /**
     * Whether or not the protocol supports the ability to dynamically
     * detect the version client and server are running in order to allow
     * compatibility between differing client and server versions.  This
     * was introduced in VERSION_1_1_0.
     */
    PROTOCOL_VERSION_DETECTION(GuacamoleProtocolVersion.VERSION_1_1_0),
    
    /**
     * Whether or not the protocol supports the timezone instruction during
     * the Client-Server handshake phase.  This was introduced in
     * VERSION_1_1_0.
     */
    TIMEZONE_HANDSHAKE(GuacamoleProtocolVersion.VERSION_1_1_0);
    
    /**
     * The minimum protocol version required to support this capability.
     */
    private final GuacamoleProtocolVersion version;
    
    /**
     * Create a new enum value with the given protocol version as the minimum
     * required to support the capability.
     * 
     * @param version
     *     The minimum required protocol version for supporting the
     *     capability.
     */
    private GuacamoleProtocolCapability(GuacamoleProtocolVersion version) {
        this.version = version;
    }

    /**
     * Returns whether this capability is supported in the given Guacamole
     * protocol version.
     *
     * @param version
     *     The Guacamole protocol version to check.
     *
     * @return
     *     true if this capability is supported by the given protocol version,
     *     false otherwise.
     */
    public boolean isSupported(GuacamoleProtocolVersion version) {
        return version.atLeast(this.version);
    }

}

@@ -853,340 +853,385 @@
 %0A * 
-An enum that specifies protocol capabilities that can be used to help%0A * detect whether or not a particular protocol version contains a capability.%0A */%0Apublic enum GuacamoleProtocolCapability %7B%0A    %0A    /**%0A     * Whether or not the protocol supports arbitrary ordering of the%0A     * handshake instructions.  This was introduced in 
+Capabilities which may not be present in all versions of the Guacamole%0A * protocol.%0A */%0Apublic enum GuacamoleProtocolCapability %7B%0A    %0A    /**%0A     * The protocol does not require handshake instructions to be sent in a%0A     * specific order, nor that all handshake instructions be sent. Arbitrary%0A     * handshake order was introduced in%0A     * %7B@link GuacamoleProtocolVersion#
 VERS
@@ -1231,32 +1231,33 @@
 on#VERSION_1_1_0
+%7D
 .%0A     */%0A    AR
@@ -1345,244 +1345,221 @@
   * 
-Whether or not the protocol supports the ability to dynamically%0A     * detect the version client and server are running in order to allow%0A     * compatibility between differing client and server versions.  This%0A     * was introduced in 
+Negotiation of Guacamole protocol version between client and server%0A     * during the protocol handshake. The ability to negotiate protocol%0A     * versions was introduced in%0A     * %7B@link GuacamoleProtocolVersion#
 VERS
@@ -1559,32 +1559,33 @@
 on#VERSION_1_1_0
+%7D
 .%0A     */%0A    PR
@@ -1674,57 +1674,71 @@
   * 
-Whether or not the protocol supports t
+Support for the %22timezone%22 handshake instruction. T
 he 
+%22
 timezone
  ins
@@ -1733,16 +1733,24 @@
 timezone
+%22%0A     *
  instruc
@@ -1758,88 +1758,239 @@
 ion 
-during%0A     * the Client-Server handshake phase.  This was introduced in%0A     * 
+allows the client to request that the server forward their%0A     * local timezone for use within the remote desktop session. Support for%0A     * forwarding the client timezone was introduced in%0A     * %7B@link GuacamoleProtocolVersion#
 VERS
@@ -1998,16 +1998,17 @@
 ON_1_1_0
+%7D
 .%0A     *

Clarify meaning of protocol capabilities.