001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.net.telnet;
019    
020    /***
021     * Implements the telnet echo option RFC 857.
022     * <p>
023     * @author Bruno D'Avanzo
024     ***/
025    public class EchoOptionHandler extends TelnetOptionHandler
026    {
027        /***
028         * Constructor for the EchoOptionHandler. Allows defining desired
029         * initial setting for local/remote activation of this option and
030         * behaviour in case a local/remote activation request for this
031         * option is received.
032         * <p>
033         * @param initlocal - if set to true, a WILL is sent upon connection.
034         * @param initremote - if set to true, a DO is sent upon connection.
035         * @param acceptlocal - if set to true, any DO request is accepted.
036         * @param acceptremote - if set to true, any WILL request is accepted.
037         ***/
038        public EchoOptionHandler(boolean initlocal, boolean initremote,
039                                    boolean acceptlocal, boolean acceptremote)
040        {
041            super(TelnetOption.ECHO, initlocal, initremote,
042                                          acceptlocal, acceptremote);
043        }
044    
045        /***
046         * Constructor for the EchoOptionHandler. Initial and accept
047         * behaviour flags are set to false
048         ***/
049        public EchoOptionHandler()
050        {
051            super(TelnetOption.ECHO, false, false, false, false);
052        }
053    
054        /***
055         * Implements the abstract method of TelnetOptionHandler.
056         * <p>
057         * @param suboptionData - the sequence received, whithout IAC SB & IAC SE
058         * @param suboptionLength - the length of data in suboption_data
059         * <p>
060         * @return always null (no response to subnegotiation)
061         ***/
062        @Override
063        public int[] answerSubnegotiation(int suboptionData[],
064                                            int suboptionLength)
065        {
066            return null;
067        }
068    
069        /***
070         * Implements the abstract method of TelnetOptionHandler.
071         * <p>
072         * @return always null (no response to subnegotiation)
073         ***/
074        @Override
075        public int[] startSubnegotiationLocal()
076        {
077            return null;
078        }
079    
080        /***
081         * Implements the abstract method of TelnetOptionHandler.
082         * <p>
083         * @return always null (no response to subnegotiation)
084         ***/
085        @Override
086        public int[] startSubnegotiationRemote()
087        {
088            return null;
089        }
090    }