    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 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     * The remote party sent a DO command.
    030     */
    031    int RECEIVED_DO = 1;
    032
    033    /**
    034     * The remote party sent a {@code DONT} command.
    035     */
    036    int RECEIVED_DONT = 2;
    037
    038    /**
    039     * The remote party sent a {@code WILL} command.
    040     */
    041    int RECEIVED_WILL = 3;
    042
    043    /**
    044     * The remote party sent a {@code WONT} command.
    045     */
    046    int RECEIVED_WONT = 4;
    047
    048    /**
    049     * The remote party sent a {@code COMMAND}.
    050     *
    051     * @since 2.2
    052     */
    053    int RECEIVED_COMMAND = 5;
    054
    055    /**
    056     * Callback method called when TelnetClient receives a command or option negotiation command
    057     *
    058     * @param negotiation_code - type of (negotiation) command received (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT, RECEIVED_COMMAND)
    059     *
    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}