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