    View Javadoc
    1   package org.apache.commons.net.telnet;
    2
    3   /* ====================================================================
    4    * The Apache Software License, Version 1.1
    5    *
    6    * Copyright (c) 2001 The Apache Software Foundation.  All rights
    7    * reserved.
    8    *
    9    * Redistribution and use in source and binary forms, with or without
    10   * modification, are permitted provided that the following conditions
    11   * are met:
    12   *
    13   * 1. Redistributions of source code must retain the above copyright
    14   *    notice, this list of conditions and the following disclaimer.
    15   *
    16   * 2. Redistributions in binary form must reproduce the above copyright
    17   *    notice, this list of conditions and the following disclaimer in
    18   *    the documentation and/or other materials provided with the
    19   *    distribution.
    20   *
    21   * 3. The end-user documentation included with the redistribution,
    22   *    if any, must include the following acknowledgment:
    23   *       "This product includes software developed by the
    24   *        Apache Software Foundation (http://www.apache.org/)."
    25   *    Alternately, this acknowledgment may appear in the software itself,
    26   *    if and wherever such third-party acknowledgments normally appear.
    27   *
    28   * 4. The names "Apache" and "Apache Software Foundation" and
    29   *    "Apache Commons" must not be used to endorse or promote products
    30   *    derived from this software without prior written permission. For
    31   *    written permission, please contact apache@apache.org.
    32   *
    33   * 5. Products derived from this software may not be called "Apache",
    34   *    nor may "Apache" appear in their name, without
    35   *    prior written permission of the Apache Software Foundation.
    36   *
    37   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    38   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    39   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    40   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    41   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    42   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    43   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    44   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    45   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    46   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    47   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    48   * SUCH DAMAGE.
    49   * ====================================================================
    50   *
    51   * This software consists of voluntary contributions made by many
    52   * individuals on behalf of the Apache Software Foundation.  For more
    53   * information on the Apache Software Foundation, please see
    54   * <http://www.apache.org/>;.
    55   */
    56
    57  /****
    58   * The TelnetOption class cannot be instantiated and only serves as a
    59   * storehouse for telnet option constants.
    60   * <p>
    61   * Details regarding Telnet option specification can be found in RFC 855.
    62   * <p>
    63   * <p>
    64   * @author Daniel F. Savarese
    65   * @see org.apache.commons.net.telnet.Telnet
    66   * @see org.apache.commons.net.telnet.TelnetClient
    67   ***/
    68
    69  public class TelnetOption
    70  {
    71      /**** The maximum value an option code can have.  This value is 255. ***/
    72      public static final int MAX_OPTION_VALUE = 255;
    73
    74      public static int BINARY = 0;
    75
    76      public static int ECHO = 1;
    77
    78      public static int PREPARE_TO_RECONNECT = 2;
    79
    80      public static int SUPPRESS_GO_AHEAD = 3;
    81
    82      public static int APPROXIMATE_MESSAGE_SIZE = 4;
    83
    84      public static int STATUS = 5;
    85
    86      public static int TIMING_MARK = 6;
    87
    88      public static int REMOTE_CONTROLLED_TRANSMISSION = 7;
    89
    90      public static int NEGOTIATE_OUTPUT_LINE_WIDTH = 8;
    91
    92      public static int NEGOTIATE_OUTPUT_PAGE_SIZE = 9;
    93
    94      public static int NEGOTIATE_CARRIAGE_RETURN = 10;
    95
    96      public static int NEGOTIATE_HORIZONTAL_TAB_STOP = 11;
    97
    98      public static int NEGOTIATE_HORIZONTAL_TAB = 12;
    99
    100     public static int NEGOTIATE_FORMFEED = 13;
    101
    102     public static int NEGOTIATE_VERTICAL_TAB_STOP = 14;
    103
    104     public static int NEGOTIATE_VERTICAL_TAB = 15;
    105
    106     public static int NEGOTIATE_LINEFEED = 16;
    107
    108     public static int EXTENDED_ASCII = 17;
    109
    110     public static int FORCE_LOGOUT = 18;
    111
    112     public static int BYTE_MACRO = 19;
    113
    114     public static int DATA_ENTRY_TERMINAL = 20;
    115
    116     public static int SUPDUP = 21;
    117
    118     public static int SUPDUP_OUTPUT = 22;
    119
    120     public static int SEND_LOCATION = 23;
    121
    122     public static int TERMINAL_TYPE = 24;
    123
    124     public static int END_OF_RECORD = 25;
    125
    126     public static int TACACS_USER_IDENTIFICATION = 26;
    127
    128     public static int OUTPUT_MARKING = 27;
    129
    130     public static int TERMINAL_LOCATION_NUMBER = 28;
    131
    132     public static int REGIME_3270 = 29;
    133
    134     public static int X3_PAD = 30;
    135
    136     public static int WINDOW_SIZE = 31;
    137
    138     public static int TERMINAL_SPEED = 32;
    139
    140     public static int REMOTE_FLOW_CONTROL = 33;
    141
    142     public static int LINEMODE = 34;
    143
    144     public static int X_DISPLAY_LOCATION = 35;
    145
    146     public static int OLD_ENVIRONMENT_VARIABLES = 36;
    147
    148     public static int AUTHENTICATION = 37;
    149
    150     public static int ENCRYPTION = 38;
    151
    152     public static int NEW_ENVIRONMENT_VARIABLES = 39;
    153
    154     public static int EXTENDED_OPTIONS_LIST = 255;
    155
    156     private static int __FIRST_OPTION = BINARY;
    157     private static int __LAST_OPTION = NEW_ENVIRONMENT_VARIABLES;
    158
    159     private static final String __optionString[] = {
    160                 "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS",
    161                 "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", "NAOHTD",
    162                 "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT",
    163                 "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
    164                 "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID",
    165                 "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED",
    166                 "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
    167                 "ENCRYPT", "NEW-ENVIRON"
    168             };
    169
    170
    171     /****
    172      * Returns the string representation of the telnet protocol option
    173      * corresponding to the given option code.
    174      * <p>
    175      * @param The option code of the telnet protocol option
    176      * @return The string representation of the telnet protocol option.
    177      ***/
    178     public static final String getOption(int code)
    179     {
    180         return __optionString[code];
    181     }
    182
    183
    184     /****
    185      * Determines if a given option code is valid.  Returns true if valid,
    186      * false if not.
    187      * <p>
    188      * @param code  The option code to test.
    189      * @return True if the option code is valid, false if not.
    190      **/
    191     public static final boolean isValidOption(int code)
    192     {
    193         return (code <= __LAST_OPTION);
    194     }
    195
    196     // Cannot be instantiated
    197     private TelnetOption()
    198     { }
    199 }

This page was automatically generated by Maven