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