001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * https://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.apache.commons.net.telnet; 019 020/** 021 * The TelnetNotificationHandler interface can be used to handle notification of options negotiation commands received on a Telnet session. 022 * <p> 023 * The user can implement this interface and register a TelnetNotificationHandler by using the registerNotificationHandler() of TelnetClient to be notified of 024 * option negotiation commands. 025 * </p> 026 */ 027public interface TelnetNotificationHandler { 028 029 /** 030 * The remote party sent a DO command. 031 */ 032 int RECEIVED_DO = 1; 033 034 /** 035 * The remote party sent a {@code DONT} command. 036 */ 037 int RECEIVED_DONT = 2; 038 039 /** 040 * The remote party sent a {@code WILL} command. 041 */ 042 int RECEIVED_WILL = 3; 043 044 /** 045 * The remote party sent a {@code WONT} command. 046 */ 047 int RECEIVED_WONT = 4; 048 049 /** 050 * The remote party sent a {@code COMMAND}. 051 * 052 * @since 2.2 053 */ 054 int RECEIVED_COMMAND = 5; 055 056 /** 057 * Callback method called when TelnetClient receives a command or option negotiation command 058 * 059 * @param negotiation_code type of (negotiation) command received (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT, RECEIVED_COMMAND) 060 * @param option_code code of the option negotiated, or the command code itself (e.g. NOP). 061 */ 062 void receivedNegotiation(int negotiation_code, int option_code); 063}