001/**
002 *
003 * Copyright 2003-2006 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * 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 */
017package org.jivesoftware.smackx.jingleold.nat;
018
019import org.jivesoftware.smack.SmackException.NotConnectedException;
020
021/**
022 * Transport resolver Interface .
023 */
024public interface TransportResolverListener {
025    /**
026     * Resolver listener.
027     */
028    interface Resolver extends TransportResolverListener {
029        /**
030         * The resolution process has been started.
031         */
032        void init();
033
034        /**
035         * A transport candidate has been added.
036         *
037         * @param cand The transport candidate.
038         * @throws NotConnectedException if the XMPP connection is not connected.
039         * @throws InterruptedException if the calling thread was interrupted.
040         */
041        void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException;
042
043        /**
044         * All the transport candidates have been obtained.
045         */
046        void end();
047    }
048
049    /**
050     * Resolver checker.
051     */
052    interface Checker extends TransportResolverListener {
053        /**
054         * A transport candidate has been checked.
055         *
056         * @param cand The transport candidate that has been checked.
057         * @param result True if the candidate is usable.
058         */
059        void candidateChecked(TransportCandidate cand, boolean result);
060
061        /**
062         * A transport candidate is being checked.
063         *
064         * @param cand The transport candidate that is being checked.
065         */
066        void candidateChecking(TransportCandidate cand);
067    }
068}