View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.net.telnet;
19  
20  /***
21   * Implements the telnet echo option RFC 857.
22   * <p>
23   * @author Bruno D'Avanzo
24   ***/
25  public class EchoOptionHandler extends TelnetOptionHandler
26  {
27      /***
28       * Constructor for the EchoOptionHandler. Allows defining desired
29       * initial setting for local/remote activation of this option and
30       * behaviour in case a local/remote activation request for this
31       * option is received.
32       * <p>
33       * @param initlocal - if set to true, a WILL is sent upon connection.
34       * @param initremote - if set to true, a DO is sent upon connection.
35       * @param acceptlocal - if set to true, any DO request is accepted.
36       * @param acceptremote - if set to true, any WILL request is accepted.
37       ***/
38      public EchoOptionHandler(boolean initlocal, boolean initremote,
39                                  boolean acceptlocal, boolean acceptremote)
40      {
41          super(TelnetOption.ECHO, initlocal, initremote,
42                                        acceptlocal, acceptremote);
43      }
44  
45      /***
46       * Constructor for the EchoOptionHandler. Initial and accept
47       * behaviour flags are set to false
48       ***/
49      public EchoOptionHandler()
50      {
51          super(TelnetOption.ECHO, false, false, false, false);
52      }
53  
54      /***
55       * Implements the abstract method of TelnetOptionHandler.
56       * <p>
57       * @param suboptionData - the sequence received, whithout IAC SB & IAC SE
58       * @param suboptionLength - the length of data in suboption_data
59       * <p>
60       * @return always null (no response to subnegotiation)
61       ***/
62      @Override
63      public int[] answerSubnegotiation(int suboptionData[],
64                                          int suboptionLength)
65      {
66          return null;
67      }
68  
69      /***
70       * Implements the abstract method of TelnetOptionHandler.
71       * <p>
72       * @return always null (no response to subnegotiation)
73       ***/
74      @Override
75      public int[] startSubnegotiationLocal()
76      {
77          return null;
78      }
79  
80      /***
81       * Implements the abstract method of TelnetOptionHandler.
82       * <p>
83       * @return always null (no response to subnegotiation)
84       ***/
85      @Override
86      public int[] startSubnegotiationRemote()
87      {
88          return null;
89      }
90  }