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    
018    package 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     * <p>
029     * <p>
030     * @author Bruno D'Avanzo
031     ***/
032    
033    public interface TelnetNotificationHandler
034    {
035        /***
036         * The remote party sent a DO command.
037         ***/
038        public static final int RECEIVED_DO =   1;
039    
040        /***
041         * The remote party sent a DONT command.
042         ***/
043        public static final int RECEIVED_DONT = 2;
044    
045        /***
046         * The remote party sent a WILL command.
047         ***/
048        public static final int RECEIVED_WILL = 3;
049    
050        /***
051         * The remote party sent a WONT command.
052         ***/
053        public static final int RECEIVED_WONT = 4;
054    
055        /***
056         * The remote party sent a COMMAND.
057         * @since 2.2
058         ***/
059        public static final int RECEIVED_COMMAND = 5;
060    
061        /***
062         * Callback method called when TelnetClient receives an
063         * command or option negotiation command
064         * <p>
065         * @param negotiation_code - type of (negotiation) command received
066         * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT, RECEIVED_COMMAND)
067         * <p>
068         * @param option_code - code of the option negotiated, or the command code itself (e.g. NOP).
069         * <p>
070         ***/
071        public void receivedNegotiation(int negotiation_code, int option_code);
072    }