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 * The TelnetNotificationHandler interface can be used to handle 020 * notification of options negotiation commands received on a telnet 021 * session. 022 * <p> 023 * The user can implement this interface and register a 024 * TelnetNotificationHandler by using the registerNotificationHandler() 025 * of TelnetClient to be notified of option negotiation commands. 026 * <p> 027 * <p> 028 * @author Bruno D'Avanzo 029 ***/ 030 031 public interface TelnetNotificationHandler 032 { 033 /*** 034 * The remote party sent a DO command. 035 ***/ 036 public static final int RECEIVED_DO = 1; 037 038 /*** 039 * The remote party sent a DONT command. 040 ***/ 041 public static final int RECEIVED_DONT = 2; 042 043 /*** 044 * The remote party sent a WILL command. 045 ***/ 046 public static final int RECEIVED_WILL = 3; 047 048 /*** 049 * The remote party sent a WONT command. 050 ***/ 051 public static final int RECEIVED_WONT = 4; 052 053 /*** 054 * Callback method called when TelnetClient receives an option 055 * negotiation command. 056 * <p> 057 * @param negotiation_code - type of negotiation command received 058 * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT) 059 * <p> 060 * @param option_code - code of the option negotiated 061 * <p> 062 ***/ 063 public void receivedNegotiation(int negotiation_code, int option_code); 064 }