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   * Simple option handler that can be used for options
22   * that don't require subnegotiation.
23   * <p>
24   * @author Bruno D'Avanzo
25   ***/
26  public class SimpleOptionHandler extends TelnetOptionHandler
27  {
28      /***
29       * Constructor for the SimpleOptionHandler. Allows defining desired
30       * initial setting for local/remote activation of this option and
31       * behaviour in case a local/remote activation request for this
32       * option is received.
33       * <p>
34       * @param optcode - option code.
35       * @param initlocal - if set to true, a WILL is sent upon connection.
36       * @param initremote - if set to true, a DO is sent upon connection.
37       * @param acceptlocal - if set to true, any DO request is accepted.
38       * @param acceptremote - if set to true, any WILL request is accepted.
39       ***/
40      public SimpleOptionHandler(int optcode,
41                                  boolean initlocal,
42                                  boolean initremote,
43                                  boolean acceptlocal,
44                                  boolean acceptremote)
45      {
46          super(optcode, initlocal, initremote,
47                                        acceptlocal, acceptremote);
48      }
49  
50      /***
51       * Constructor for the SimpleOptionHandler. Initial and accept
52       * behaviour flags are set to false
53       * <p>
54       * @param optcode - option code.
55       ***/
56      public SimpleOptionHandler(int optcode)
57      {
58          super(optcode, false, false, false, false);
59      }
60  
61      /***
62       * Implements the abstract method of TelnetOptionHandler.
63       * <p>
64       * @param suboptionData - the sequence received, whithout IAC SB & IAC SE
65       * @param suboptionLength - the length of data in suboption_data
66       * <p>
67       * @return always null (no response to subnegotiation)
68       ***/
69      @Override
70      public int[] answerSubnegotiation(int suboptionData[], int suboptionLength)
71      {
72          return null;
73      }
74  
75      /***
76       * Implements the abstract method of TelnetOptionHandler.
77       * <p>
78       * @return always null (no response to subnegotiation)
79       ***/
80      @Override
81      public int[] startSubnegotiationLocal()
82      {
83          return null;
84      }
85  
86      /***
87       * Implements the abstract method of TelnetOptionHandler.
88       * <p>
89       * @return always null (no response to subnegotiation)
90       ***/
91      @Override
92      public int[] startSubnegotiationRemote()
93      {
94          return null;
95      }
96  }