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.listeners;
018
019import org.jivesoftware.smack.SmackException.NotConnectedException;
020import org.jivesoftware.smack.XMPPException;
021
022import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
023
024/**
025 * Interface for listening to transport events.
026 *
027 * @author Thiago Camargo
028 */
029public interface JingleTransportListener extends JingleListener {
030
031    /**
032     * Notification that the transport has been established.
033     *
034     * @param local  The transport candidate that has been used for listening
035     *               in the local machine
036     * @param remote The transport candidate that has been used for
037     *               transmitting to the remote machine
038     * @throws NotConnectedException if the XMPP connection is not connected.
039     * @throws InterruptedException if the calling thread was interrupted.
040     */
041    void transportEstablished(TransportCandidate local,
042                                     TransportCandidate remote) throws NotConnectedException, InterruptedException;
043
044    /**
045     * Notification that a transport must be cancelled.
046     *
047     * @param cand The transport candidate that must be cancelled. A value
048     *             of "null" means all the transports for this session.
049     */
050    void transportClosed(TransportCandidate cand);
051
052    /**
053     * Notification that the transport was closed due to an exception.
054     *
055     * @param e the exception.
056     */
057    void transportClosedOnError(XMPPException e);
058}
059