View Javadoc

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